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
FieldsModifier and TypeFieldDescriptionstatic final String
The default label for the login name ("Login:").static final String
The default label for the password ("Password:").static final String
The default prompt text ("Please enter your Bugzilla login data!").static final String
The default popup title ("Bugzilla Login"). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(Configuration config) Configures the name callback.Returns the login label text.getName()
Shows the popup if not done before and asks the user for credentials.Shows the popup if not done before and asks the user for credentials.Returns the password label text.Returns the prompt text.getTitle()
Returns the popup title.void
setLoginLabel
(String loginLabel) Sets a text for the login label.void
setPasswordLabel
(String passwordLabel) Sets a text for the password label.void
Sets a text for the prompt.void
Sets a text for the popup title.protected void
Shows the popup and asks for credentials.Methods inherited from class rs.baselib.security.AbstractAuthorizationCallback
setName, setPassword
-
Field Details
-
DEFAULT_LOGIN_LABEL
The default label for the login name ("Login:").- See Also:
-
DEFAULT_PASSWORD_LABEL
The default label for the password ("Password:").- See Also:
-
DEFAULT_PROMPT
The default prompt text ("Please enter your Bugzilla login data!").- See Also:
-
DEFAULT_TITLE
The default popup title ("Bugzilla Login").- See Also:
-
-
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:
configure
in interfaceIConfigurable
- Parameters:
config
- - configuration object- Throws:
ConfigurationException
- - when configuration fails
-
getLoginLabel
Returns the login label text.- Returns:
- the login label text.
-
setLoginLabel
Sets a text for the login label.- Parameters:
loginLabel
- - the login label text to set
-
getPasswordLabel
Returns the password label text.- Returns:
- the password label text
-
setPasswordLabel
Sets a text for the password label.- Parameters:
passwordLabel
- - the password label text to set
-
getPrompt
Returns the prompt text.- Returns:
- the prompt text
-
setPrompt
Sets a text for the prompt.- Parameters:
prompt
- - the prompt text to set
-
getTitle
Returns the popup title.- Returns:
- the popup title
-
setTitle
Sets a text for the popup title.- Parameters:
title
- - the popup title to set
-
getName
Shows the popup if not done before and asks the user for credentials.- Specified by:
getName
in interfaceAuthorizationCallback
- Overrides:
getName
in classAbstractAuthorizationCallback
- Returns:
- input from user.
-
getPassword
Shows the popup if not done before and asks the user for credentials.- Specified by:
getPassword
in interfaceAuthorizationCallback
- Overrides:
getPassword
in classAbstractAuthorizationCallback
- Returns:
- password from user
-
showPopup
protected void showPopup()Shows the popup and asks for credentials. The result of the input will be saved.
-