Package rs.baselib.security
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.StringDEFAULT_LOGIN_LABELThe default label for the login name ("Login:").static java.lang.StringDEFAULT_PASSWORD_LABELThe default label for the password ("Password:").static java.lang.StringDEFAULT_PROMPTThe default prompt text ("Please enter your Bugzilla login data!").static java.lang.StringDEFAULT_TITLEThe default popup title ("Bugzilla Login"). -
Constructor Summary
Constructors Constructor Description GuiAuthorizationCallback()Default Constructor. -
Method Summary
Modifier and Type Method Description voidconfigure(Configuration config)Configures the name callback.java.lang.StringgetLoginLabel()Returns the login label text.java.lang.StringgetName()Shows the popup if not done before and asks the user for credentials.java.lang.StringgetPassword()Shows the popup if not done before and asks the user for credentials.java.lang.StringgetPasswordLabel()Returns the password label text.java.lang.StringgetPrompt()Returns the prompt text.java.lang.StringgetTitle()Returns the popup title.voidsetLoginLabel(java.lang.String loginLabel)Sets a text for the login label.voidsetPasswordLabel(java.lang.String passwordLabel)Sets a text for the password label.voidsetPrompt(java.lang.String prompt)Sets a text for the prompt.voidsetTitle(java.lang.String title)Sets a text for the popup title.protected voidshowPopup()Shows the popup and asks for credentials.
-
Field Details
-
DEFAULT_LOGIN_LABEL
public static final java.lang.String DEFAULT_LOGIN_LABELThe default label for the login name ("Login:").- See Also:
- Constant Field Values
-
DEFAULT_PASSWORD_LABEL
public static final java.lang.String DEFAULT_PASSWORD_LABELThe default label for the password ("Password:").- See Also:
- Constant Field Values
-
DEFAULT_PROMPT
public static final java.lang.String DEFAULT_PROMPTThe default prompt text ("Please enter your Bugzilla login data!").- See Also:
- Constant Field Values
-
DEFAULT_TITLE
public static final java.lang.String DEFAULT_TITLEThe default popup title ("Bugzilla Login").- See Also:
- Constant Field Values
-
-
Constructor Details
-
GuiAuthorizationCallback
public GuiAuthorizationCallback()Default Constructor.
-
-
Method Details
-
configure
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:
configurein interfaceIConfigurable- Parameters:
config- - configuration object- Throws:
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:
getNamein interfaceAuthorizationCallback- Overrides:
getNamein classAbstractAuthorizationCallback- 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:
getPasswordin interfaceAuthorizationCallback- Overrides:
getPasswordin classAbstractAuthorizationCallback- Returns:
- password from user
-
showPopup
protected void showPopup()Shows the popup and asks for credentials. The result of the input will be saved.
-