Package org.forgerock.http.header
Class AuthorizationHeader
- java.lang.Object
- 
- org.forgerock.http.protocol.Header
- 
- org.forgerock.http.header.AuthorizationHeader
 
 
- 
 public class AuthorizationHeader extends Header A header class representing theAuthorizationHTTP header.The Authorizationheader is made up of<type><space><credentials>, where credentials can be any text that fulfils the requirements of the type. e.g. for a type ofBasic, the credentials will bebase64encode(username + ":" + password).
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classAuthorizationHeader.FactoryA factory for creatingAuthorizationHeaderinstances.
 - 
Constructor SummaryConstructors Constructor Description AuthorizationHeader()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetCredentials()Get the credentials component of the header value.StringgetName()Returns the name of the header, as it would canonically appear within an HTTP message.StringgetRawValue()Get the raw value of the header.StringgetType()Get the type of the authorization being presented, e.g.List<String>getValues()Returns the header as a list of strings.<C> Optional<C>parseCredentials(CredentialsParser<C> parser)Parse the credentials to a rich type.AuthorizationHeadersetRawValue(String rawValue)Set the raw value of the header.static AuthorizationHeadervalueOf(String value)Parse a string as anAuthorizationheader value.static AuthorizationHeadervalueOf(Message<?> message)Constructs a new header, initialized from the specified message.- 
Methods inherited from class org.forgerock.http.protocol.Headerequals, getFirstValue, hashCode, toString
 
- 
 
- 
- 
- 
Field Detail- 
NAMEpublic static final String NAME A constant for the name of the Authorization header.- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
getNamepublic String getName() Description copied from class:HeaderReturns the name of the header, as it would canonically appear within an HTTP message.
 - 
getValuespublic List<String> getValues() Description copied from class:HeaderReturns the header as a list of strings. If the header has no values then it must return an empty list, never null. EachStringshould represent the value component of the key-value pair that makes up the HTTP header - as such, for someHeaderimplementations each String in thisListmay contain multiple token-separated values.The Listreturned from this method should not be expected to be mutable. However, some subclasses ofHeadermay choose to implement it as such.
 - 
setRawValuepublic AuthorizationHeader setRawValue(String rawValue) throws MalformedHeaderException Set the raw value of the header.- Parameters:
- rawValue- The raw value.
- Returns:
- The header.
- Throws:
- MalformedHeaderException- If the value is malformed.
 
 - 
getRawValuepublic String getRawValue() Get the raw value of the header.- Returns:
- The raw value.
 
 - 
getTypepublic String getType() Get the type of the authorization being presented, e.g.Basic- Returns:
- The type.
 
 - 
getCredentialspublic String getCredentials() Get the credentials component of the header value.- Returns:
- The credentials string.
 
 - 
parseCredentialspublic <C> Optional<C> parseCredentials(CredentialsParser<C> parser) throws MalformedHeaderException Parse the credentials to a rich type.- Type Parameters:
- C- The rich type for the credentials.
- Parameters:
- parser- The parser that can parse to the rich type.
- Returns:
- An optional of the parsed credentials, or an empty optional if the type is not supported by the
 provided parser.
- Throws:
- MalformedHeaderException- If the credentials are not valid for the type.
 
 - 
valueOfpublic static AuthorizationHeader valueOf(String value) throws MalformedHeaderException Parse a string as anAuthorizationheader value.- Parameters:
- value- The value.
- Returns:
- The header.
- Throws:
- MalformedHeaderException- If the header cannot be parsed as an- Authorizationheader.
 
 - 
valueOfpublic static AuthorizationHeader valueOf(Message<?> message) throws MalformedHeaderException Constructs a new header, initialized from the specified message.- Parameters:
- message- The message to initialize the header from.
- Returns:
- The parsed header.
- Throws:
- MalformedHeaderException- If the- Authorizationheader is present but malformed.
 
 
- 
 
-