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
  • Constructor Details

    • Principal

      public Principal​(int nodeId, AuthInfo info)
      Constructor for node principal.
      Parameters:
      nodeId - unique node client id
      clientDn - 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:
      true if the principal is a node.
    • getClientDN

      public String getClientDN()
      Retrieve the full client DN string
      Returns:
      distinguished name
    • getName

      public String getName()
      Retrieve the user name
      Specified by:
      getName in interface Principal
    • getNodeId

      public int getNodeId() throws UnsupportedOperationException
      Get the unique node client id. Will throw UnsupportedOperationException if the principal is not a node
      Returns:
      client id
      Throws:
      UnsupportedOperationException - if the principal is not a node
    • getUserPrincipal

      public Principal getUserPrincipal()
      Specified by:
      getUserPrincipal in interface javax.ws.rs.core.SecurityContext
    • isUserInRole

      public boolean isUserInRole​(String role)
      This method is not used right now.
      Specified by:
      isUserInRole in interface javax.ws.rs.core.SecurityContext
    • isSecure

      public boolean isSecure()
      Specified by:
      isSecure in interface javax.ws.rs.core.SecurityContext
    • getAuthenticationScheme

      public String getAuthenticationScheme()
      Specified by:
      getAuthenticationScheme in interface javax.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()