public final class SignedSecurityToken
extends java.lang.Object
implements java.io.Serializable
SecurityToken and signed with the private key of the security
manager by this class. This ensures integrity of the session token.
Before any method is called, the integrity of the security token will be checked with the
designated public key of the security manager. If this fails, a
SecurityTokenIntegrityException will be thrown. This way every component having the
public key of the security manager can validate the security token.
To improve performance, the verification for a specific public key is cached for some time. Calls arriving with the same key within the valid time since the last verification will be accepted without re-verification.
| Constructor and Description |
|---|
SignedSecurityToken(QualifiedAgent agent,
java.util.Collection<java.lang.String> capabilities,
java.security.PrivateKey privateKey)
Creates a new security token for the qualified agent providing the
designated capabilities and signs it with the designated private key.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
java.util.UUID |
getID(java.security.PublicKey publicKey)
Verifies the token and gets the unique ID of this security token which can
be used like a revision to invalidate a security token.
|
QualifiedAgent |
getQualifiedAgent(java.security.PublicKey publicKey)
Verifies the token and returns the object representing the agent who is
identified by this security token.
|
boolean |
hasCapability(java.security.PublicKey publicKey,
java.lang.String objectAccess)
Verifies the token and returns whether the owner of this token is allowed
to access the designated object in the designated way, for instance,
"ReadInstance".
|
int |
hashCode() |
void |
verify(java.security.PublicKey publicKey)
Verifies the signature of the security token against the designated public
key.
|
public SignedSecurityToken(QualifiedAgent agent, java.util.Collection<java.lang.String> capabilities, java.security.PrivateKey privateKey) throws SecurityTokenIntegrityException
agent - The agent the security token is created for; the
"owner" of the security token.capabilities - The capabilities as strings that the created security
token should provide.privateKey - The private key of the security manager to sign this
security token with.SecurityTokenIntegrityException - If the security token cannot be
signed due to problems with the keys or algorithms, a
SecurityTokenIntegrityException will be thrown.public java.util.UUID getID(java.security.PublicKey publicKey)
throws SecurityTokenIntegrityException
publicKey - The public key of the security manager to ensure that the
token is valid.SecurityTokenIntegrityException - If the designated public key does
not verify the signature of this session token, a
SecurityTokenIntegrityException will be thrown.public QualifiedAgent getQualifiedAgent(java.security.PublicKey publicKey) throws SecurityTokenIntegrityException
publicKey - The public key of the security manager to ensure that the
token is valid.SecurityTokenIntegrityException - If the designated public key does
not verify the signature of this session token, a
SecurityTokenIntegrityException will be thrown.public boolean hasCapability(java.security.PublicKey publicKey,
java.lang.String objectAccess)
throws SecurityTokenIntegrityException
publicKey - The public key of the security manager to ensure that the
token is valid.objectAccess - A string representing the object and the function the
owner of this token wants to perform.SecurityTokenIntegrityException - If the designated public key does
not verify the signature of this session token, a
SecurityTokenIntegrityException will be thrown.Capabilitiespublic final void verify(java.security.PublicKey publicKey)
throws SecurityTokenIntegrityException
SecurityTokenIntegrityException will be thrown.publicKey - The public key to verify the signature against.SecurityTokenIntegrityException - If the signature can not be
verified against the designated key and the inner security token,
a SecurityTokenIntegrityException will be thrown.public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object