Class BaseAuthenticationPlugin

    • Constructor Detail

      • BaseAuthenticationPlugin

        public BaseAuthenticationPlugin()
    • Method Detail

      • init

        public boolean init​(AuthenticationMechanismConfiguration configuration,
                            AuthenticationMechanismHandler handler)
        Initialization of the authentication method. The configuration is progressed to the authentication method as well as the handler which can assist the authentication method for instance with session and logging issues. The init() method of sub classes should call this method.
        Specified by:
        init in interface AuthenticationMechanismInterface
        Parameters:
        configuration - The configuration handler.
        handler - The authentication method handler.
        Returns:
        The authentication method should return true if it is ready to receive authentication requests. It should return false, if the authentication method already in this call can determine that it will be unable to perform authentication requests, e.g. if for instance a configuration parameter is missing.
      • getConfigurationAttributeNameList

        protected java.util.Vector getConfigurationAttributeNameList()
      • getConfigurationAttributeValue

        protected java.lang.String getConfigurationAttributeValue​(java.lang.String attributeName)
        Returns the value of the specified attribute in the configuration.
        Parameters:
        methodConfigurationList - The authentication method configuration list.
        attributeName - The attribute name to get the value for.
        Returns:
        The configuration value.
      • getRequestParameterValue

        protected static java.lang.String getRequestParameterValue​(AuthenticationRequest request,
                                                                   java.lang.String parameterName)
        Returns the value of the specified parameter in the request.
        Parameters:
        name - Name of parameter in request object
        request - Request object
        Returns:
        Value of parameter 'name'
      • getSessionAttributeNameList

        protected java.util.Vector getSessionAttributeNameList​(java.lang.String sessionId)
        Returns a vector of the attribute names contained in the session. The returned vector is never null, but may contain zero elements.
        Parameters:
        sessionId - The session ID.
        Returns:
        A list of attribute names (strings).
      • getSessionAttributeValue

        protected java.lang.String getSessionAttributeValue​(java.lang.String sessionId,
                                                            java.lang.String attributeName)
        Returns the value for the specified attribute contained in the session.
        Parameters:
        sessionID - The Session ID.
        attributeName - The name of attribute.
        Returns:
        The value of the attribute.
      • addSessionAttribute

        protected void addSessionAttribute​(java.lang.String sessionId,
                                           java.lang.String attributeName,
                                           java.lang.String attributeValue)
        Adds an attribute to the specified session.
        Parameters:
        sessionId - The session ID.
        attributeName - The name of the attribute to add.
        attributeValue - The value of the attribute to add.
      • clearSessionAttributes

        protected void clearSessionAttributes​(java.lang.String sessionId)
        Removes all attributes from the session.
        Parameters:
        sessionId - The session ID.
      • getNewSessionId

        protected java.lang.String getNewSessionId()
        Returns a new session identifier from the Policy Service session component. This is needed to be done if the user lacks a session and the authentication method needs to store certain data for the user during a "Challenge" return.
        Returns:
        The session ID, may be null when the maximum concurrent session limit is reached.
      • getUsername

        protected static java.lang.String getUsername​(java.lang.String sessionId)
        Returns the username for the specified session. Null is returned if the session doesn't exist.
        Parameters:
        sessionId - The session ID.
        Returns:
        The username or null.
      • getUserAttributeValue

        protected static java.lang.Object getUserAttributeValue​(java.lang.String userId,
                                                                java.lang.String attributeName)
        TODO Description and purpose of method. String or Vector of Strings (multi-value) (from LDAP)
        Parameters:
        userId -
        Returns:
      • base64decode

        protected static byte[] base64decode​(java.lang.String data)
        Decodes the specified Base64 string into a byte array.
        Parameters:
        data - The Base64 string to decode.
        Returns:
        A decoded byte array.