Package org.aktin.broker.auth
Class Principal
java.lang.Object
org.aktin.broker.auth.Principal
- All Implemented Interfaces:
Principal,javax.ws.rs.core.SecurityContext
public class Principal extends Object implements Principal, javax.ws.rs.core.SecurityContext
-
Field Summary
Fields inherited from interface javax.ws.rs.core.SecurityContext
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH -
Constructor Summary
-
Method Summary
Modifier and Type Method Description voiddecrementWebsocketCount()StringgetAuthenticationScheme()StringgetClientDN()Retrieve the full client DN stringlonggetLastAccessed()Get the timestamp for the last known contact to the principal.StringgetName()Retrieve the user nameintgetNodeId()Get the unique node client id.PrincipalgetUserPrincipal()intgetWebsocketCount()voidincrementWebsocketCount()booleanisAdmin()booleanisNode()Determine whether the principal is a client node.booleanisSecure()booleanisUserInRole(String role)This method is not used right now.voidupdateLastAccessed()Update the last contact / last access timestamp for this user
-
Constructor Details
-
Principal
Constructor for node principal.- Parameters:
nodeId- unique node client idclientDn- distinguished name. Client information a la X.509/LDAP/etc. Should contain at least CN=display name
-
-
Method Details
-
isNode
public boolean isNode()Determine whether the principal is a client node. For client nodes,getNodeId()will be defined.- Returns:
trueif the principal is a node.
-
getClientDN
Retrieve the full client DN string- Returns:
- distinguished name
-
getName
Retrieve the user name -
getNodeId
Get the unique node client id. Will throwUnsupportedOperationExceptionif the principal is not a node- Returns:
- client id
- Throws:
UnsupportedOperationException- if the principal is not a node
-
getUserPrincipal
- Specified by:
getUserPrincipalin interfacejavax.ws.rs.core.SecurityContext
-
isUserInRole
This method is not used right now.- Specified by:
isUserInRolein interfacejavax.ws.rs.core.SecurityContext
-
isSecure
public boolean isSecure()- Specified by:
isSecurein interfacejavax.ws.rs.core.SecurityContext
-
getAuthenticationScheme
- Specified by:
getAuthenticationSchemein interfacejavax.ws.rs.core.SecurityContext
-
isAdmin
public boolean isAdmin() -
updateLastAccessed
public void updateLastAccessed()Update the last contact / last access timestamp for this user -
getLastAccessed
public long getLastAccessed()Get the timestamp for the last known contact to the principal.- Returns:
- epoch millis, e.g. similar to what is returned
System.currentTimeMillis()
-
incrementWebsocketCount
public void incrementWebsocketCount() -
decrementWebsocketCount
public void decrementWebsocketCount() -
getWebsocketCount
public int getWebsocketCount()
-