Class RequestAuthenticator.Context

  • Enclosing interface:
    RequestAuthenticator

    public static class RequestAuthenticator.Context
    extends java.lang.Object
    Provides details for the request, to determine the appropriate credentials to return.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String realm  
      private java.net.Authenticator.RequestorType type  
      private java.net.URL url  
    • Constructor Summary

      Constructors 
      Constructor Description
      Context​(java.net.URL url, java.net.Authenticator.RequestorType type, java.lang.String realm)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.net.PasswordAuthentication credentials​(java.lang.String username, java.lang.String password)
      Helper method to return a PasswordAuthentication object.
      boolean isProxy()
      Gets if the authentication request is for a proxy.
      boolean isServer()
      Gets if the authentication request is for a server.
      java.lang.String realm()
      Get the realm of the authentication request.
      java.net.Authenticator.RequestorType type()
      Get the requestor type: PROXY if a proxy is requesting authentication, or SERVER if the URL's server is requesting.
      java.net.URL url()
      Get he URL that is being requested.
      • Methods inherited from class java.lang.Object

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

      • url

        private final java.net.URL url
      • type

        private final java.net.Authenticator.RequestorType type
      • realm

        private final java.lang.String realm
    • Constructor Detail

      • Context

        Context​(java.net.URL url,
                java.net.Authenticator.RequestorType type,
                java.lang.String realm)
    • Method Detail

      • url

        public java.net.URL url()
        Get he URL that is being requested.
        Returns:
        URL
      • type

        public java.net.Authenticator.RequestorType type()
        Get the requestor type: PROXY if a proxy is requesting authentication, or SERVER if the URL's server is requesting.
        Returns:
        requestor type
      • realm

        public java.lang.String realm()
        Get the realm of the authentication request.
        Returns:
        realm of the authentication request
      • isProxy

        public boolean isProxy()
        Gets if the authentication request is for a proxy.
        Returns:
        true if type==proxy.
      • isServer

        public boolean isServer()
        Gets if the authentication request is for a server.
        Returns:
        true if type==server.
      • credentials

        public java.net.PasswordAuthentication credentials​(java.lang.String username,
                                                           java.lang.String password)
        Helper method to return a PasswordAuthentication object.
        Parameters:
        username - username credential
        password - password credential
        Returns:
        a constructed PasswordAuthentication