Class AbstractSecurityToken
- java.lang.Object
-
- org.apache.xml.security.stax.impl.securityToken.AbstractSecurityToken
-
- All Implemented Interfaces:
SecurityToken
- Direct Known Subclasses:
AbstractInboundSecurityToken
,GenericOutboundSecurityToken
public abstract class AbstractSecurityToken extends java.lang.Object implements SecurityToken
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
asymmetric
private java.lang.String
id
protected java.util.Map<java.lang.String,java.security.Key>
keyTable
private java.security.PublicKey
publicKey
private java.lang.String
sha1Identifier
protected java.util.List<SecurityTokenConstants.TokenUsage>
tokenUsages
private java.security.cert.X509Certificate[]
x509Certificates
-
Constructor Summary
Constructors Constructor Description AbstractSecurityToken(java.lang.String id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTokenUsage(SecurityTokenConstants.TokenUsage tokenUsage)
java.lang.String
getId()
Returns the token id aka wsu:Idjava.security.PublicKey
getPublicKey()
Returns the public key if one exists and already initialized, null otherwisejava.util.Map<java.lang.String,java.security.Key>
getSecretKey()
Returns the secret key's if already initialized, null otherwisejava.lang.String
getSha1Identifier()
Returns a SHA-1 Identifier that refers to this tokenjava.util.List<SecurityTokenConstants.TokenUsage>
getTokenUsages()
java.security.cert.X509Certificate[]
getX509Certificates()
Returns the certificate chain if one exists for this token typeboolean
isAsymmetric()
Returns the token typeprotected void
setAsymmetric(boolean asymmetric)
void
setPublicKey(java.security.PublicKey publicKey)
void
setSecretKey(java.lang.String algorithmURI, java.security.Key key)
void
setSha1Identifier(java.lang.String sha1Identifier)
void
setX509Certificates(java.security.cert.X509Certificate[] x509Certificates)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.xml.security.stax.securityToken.SecurityToken
getKeyIdentifier, getKeyWrappingToken, getTokenType, getWrappedTokens
-
-
-
-
Field Detail
-
id
private final java.lang.String id
-
publicKey
private java.security.PublicKey publicKey
-
x509Certificates
private java.security.cert.X509Certificate[] x509Certificates
-
asymmetric
private boolean asymmetric
-
sha1Identifier
private java.lang.String sha1Identifier
-
keyTable
protected final java.util.Map<java.lang.String,java.security.Key> keyTable
-
tokenUsages
protected final java.util.List<SecurityTokenConstants.TokenUsage> tokenUsages
-
-
Method Detail
-
getId
public java.lang.String getId()
Description copied from interface:SecurityToken
Returns the token id aka wsu:Id- Specified by:
getId
in interfaceSecurityToken
- Returns:
- The id
-
setAsymmetric
protected void setAsymmetric(boolean asymmetric)
-
isAsymmetric
public boolean isAsymmetric() throws XMLSecurityException
Description copied from interface:SecurityToken
Returns the token type- Specified by:
isAsymmetric
in interfaceSecurityToken
- Returns:
- true if asymmetric token, false if symmetric token
- Throws:
XMLSecurityException
-
setSecretKey
public void setSecretKey(java.lang.String algorithmURI, java.security.Key key)
-
getSecretKey
public java.util.Map<java.lang.String,java.security.Key> getSecretKey() throws XMLSecurityException
Description copied from interface:SecurityToken
Returns the secret key's if already initialized, null otherwise- Specified by:
getSecretKey
in interfaceSecurityToken
- Returns:
- Algorithm-URI key map
- Throws:
XMLSecurityException
-
setPublicKey
public void setPublicKey(java.security.PublicKey publicKey)
-
getPublicKey
public java.security.PublicKey getPublicKey() throws XMLSecurityException
Description copied from interface:SecurityToken
Returns the public key if one exists and already initialized, null otherwise- Specified by:
getPublicKey
in interfaceSecurityToken
- Returns:
- the public key
- Throws:
XMLSecurityException
-
setX509Certificates
public void setX509Certificates(java.security.cert.X509Certificate[] x509Certificates)
-
getX509Certificates
public java.security.cert.X509Certificate[] getX509Certificates() throws XMLSecurityException
Description copied from interface:SecurityToken
Returns the certificate chain if one exists for this token type- Specified by:
getX509Certificates
in interfaceSecurityToken
- Returns:
- The certificate chain
- Throws:
XMLSecurityException
- if the certificates can't be retrieved
-
addTokenUsage
public void addTokenUsage(SecurityTokenConstants.TokenUsage tokenUsage) throws XMLSecurityException
- Specified by:
addTokenUsage
in interfaceSecurityToken
- Throws:
XMLSecurityException
-
getTokenUsages
public java.util.List<SecurityTokenConstants.TokenUsage> getTokenUsages()
- Specified by:
getTokenUsages
in interfaceSecurityToken
-
getSha1Identifier
public java.lang.String getSha1Identifier()
Description copied from interface:SecurityToken
Returns a SHA-1 Identifier that refers to this token- Specified by:
getSha1Identifier
in interfaceSecurityToken
- Returns:
- a SHA-1 Identifier that refers to this token
-
setSha1Identifier
public void setSha1Identifier(java.lang.String sha1Identifier)
-
-