Interface HttpServerAuthenticationMechanism


  • public interface HttpServerAuthenticationMechanism
    Definition of a server side HTTP authentication mechanism.
    Author:
    Darran Lofthouse
    • Method Detail

      • getMechanismName

        String getMechanismName()
        Get the name of this mechanism, where appropriate this should be the IANA registered name.
        Returns:
        the name of the mechanism.
      • evaluateRequest

        void evaluateRequest​(HttpServerRequest request)
                      throws HttpAuthenticationException
        Evaluate the current request and attempt to authenticate if appropriate. The mechanism should call the appropriate callback methods on the {link HttpServerResponse} to both indicate the outcome of the evaluation and to register any HttpServerMechanismsResponder as required.
        Parameters:
        request - representation of the HTTP request.
        Throws:
        HttpAuthenticationException - if there is an internal failure handling the authentication.
      • getNegotiatedProperty

        default Object getNegotiatedProperty​(String propertyName)
        Get the property negotiated as a result of authentication. Mechanisms only make properties available after indicating a successful authentication has completed.
        Parameters:
        propertyName - the name of the property.
        Returns:
        the value of the property or null if the specified property is not available.
      • getNegotiationProperty

        default <T> T getNegotiationProperty​(String propertyName,
                                             Class<T> type)
        Get the strongly typed property negotiated as a result of authentication. Mechanisms only make properties available after indicating a successful authentication has completed. Note: This form of the mechanism will also return null if the property is set but is of a different type.
        Parameters:
        propertyName - the name of the property.
        type - the expected type of the property.
        Returns:
        the value of the property or null if the specified property is not available or is of a different type..
      • dispose

        default void dispose()
        Dispose of any resources currently held by this authentication mechanism.