Class PrincipalParser
java.lang.Object
org.simpleframework.util.parse.Parser
org.simpleframework.http.parse.PrincipalParser
- All Implemented Interfaces:
Principal
PrincipalParser is a parser class for the HTTP basic authorization
header. It decodes the
base64 encoding of the user and
password pair.
This follows the parsing tree of RFC 2617. The goal of this parser
is to decode the base64 encoding of the user name and
password. After the string has been decoded then the user name and
password are extracted. This will only parse headers that are from
the Basic authorization scheme. The format of the basic
scheme can be found in RFC 2617 and is of the form
Basic SP base64-encoding.
- Author:
- Niall Gallagher
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionCreates aParserfor the basic authorization scheme.PrincipalParser(String header) Creates aParserfor the basic authorization scheme. -
Method Summary
Modifier and TypeMethodDescriptiongetName()Gets the users name from the Authorization header value.Gets the users password parsed from the Authorization header value.protected voidinit()This will initialize theParserwhen it is ready to parse a newString.protected voidparse()Used to parse the actual header data.
-
Constructor Details
-
PrincipalParser
public PrincipalParser()Creates aParserfor the basic authorization scheme. This allows headers that are of this scheme to be broken into its component parts i.e. user name and password. -
PrincipalParser
Creates aParserfor the basic authorization scheme. This allows headers that are of this scheme to be broken into its component parts i.e. user name and password. This constructor will parse theStringgiven as the header.- Parameters:
header- this is a header value from the basic scheme
-
-
Method Details
-
getPassword
Gets the users password parsed from the Authorization header value. If there was not password parsed from the base64 value of the header this returnsnull- Specified by:
getPasswordin interfacePrincipal- Returns:
- the password for the user or
null
-
getName
-
parse
-
init
-