waffle.util

## Class AuthorizationHeader

- java.lang.Object
- - waffle.util.AuthorizationHeader

    public class AuthorizationHeader
    extends Object

Authorization header.

Author:
  dblock[at]dblock[dot]org

### Constructor Summary

Constructors
Constructor and Description
`AuthorizationHeader(javax.servlet.http.HttpServletRequest httpServletRequest)` Instantiates a new authorization header.

### Method Summary

All Methods Instance Methods Concrete Methods
`String` `getHeader()` Gets the header.
`String` `getSecurityPackage()` Returns a supported security package string.
`String` `getToken()` Gets the token.
`byte[]` `getTokenBytes()` Gets the token bytes.
`boolean` `isBearerAuthorizationHeader()`
`boolean` `isNtlmType1Message()` Checks if is ntlm type1 message.
`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).
`boolean` `isNull()` Checks if is null.
`boolean` `isSPNegTokenInitMessage()` Checks if is SP nego message.
`String` `toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### 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.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### 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()