Class DigestCredentials

java.lang.Object
org.pac4j.core.credentials.Credentials
org.pac4j.core.credentials.TokenCredentials
org.pac4j.http.credentials.DigestCredentials
All Implemented Interfaces:
Serializable

public class DigestCredentials extends org.pac4j.core.credentials.TokenCredentials

This credentials is retrieved from a HTTP request.

A user profile can be attached with the credentials if it has been created by a Authenticator. In that case, the AuthenticatorProfileCreator must be used to retrieve the attached user profile.

Since:
1.9.0
Author:
Mircea Carasel
See Also:
  • Field Summary

    Fields inherited from class org.pac4j.core.credentials.Credentials

    logoutType
  • Constructor Summary

    Constructors
    Constructor
    Description
    DigestCredentials(String token, String httpMethod, String username, String realm, String nonce, String uri, String cnonce, String nc, String qop)
    the token represents the client response attribute value in digest authorization header
  • Method Summary

    Modifier and Type
    Method
    Description
    calculateServerDigest(boolean passwordAlreadyEncoded, String password)
    This calculates the server digest value based on user stored password.

    Methods inherited from class org.pac4j.core.credentials.TokenCredentials

    canEqual, equals, getToken, hashCode, toString

    Methods inherited from class org.pac4j.core.credentials.Credentials

    getLogoutType, getUserProfile, isForAuthentication, setUserProfile

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DigestCredentials

      public DigestCredentials(String token, String httpMethod, String username, String realm, String nonce, String uri, String cnonce, String nc, String qop)
      the token represents the client response attribute value in digest authorization header
      Parameters:
      token - the token
      httpMethod - the HTTP method
      username - the user name
      realm - the realm
      nonce - nonce
      uri - uri
      cnonce - cnonce
      nc - nc
      qop - qop
  • Method Details

    • calculateServerDigest

      public String calculateServerDigest(boolean passwordAlreadyEncoded, String password)
      This calculates the server digest value based on user stored password. If the server stores password in clear format then passwordAlreadyEncoded should be false. If the server stores the password in ha1, digest then the passwordAlreadyEncoded should be true.
      Parameters:
      passwordAlreadyEncoded - false if the server stored password is in clear, true otherwise
      password - user password stored server-side
      Returns:
      digest value. This value must match the client "response" value in the Authorization http header for a successful digest authentication