Class GuiAuthorizationCallback

java.lang.Object
rs.baselib.security.AbstractAuthorizationCallback
rs.baselib.security.GuiAuthorizationCallback
All Implemented Interfaces:
IConfigurable, AuthorizationCallback

public class GuiAuthorizationCallback extends AbstractAuthorizationCallback implements IConfigurable
Implements authorization information retrieval from pop-up dialog. This implementation prompts the user for name and password.

Configuration:

 <AuthorizationCallback class="rs.baselib.security.GuiAuthorizationCallback">
 
    <!-- The default user name (optional). -->
    <login>default-user-name</login>
    
    <!-- The label to be used for user name text field (optional). -->
    <login-label>a-login-label</login-label>
    
    <!-- The label to be used for password field (optional). -->
    <password-label>a-password-label</password-label>
    
    <!-- The text to be shown explaining what to do (optional). -->
    <prompt>a-short-sentence</prompt>
    
    <!-- The title of the dialog (optional). -->
    <title>a-title</title>
    
 </AuthorizationCallback>
 
Author:
Ralph Schuster
  • Field Details

    • DEFAULT_LOGIN_LABEL

      public static final String DEFAULT_LOGIN_LABEL
      The default label for the login name ("Login:").
      See Also:
    • DEFAULT_PASSWORD_LABEL

      public static final String DEFAULT_PASSWORD_LABEL
      The default label for the password ("Password:").
      See Also:
    • DEFAULT_PROMPT

      public static final String DEFAULT_PROMPT
      The default prompt text ("Please enter your Bugzilla login data!").
      See Also:
    • DEFAULT_TITLE

      public static final String DEFAULT_TITLE
      The default popup title ("Bugzilla Login").
      See Also:
  • Constructor Details

    • GuiAuthorizationCallback

      public GuiAuthorizationCallback()
      Default Constructor.
  • Method Details

    • configure

      public void configure(Configuration config) throws ConfigurationException
      Configures the name callback. Configuration can contain three elements:
      • <login> - the default user name
      • <login-label> - the label text for login name
      • <password-label> - the label text for password
      • <prompt> - the starting text for the popup
      • <title> - the titel for the popup
      Specified by:
      configure in interface IConfigurable
      Parameters:
      config - - configuration object
      Throws:
      ConfigurationException - - when configuration fails
    • getLoginLabel

      public String getLoginLabel()
      Returns the login label text.
      Returns:
      the login label text.
    • setLoginLabel

      public void setLoginLabel(String loginLabel)
      Sets a text for the login label.
      Parameters:
      loginLabel - - the login label text to set
    • getPasswordLabel

      public String getPasswordLabel()
      Returns the password label text.
      Returns:
      the password label text
    • setPasswordLabel

      public void setPasswordLabel(String passwordLabel)
      Sets a text for the password label.
      Parameters:
      passwordLabel - - the password label text to set
    • getPrompt

      public String getPrompt()
      Returns the prompt text.
      Returns:
      the prompt text
    • setPrompt

      public void setPrompt(String prompt)
      Sets a text for the prompt.
      Parameters:
      prompt - - the prompt text to set
    • getTitle

      public String getTitle()
      Returns the popup title.
      Returns:
      the popup title
    • setTitle

      public void setTitle(String title)
      Sets a text for the popup title.
      Parameters:
      title - - the popup title to set
    • getName

      public String getName()
      Shows the popup if not done before and asks the user for credentials.
      Specified by:
      getName in interface AuthorizationCallback
      Overrides:
      getName in class AbstractAuthorizationCallback
      Returns:
      input from user.
    • getPassword

      public String getPassword()
      Shows the popup if not done before and asks the user for credentials.
      Specified by:
      getPassword in interface AuthorizationCallback
      Overrides:
      getPassword in class AbstractAuthorizationCallback
      Returns:
      password from user
    • showPopup

      protected void showPopup()
      Shows the popup and asks for credentials. The result of the input will be saved.