|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.security.auth.spi.RFC2617Digest
public class RFC2617Digest
An implementation of the DigestCallback that support the http digest auth as described in RFC2617 (http://www.ietf.org/rfc/rfc2617.txt). 3.2.2.1 Request-Digest If the "qop" value is "auth" or "auth-int": request-digest = <"> < KD ( H(A1), unq(nonce-value) ":" nc-value ":" unq(cnonce-value) ":" unq(qop-value) ":" H(A2) ) <"> If the "qop" directive is not present (this construction is for compatibility with RFC 2069): request-digest = <"> < KD ( H(A1), unq(nonce-value) ":" H(A2) ) > <"> See below for the definitions for A1 and A2. 3.2.2.2 A1 If the "algorithm" directive's value is "MD5" or is unspecified, then A1 is: A1 = unq(username-value) ":" unq(realm-value) ":" passwd where passwd = < user's password > If the "algorithm" directive's value is "MD5-sess", then A1 is calculated only once - on the first request by the client following receipt of a WWW-Authenticate challenge from the server. It uses the server nonce from that challenge, and the first client nonce value to construct A1 as follows: A1 = H( unq(username-value) ":" unq(realm-value) ":" passwd ) ":" unq(nonce-value) ":" unq(cnonce-value) This creates a 'session key' for the authentication of subsequent requests and responses which is different for each "authentication session", thus limiting the amount of material hashed with any one key. (Note: see further discussion of the authentication session in section 3.3.) Because the server need only use the hash of the user credentials in order to create the A1 value, this construction could be used in conjunction with a third party authentication service so that the web server would not need the actual password value. The specification of such a protocol is beyond the scope of this specification. 3.2.2.3 A2 If the "qop" directive's value is "auth" or is unspecified, then A2 is: A2 = Method ":" digest-uri-value If the "qop" value is "auth-int", then A2 is: A2 = Method ":" digest-uri-value ":" H(entity-body) 3.2.2.4 Directive values and quoted-string Note that the value of many of the directives, such as "username- value", are defined as a "quoted-string". However, the "unq" notation indicates that surrounding quotation marks are removed in forming the string A1. Thus if the Authorization header includes the fields username="Mufasa", realm=myhost@testrealm.com and the user Mufasa has password "Circle Of Life" then H(A1) would be H(Mufasa:myhost@testrealm.com:Circle Of Life) with no quotation marks in the digested string. No white space is allowed in any of the strings to which the digest function H() is applied unless that white space exists in the quoted strings or entity body whose contents make up the string to be digested. For example, the string A1 illustrated above must be Mufasa:myhost@testrealm.com:Circle Of Life with no white space on either side of the colons, but with the white space between the words used in the password value. Likewise, the other strings digested by H() must not have white space on either side of the colons which delimit their fields unless that white space was in the quoted strings or entity body being digested. Also note that if integrity protection is applied (qop=auth-int), the H(entity-body) is the hash of the entity body, not the message body - it is computed before any transfer encoding is applied by the sender and after it has been removed by the recipient. Note that this includes multipart boundaries and embedded headers in each part of any multipart content-type.
Field Summary | |
---|---|
static String |
A2HASH
An explicit A2 digest |
static String |
ALGORITHM
A string indicating a pair of algorithms used to produce the digest and a checksum. |
static String |
AUTH_PARAM
This directive allows for future extensions. |
static String |
CNONCE
This MUST be specified if a qop directive is sent (see above), and MUST NOT be specified if the server did not send a qop directive in the WWW-Authenticate header field. |
static String |
DIGEST_URI
The URI from Request-URI of the Request-Line; duplicated here because proxies are allowed to change the Request-Line in transit. |
static String |
METHOD
The http method type |
static String |
NONCE
A server-specified data string which MUST be different each time a digest-challenge is sent as part of initial authentication. |
static String |
NONCE_COUNT
This MUST be specified if a qop directive is sent (see above), and MUST NOT be specified if the server did not send a qop directive in the WWW-Authenticate header field. |
static String |
QOP
Indicates what "quality of protection" the client has applied to the message. |
static String |
REALM
String which can enable users to know which username and password to use, in case they might have different ones for different servers. |
static String |
USERNAME
The user's name in the specified realm. |
Constructor Summary | |
---|---|
RFC2617Digest()
|
Method Summary | |
---|---|
String |
getInfoDigest(MessageDigest digest)
|
void |
init(Map options)
Pass through access to the login module options. |
static void |
main(String[] args)
Compute the |
void |
postDigest(MessageDigest digest)
Post-hash callout afer the password has been added to allow for content after the password has been added. |
void |
preDigest(MessageDigest digest)
Pre-hash callout to allow for content before the password. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String REALM
public static final String USERNAME
public static final String DIGEST_URI
public static final String NONCE
public static final String CNONCE
public static final String NONCE_COUNT
public static final String QOP
public static final String ALGORITHM
public static final String AUTH_PARAM
public static final String METHOD
public static final String A2HASH
Constructor Detail |
---|
public RFC2617Digest()
Method Detail |
---|
public void init(Map options)
DigestCallback
init
in interface DigestCallback
public void preDigest(MessageDigest digest)
DigestCallback
preDigest
in interface DigestCallback
digest
- - the security digest being used for the one-way hashpublic void postDigest(MessageDigest digest)
DigestCallback
postDigest
in interface DigestCallback
digest
- - the security digest being used for the one-way hashpublic String getInfoDigest(MessageDigest digest)
public static void main(String[] args) throws NoSuchAlgorithmException
args
-
NoSuchAlgorithmException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |