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 Summary

    Fields 
    Modifier and Type Field Description
    static java.lang.String DEFAULT_LOGIN_LABEL
    The default label for the login name ("Login:").
    static java.lang.String DEFAULT_PASSWORD_LABEL
    The default label for the password ("Password:").
    static java.lang.String DEFAULT_PROMPT
    The default prompt text ("Please enter your Bugzilla login data!").
    static java.lang.String DEFAULT_TITLE
    The default popup title ("Bugzilla Login").
  • Constructor Summary

    Constructors 
    Constructor Description
    GuiAuthorizationCallback()
    Default Constructor.
  • Method Summary

    Modifier and Type Method Description
    void configure​(org.apache.commons.configuration.Configuration config)
    Configures the name callback.
    java.lang.String getLoginLabel()
    Returns the login label text.
    java.lang.String getName()
    Shows the popup if not done before and asks the user for credentials.
    java.lang.String getPassword()
    Shows the popup if not done before and asks the user for credentials.
    java.lang.String getPasswordLabel()
    Returns the password label text.
    java.lang.String getPrompt()
    Returns the prompt text.
    java.lang.String getTitle()
    Returns the popup title.
    void setLoginLabel​(java.lang.String loginLabel)
    Sets a text for the login label.
    void setPasswordLabel​(java.lang.String passwordLabel)
    Sets a text for the password label.
    void setPrompt​(java.lang.String prompt)
    Sets a text for the prompt.
    void setTitle​(java.lang.String title)
    Sets a text for the popup title.
    protected void showPopup()
    Shows the popup and asks for credentials.

    Methods inherited from class rs.baselib.security.AbstractAuthorizationCallback

    setName, setPassword

    Methods inherited from class java.lang.Object

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

  • Constructor Details

  • Method Details

    • configure

      public void configure​(org.apache.commons.configuration.Configuration config) throws org.apache.commons.configuration.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:
      org.apache.commons.configuration.ConfigurationException - - when configuration fails
    • getLoginLabel

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

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

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

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

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

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

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

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

      public java.lang.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 java.lang.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.