Class AuthenticationChallenge


  • public class AuthenticationChallenge
    extends java.lang.Object
    A simple representation of an authentication challenge as sent in a "WWW-Authenticate" or "Proxy-Authenticate" header. Such challenges start with a mechanism name, followed either by one single token, or by a list of key=value pairs.
    See Also:
    RFC 7235, sec. 2.1
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.String,​java.lang.String> arguments  
      private java.lang.String mechanism  
      private java.lang.String token  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void addArgument​(java.lang.String key, java.lang.String value)  
      java.util.Map<java.lang.String,​java.lang.String> getArguments()
      Retrieves the arguments of the challenge.
      java.lang.String getMechanism()
      Retrieves the authentication mechanism specified by this challenge, for instance "Basic".
      java.lang.String getToken()
      Retrieves the token of the challenge, if any.
      (package private) void setToken​(java.lang.String token)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • mechanism

        private final java.lang.String mechanism
      • token

        private java.lang.String token
      • arguments

        private java.util.Map<java.lang.String,​java.lang.String> arguments
    • Constructor Detail

      • AuthenticationChallenge

        public AuthenticationChallenge​(java.lang.String mechanism)
        Create a new AuthenticationChallenge with the given mechanism.
        Parameters:
        mechanism - for the challenge
    • Method Detail

      • getMechanism

        public java.lang.String getMechanism()
        Retrieves the authentication mechanism specified by this challenge, for instance "Basic".
        Returns:
        the mechanism name
      • getToken

        public java.lang.String getToken()
        Retrieves the token of the challenge, if any.
        Returns:
        the token, or null if there is none.
      • getArguments

        @NonNull
        public java.util.Map<java.lang.String,​java.lang.String> getArguments()
        Retrieves the arguments of the challenge.
        Returns:
        a possibly empty map of the key=value arguments of the challenge
      • addArgument

        void addArgument​(java.lang.String key,
                         java.lang.String value)
      • setToken

        void setToken​(java.lang.String token)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object