public interface WSCredential
extends java.io.Serializable
Interface that defines a Credential used represent an authenticated principal to WebSphere.
Authentication mechanisms are expected to implement this interface.
Several of the method return types in this interface are array types. If implementors internally store instance data as arrays for these methods, they should return a deep copy of the array so that modifying the return result does not also modify the internally stored array.
Once a credential has been created, it is typically immutable except for expiration time.
If a credential is expired, any method access generates a
CredentialExpiredException.
The refresh()
method
of the Refreshable
interface is not implemented. A new login
must be performed.
If a credential is destroyed, any method access generates a
CredentialDestroyedException.
A destroyed credential can not be
used.
Destroyable
,
Refreshable
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
get(java.lang.String key)
Allows user to get an Object based on a key.
|
java.lang.String |
getAccessId()
Returns a string value that represents the access-Id of the principal.
|
byte[] |
getCredentialToken()
Returns the credential token.
|
long |
getExpiration()
Returns a long value that indicates when a credential will expire.
|
java.util.ArrayList |
getGroupIds()
Returns a ArrayList which indicates the groups the authenticated principal is a member of.
|
java.lang.String |
getOID()
Returns the OID that identifies the authentication mechanism, for example:
|
java.lang.String |
getPrimaryGroupId()
Returns a string value that indicates the primary group the authenticated principal is a member of.
|
java.lang.String |
getRealmName()
Return the realm name.
|
java.lang.String |
getRealmSecurityName()
Returns the realm and the user principal name, the default implementation format is
realm/user principal name. |
java.lang.String |
getRealmUniqueSecurityName()
Returns the realm and the unique user name, the default implementation format is
realm/unique user name. |
java.lang.String |
getSecurityName()
Returns the user principal name.
|
java.lang.String |
getUniqueSecurityName()
Returns the unique user name as it applies to the configured user registry.
|
boolean |
isBasicAuth()
Determines if the credential is a BasicAuth credential or not.
|
boolean |
isForwardable()
Returns a boolean value that indicates if the credential is forwardable.
|
boolean |
isUnauthenticated()
Return true if the credential is an Unauthenticated Credential.
|
java.lang.Object |
set(java.lang.String key,
java.lang.Object value)
Allows user to set an Object based on a key.
|
java.lang.String getRealmName() throws CredentialDestroyedException, javax.security.auth.login.CredentialExpiredException
Return the realm name. The format of the realm name depends on the authentication targets, for example:
If there is no realm name, null
is returned.
CredentialDestroyedException
- Thrown if credential is destroyed.javax.security.auth.login.CredentialExpiredException
- Thrown if credential is expired.java.lang.String getSecurityName() throws CredentialDestroyedException, javax.security.auth.login.CredentialExpiredException
Returns the user principal name. If there is no principal name,
null
is returned.
CredentialDestroyedException
- Thrown if credential is destroyed.javax.security.auth.login.CredentialExpiredException
- Thrown if credential is expired.java.lang.String getRealmSecurityName() throws CredentialDestroyedException, javax.security.auth.login.CredentialExpiredException
Returns the realm and the user principal name, the default implementation format is realm/user principal name
.
If there is no valid value, null
is returned.
CredentialDestroyedException
- Thrown if credential is destroyed.javax.security.auth.login.CredentialExpiredException
- Thrown if credential is expired.java.lang.String getUniqueSecurityName() throws CredentialDestroyedException, javax.security.auth.login.CredentialExpiredException
Returns the unique user name as it applies to the configured user registry. For LDAP, this would might be the DistinguishedName. For LocalOS, this might return the unique name from the local registry. For Custom, this will be whatever the custom registry getUniqueUserId() API returns.
CredentialDestroyedException
- Thrown if credential is destroyed.javax.security.auth.login.CredentialExpiredException
- Thrown if credential is expired.java.lang.String getRealmUniqueSecurityName() throws CredentialDestroyedException, javax.security.auth.login.CredentialExpiredException
Returns the realm and the unique user name, the default implementation format is realm/unique user name
.
If there is no valid value, null
is returned.
CredentialDestroyedException
- Thrown if credential is destroyed.javax.security.auth.login.CredentialExpiredException
- Thrown if credential is expired.long getExpiration() throws CredentialDestroyedException, javax.security.auth.login.CredentialExpiredException
Returns a long value that indicates when a credential will expire. The authentication mechanism determines if and when a credential expires typically when the credential was issued. The unit of measure is also determined by the actual authentication mechanism.
If there is no expiration time, 0
is returned.
CredentialDestroyedException
- Thrown if credential is destroyed.javax.security.auth.login.CredentialExpiredException
- Thrown if credential is expired.java.lang.String getPrimaryGroupId() throws CredentialDestroyedException, javax.security.auth.login.CredentialExpiredException
Returns a string value that indicates the primary group the authenticated principal is a member of.
If there is no primary group ID, null
is returned.
CredentialDestroyedException
- Thrown if credential is destroyed.javax.security.auth.login.CredentialExpiredException
- Thrown if credential is expired.java.lang.String getAccessId() throws CredentialDestroyedException, javax.security.auth.login.CredentialExpiredException
Returns a string value that represents the access-Id of the principal. An access-Id is used to uniquely identity the principal in a user registry and is typically used during authorization checks.
If there is no access-Id null
is returned.
CredentialDestroyedException
- Thrown if credential is destroyed.javax.security.auth.login.CredentialExpiredException
- Thrown if credential is expired.java.util.ArrayList getGroupIds() throws CredentialDestroyedException, javax.security.auth.login.CredentialExpiredException
Returns a ArrayList which indicates the groups the authenticated principal is a member of.
If there are no groups, an empty List is returned.
CredentialDestroyedException
- Thrown if credential is destroyed.javax.security.auth.login.CredentialExpiredException
- Thrown if credential is expired.java.lang.Object get(java.lang.String key) throws CredentialDestroyedException, javax.security.auth.login.CredentialExpiredException
Allows user to get an Object based on a key. It is similar to a hash table.
key
- A String value, wssecurity.*is keys reserved for WebSphere internal usage
CredentialDestroyedException
- Thrown if credential is destroyed.javax.security.auth.login.CredentialExpiredException
- Thrown if credential is expired.java.lang.Object set(java.lang.String key, java.lang.Object value) throws CredentialDestroyedException, javax.security.auth.login.CredentialExpiredException
Allows user to set an Object based on a key. It is similar to a hash table. Please do not use
key values begin with wssecurity.*
, the wssecurity
is the namespace reserved by WebSphere
internal usage.
key
- A String value, wssecurity.*is keys reserved for WebSphere internal usage
value
- Object to be set to associate with the keyCredentialDestroyedException
- Thrown if credential is destroyed.javax.security.auth.login.CredentialExpiredException
- Thrown if credential is expired.boolean isUnauthenticated()
Return true if the credential is an Unauthenticated Credential.
byte[] getCredentialToken() throws CredentialDestroyedException, javax.security.auth.login.CredentialExpiredException
Returns the credential token.
The Credential Token should be treated as an opaque object. It should be a deep copy of any byte array that an actual WSCredential implementation may use to store the token internally.
If there is no credential token, null
is returned.
CredentialDestroyedException
- Thrown if credential is destroyed.javax.security.auth.login.CredentialExpiredException
- Thrown if credential is expired.java.lang.String getOID() throws CredentialDestroyedException, javax.security.auth.login.CredentialExpiredException
Returns the OID that identifies the authentication mechanism, for example:
The OID is an object identifier in string format, e.g. 111.222.33 for instance.
If there is no OID, null
is returned.
CredentialDestroyedException
- Thrown if credential is destroyed.javax.security.auth.login.CredentialExpiredException
- Thrown if credential is expired.boolean isBasicAuth()
Determines if the credential is a BasicAuth credential or not. If a BasicAuth credential, it will contain data to authenticate a user, but cannot represent an authenticated user. If not a BasicAuth credential, it can be used for authorization decisions.
boolean isForwardable() throws CredentialDestroyedException, javax.security.auth.login.CredentialExpiredException
Returns a boolean value that indicates if the credential is forwardable. A forwardable credential can be propagated to other servers as part of a delegated remote method invocation. The authentication mechanism determines forwardability.
CredentialDestroyedException
- Thrown if credential is destroyed.javax.security.auth.login.CredentialExpiredException
- Thrown if credential is expired.