Package waffle.util

Class AuthorizationHeader


  • public class AuthorizationHeader
    extends Object
    Authorization header.
    Author:
    dblock[at]dblock[dot]org
    • Constructor Detail

      • AuthorizationHeader

        public AuthorizationHeader​(javax.servlet.http.HttpServletRequest httpServletRequest)
        Instantiates a new authorization header.
        Parameters:
        httpServletRequest - the http servlet request
    • Method Detail

      • getHeader

        public String getHeader()
        Gets the header.
        Returns:
        the header
      • isNull

        public boolean isNull()
        Checks if is null.
        Returns:
        true, if is null
      • getSecurityPackage

        public String getSecurityPackage()
        Returns a supported security package string. Authorization: NTLM the_token Authorization: Negotiate the_token Authorization: Bearer the_token
        Returns:
        AuthenticationScheme as SecurityPackage e.g. Negotiate, NTLM, Bearer.
      • getToken

        public String getToken()
        Gets the token.
        Returns:
        the token
      • getTokenBytes

        public byte[] getTokenBytes()
        Gets the token bytes.
        Returns:
        the token bytes
      • isNtlmType1Message

        public boolean isNtlmType1Message()
        Checks if is ntlm type1 message.
        Returns:
        true, if is ntlm type1 message
      • isSPNegTokenInitMessage

        public boolean isSPNegTokenInitMessage()
        Checks if is SP nego message.
        Returns:
        true, if is SP nego message that contains NegTokenInit
      • isNtlmType1PostAuthorizationHeader

        public boolean isNtlmType1PostAuthorizationHeader()
        When using NTLM authentication and the browser is making a POST request, it preemptively sends a Type 2 authentication message (without the POSTed data). The server responds with a 401, and the browser sends a Type 3 request with the POSTed data. This is to avoid the situation where user's credentials might be potentially invalid, and all this data is being POSTed across the wire.
        Returns:
        True if request is an NTLM POST, PUT, or DELETE with an Authorization header and no data.
      • isBearerAuthorizationHeader

        public boolean isBearerAuthorizationHeader()