Class BasicAuthentication

  • All Implemented Interfaces:
    adams.core.ClassCrossReference, adams.core.CrossReference, adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.PasswordPrompter, adams.core.PasswordSupporter, adams.core.SizeOfHandler, adams.flow.core.FlowContextHandler, Serializable

    public class BasicAuthentication
    extends AbstractClientAuthentication
    implements adams.core.ClassCrossReference, adams.core.PasswordPrompter
    Generates simple user/password authentication.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected adams.core.base.BasePassword m_ActualPassword
      the actual password to use.
      protected adams.core.base.BasePassword m_Password
      the password.
      protected boolean m_PromptForPassword
      whether to prompt the user for a password if none provided.
      protected String m_User
      the user.
      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Field Detail

      • m_User

        protected String m_User
        the user.
      • m_Password

        protected adams.core.base.BasePassword m_Password
        the password.
      • m_ActualPassword

        protected adams.core.base.BasePassword m_ActualPassword
        the actual password to use.
      • m_PromptForPassword

        protected boolean m_PromptForPassword
        whether to prompt the user for a password if none provided.
    • Constructor Detail

      • BasicAuthentication

        public BasicAuthentication()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        Returns:
        a description suitable for displaying in the gui
      • defineOptions

        public void defineOptions()
        Adds options to the internal list of options.
        Specified by:
        defineOptions in interface adams.core.option.OptionHandler
        Overrides:
        defineOptions in class adams.core.option.AbstractOptionHandler
      • reset

        protected void reset()
        Resets the scheme.
        Overrides:
        reset in class adams.core.option.AbstractOptionHandler
      • setUser

        public void setUser​(String value)
        Sets the user.
        Parameters:
        value - the user
      • getUser

        public String getUser()
        Returns the user.
        Returns:
        the user
      • userTipText

        public String userTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setPassword

        public void setPassword​(adams.core.base.BasePassword value)
        Sets the password.
        Specified by:
        setPassword in interface adams.core.PasswordSupporter
        Parameters:
        value - the password
      • getPassword

        public adams.core.base.BasePassword getPassword()
        Returns the password.
        Specified by:
        getPassword in interface adams.core.PasswordSupporter
        Returns:
        the password
      • passwordTipText

        public String passwordTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setPromptForPassword

        public void setPromptForPassword​(boolean value)
        Sets whether to prompt for a password if none currently provided.
        Specified by:
        setPromptForPassword in interface adams.core.PasswordPrompter
        Parameters:
        value - true if to prompt for a password
      • getPromptForPassword

        public boolean getPromptForPassword()
        Returns whether to prompt for a password if none currently provided.
        Specified by:
        getPromptForPassword in interface adams.core.PasswordPrompter
        Returns:
        true if to prompt for a password
      • promptForPasswordTipText

        public String promptForPasswordTipText()
        Returns the tip text for this property.
        Specified by:
        promptForPasswordTipText in interface adams.core.PasswordPrompter
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getClassCrossReferences

        public Class[] getClassCrossReferences()
        Returns the cross-referenced classes.
        Specified by:
        getClassCrossReferences in interface adams.core.ClassCrossReference
        Returns:
        the classes
      • doInteract

        protected boolean doInteract()
        Performs the interaction with the user.
        Returns:
        true if successfully interacted
      • doGenerate

        protected adams.core.base.BaseKeyValuePair[] doGenerate​(adams.core.MessageCollection errors)
        Generates the authentication parameters for sending to the server.
        Specified by:
        doGenerate in class AbstractClientAuthentication
        Parameters:
        errors - for collecting errors
        Returns:
        the generated key-value pairs, null in case of an error