Class DefaultAuthentication
java.lang.Object
org.tentackle.session.auth.DefaultAuthentication
- All Implemented Interfaces:
Serializable, Authentication
@TripReferencable("NEVER")
public class DefaultAuthentication
extends Object
implements Authentication
The default implementation of an
Authentication.- Author:
- harald
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty authentication.
Required by TRIP, should an application send an authentication to a client.DefaultAuthentication(String name, Credentials credentials) Creates an authentication. -
Method Summary
Modifier and TypeMethodDescriptionGets the attributes describing the principal.Gets the credentials that were verified.longGets the epochal time this authentication expires.getName()Gets the name of the authenticated principal.Gets the name of the provider that authenticated the credentials.getRoles()Gets the roles or groups asserted by the identity provider.intGets the class id of the authenticated user.longGets the object id of the authenticated user.voidsetExpiresAt(long expiresAt) Sets the epochal time this authentication expires.voidsetProviderName(String providerName) Sets the name of the provider that authenticated the credentials.voidsetUserClassId(int userClassId) Sets the class id of the authenticated user.voidsetUserId(long userId) Sets the object id of the authenticated user.toString()
-
Constructor Details
-
DefaultAuthentication
Creates an authentication.- Parameters:
name- the principal's name, null if unknowncredentials- the verified credentials
-
DefaultAuthentication
public DefaultAuthentication()Creates an empty authentication.
Required by TRIP, should an application send an authentication to a client.
-
-
Method Details
-
getName
Description copied from interface:AuthenticationGets the name of the authenticated principal.The username for a password login, the token's subject, or preferred username for a token login. It is copied to the session info after a successful login, so it is the name the application and its audit trail will see.
- Specified by:
getNamein interfaceAuthentication- Returns:
- the principal's name, null if unknown
-
getCredentials
Description copied from interface:AuthenticationGets the credentials that were verified.- Specified by:
getCredentialsin interfaceAuthentication- Returns:
- the credentials, never null
-
getProviderName
Description copied from interface:AuthenticationGets the name of the provider that authenticated the credentials.- Specified by:
getProviderNamein interfaceAuthentication- Returns:
- the provider name, null if unknown
-
setProviderName
Sets the name of the provider that authenticated the credentials.- Parameters:
providerName- the provider name
-
getAttributes
Description copied from interface:AuthenticationGets the attributes describing the principal.For a token login these are typically the verified claims. The map is a convenient place for a
UserResolverto look up the application's user, and for the application'sSecurityManagerto derive additional grantees.- Specified by:
getAttributesin interfaceAuthentication- Returns:
- the attributes, never null
-
getRoles
Description copied from interface:AuthenticationGets the roles or groups asserted by the identity provider.These are the external roles, not Tentackle's security rules. It is up to the application to map them onto its own grantees.
- Specified by:
getRolesin interfaceAuthentication- Returns:
- the roles, never null
-
getExpiresAt
public long getExpiresAt()Description copied from interface:AuthenticationGets the epochal time this authentication expires.- Specified by:
getExpiresAtin interfaceAuthentication- Returns:
- the expiry in epochal millis, 0 if it does not expire
-
setExpiresAt
public void setExpiresAt(long expiresAt) Sets the epochal time this authentication expires.- Parameters:
expiresAt- the expiry in epochal millis, 0 if it does not expire
-
getUserId
public long getUserId()Description copied from interface:AuthenticationGets the object id of the authenticated user.- Specified by:
getUserIdin interfaceAuthentication- Returns:
- the user id, 0 if not resolved yet
-
setUserId
public void setUserId(long userId) Description copied from interface:AuthenticationSets the object id of the authenticated user.- Specified by:
setUserIdin interfaceAuthentication- Parameters:
userId- the user id
-
getUserClassId
public int getUserClassId()Description copied from interface:AuthenticationGets the class id of the authenticated user.- Specified by:
getUserClassIdin interfaceAuthentication- Returns:
- the user class id, 0 if not resolved yet
-
setUserClassId
public void setUserClassId(int userClassId) Description copied from interface:AuthenticationSets the class id of the authenticated user.- Specified by:
setUserClassIdin interfaceAuthentication- Parameters:
userClassId- the user class id
-
toString
-