public class DefaultLoginManager extends LoginManager
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
CONFIGURATION_PROPERTIES
The name of the properties file that holds the configuration.
|
protected static java.lang.String |
DEFAULT_CHANGE_DIALOG
The name of the properties enrty for the new passphrase dialog.
|
protected static java.lang.String |
DEFAULT_CONFIGURATION_PROPERTIES
The name of the properties file that holds the configuration.
|
protected static java.lang.String |
DEFAULT_NEW_PROMPT_MESSAGE_PREFIX
The name of the properties enrty for the prefix of the message presented to the user when
prompting a new passphrase or PIN.
|
protected static java.lang.String |
DEFAULT_PROMPT_DIALOG
The name of the properties enrty for the passphrase prompt dialog.
|
protected static java.lang.String |
DEFAULT_PROMPT_MESSAGE_PREFIX
The name of the properties enrty for the prefix of the message presented to the user when
prompting a passphrase or PIN.
|
protected static java.util.Properties |
defaultConfiguration_
The default configuation of this login manager.
|
protected static java.lang.String |
FORCE_PROTECTED_AUTHENTICATION_PATH
The name of the properties enrty that specifies, if the login manager should always use the
protected authentication path (no matter what the token info says).
|
protected static java.lang.String |
INVALID_NEW_PIN_WARNING
The name of the properties enrty for the message presented if the user entered an invalid new
passphrase or PIN.
|
protected static java.lang.String |
KEY_WORD_TOKEN_LABEL
The key word that is substituted with the token label.
|
protected static java.lang.String |
KEY_WORD_TRIALS_LEFT
The key word that is substituted with the number of trial left.
|
protected static java.lang.String |
LINE_SEPARATOR
The line separator used for debug outputs and in toString() methods.
|
protected static java.lang.String |
NEW_PIN_LENGTH_WARNING
The name of the properties enrty for the message presented if the user entered an new
passphrase or PIN with an invlaid length.
|
protected static java.lang.String |
NUMBER_OF_USER_LOGIN_RETRIES
The name of the properties enrty for the maximum number of wrong passphrase/PIN entries.
|
protected NewPassphrasePrompt |
passphraseChangePrompt_
The object to use for prompting pass phrases or PINs respectively.
|
protected PassphrasePrompt |
passphrasePrompt_
The object to use for prompting pass phrases or PINs respectively.
|
protected static java.lang.String |
PIN_FINAL_TRY_WARNING
The name of the properties enrty for the message presented to the user when it is the finaly
try for entering a passphrase or PIN.
|
protected static java.lang.String |
USE_PROTECTED_AUTHENTICATION_PATH
The name of the properties enrty that specifies, if the login manager should use the protected
authentication path if available.
|
protected static java.lang.String |
WRONG_PIN_WARNING
The name of the properties enrty for the message presented if the user entered a wrong
passphrase or PIN.
|
defaultProperties_, properties_
Constructor and Description |
---|
DefaultLoginManager()
Default constructor.
|
DefaultLoginManager(java.util.Properties configuration)
The constructor taking configuration parameters which override the configured defaults.
|
Modifier and Type | Method and Description |
---|---|
int |
getNumberOfLoginRetries()
Get the number of allowed login retries.
|
NewPassphrasePrompt |
getPassphraseChangePrompt()
Get the configured object for changing the PIN or pass phrase.
|
PassphrasePrompt |
getPassphrasePrompt()
Get the configured object for prompting a PIN or pass phrase.
|
boolean |
isForceProtectedAuthenticationPath()
Get if the login manager always uses the protected authentication path for prompting the user
PIN, no matter what the corresponding flag in the token info is.
|
boolean |
isUseProtectedAuthenticationPath()
Get if the login manager uses the protected authentication path for prompting the user PIN, if
this feature is available.
|
void |
login(TokenManager tokenManager,
iaik.pkcs.pkcs11.Session session,
boolean useSORole,
char[] userPIN)
Login a certain role into the given session.
|
void |
loginSO(TokenManager tokenManager,
iaik.pkcs.pkcs11.Session session,
char[] userPIN)
Login the Security Officer (SO) into the given session.
|
void |
loginUser(TokenManager tokenManager,
iaik.pkcs.pkcs11.Session session,
char[] userPIN)
Login the user into the given session.
|
void |
logout(TokenManager tokenManager,
iaik.pkcs.pkcs11.Session session)
Logout the user from the given session.
|
protected java.lang.String |
replaceKeyWord(java.lang.String message,
java.lang.String keyWord,
java.lang.String keyWordValue)
Replace all ocurrances of the key word in the given message with the given value.
|
void |
setForceProtectedAuthenticationPath(boolean forceProtectedAuthenticationPath)
Set if the login manager shall use the protected authentication path for prompting the user
PIN, if this feature is available.
|
void |
setNumberOfLoginRetries(int numberOfLoginRetries)
Set the number of allowed login retries.
|
void |
setPassphraseChangePrompt(NewPassphrasePrompt passphraseChangePrompt)
Set the handler object for changing the PIN or pass phrase.
|
void |
setPassphrasePrompt(PassphrasePrompt passphrasePrompt)
Set the handler object for prompting a PIN or pass phrase.
|
void |
setUseProtectedAuthenticationPath(boolean useProtectedAuthenticationPath)
Set if the login manager shall use the protected authentication path for prompting the user
PIN, if this feature is available.
|
void |
setUserPIN(TokenManager tokenManager,
iaik.pkcs.pkcs11.Session session,
char[] oldPIN,
char[] newPIN)
Change the user PIN.
|
protected boolean |
useNullPINs(TokenManager tokenManager,
iaik.pkcs.pkcs11.Session session)
If this method returns true, the methods for login and PIN change will pass null values to the
login and set-PIN functions, no matter if a PIN has been passed by the application or if the
token indicates that it has no protected authentication path; i.e.
|
addProperties, getProperties, propertiesChanged, setProperties
protected static final java.lang.String DEFAULT_CONFIGURATION_PROPERTIES
protected static final java.lang.String CONFIGURATION_PROPERTIES
protected static final java.lang.String DEFAULT_PROMPT_DIALOG
protected static final java.lang.String DEFAULT_CHANGE_DIALOG
protected static final java.lang.String DEFAULT_NEW_PROMPT_MESSAGE_PREFIX
protected static final java.lang.String DEFAULT_PROMPT_MESSAGE_PREFIX
protected static final java.lang.String WRONG_PIN_WARNING
protected static final java.lang.String PIN_FINAL_TRY_WARNING
protected static final java.lang.String KEY_WORD_TRIALS_LEFT
protected static final java.lang.String KEY_WORD_TOKEN_LABEL
protected static final java.lang.String NUMBER_OF_USER_LOGIN_RETRIES
protected static final java.lang.String INVALID_NEW_PIN_WARNING
protected static final java.lang.String NEW_PIN_LENGTH_WARNING
protected static final java.lang.String USE_PROTECTED_AUTHENTICATION_PATH
protected static final java.lang.String FORCE_PROTECTED_AUTHENTICATION_PATH
protected static java.lang.String LINE_SEPARATOR
protected static java.util.Properties defaultConfiguration_
protected PassphrasePrompt passphrasePrompt_
protected NewPassphrasePrompt passphraseChangePrompt_
public DefaultLoginManager()
public DefaultLoginManager(java.util.Properties configuration)
configuration
- The configuraiton properties. May be null.public PassphrasePrompt getPassphrasePrompt()
public void setPassphrasePrompt(PassphrasePrompt passphrasePrompt)
passphrasePrompt
- The object for prompting a PIN or password. Null, to use the statically configured.public NewPassphrasePrompt getPassphraseChangePrompt()
public void setPassphraseChangePrompt(NewPassphrasePrompt passphraseChangePrompt)
passphraseChangePrompt
- The object for prompting a PIN or password. Null, to use the statically configured.public int getNumberOfLoginRetries()
public void setNumberOfLoginRetries(int numberOfLoginRetries)
numberOfLoginRetries
- The number of allowed login retries.public boolean isUseProtectedAuthenticationPath()
setForceProtectedAuthenticationPath(boolean)
method.setUseProtectedAuthenticationPath(boolean)
,
setForceProtectedAuthenticationPath(boolean)
,
isForceProtectedAuthenticationPath()
public void setUseProtectedAuthenticationPath(boolean useProtectedAuthenticationPath)
setForceProtectedAuthenticationPath(boolean)
method.useProtectedAuthenticationPath
- True, if the login manager shall use the protected authentication if available, false
otherwise.isUseProtectedAuthenticationPath()
,
setForceProtectedAuthenticationPath(boolean)
,
isForceProtectedAuthenticationPath()
public boolean isForceProtectedAuthenticationPath()
setForceProtectedAuthenticationPath(boolean)
,
isUseProtectedAuthenticationPath()
,
setUseProtectedAuthenticationPath(boolean)
public void setForceProtectedAuthenticationPath(boolean forceProtectedAuthenticationPath)
forceProtectedAuthenticationPath
- True, if the login manager shall always use the protected authentication path, false
otherwise.isForceProtectedAuthenticationPath()
,
isUseProtectedAuthenticationPath()
,
setUseProtectedAuthenticationPath(boolean)
public void loginUser(TokenManager tokenManager, iaik.pkcs.pkcs11.Session session, char[] userPIN) throws IAIKPkcs11AuthenticationCanceledException, IAIKPkcs11AuthenticationException, iaik.pkcs.pkcs11.TokenException
loginUser
in class LoginManager
tokenManager
- The token manager that requests the login.session
- The session to login the user. If the session is null, the method may open a new
session.iaik.pkcs.pkcs11.TokenException
IAIKPkcs11AuthenticationCanceledException
- If the login has been canceled.IAIKPkcs11AuthenticationException
- If the user PIN could not be changed; e.g. wrong PIN.public void loginSO(TokenManager tokenManager, iaik.pkcs.pkcs11.Session session, char[] userPIN) throws iaik.pkcs.pkcs11.TokenException, IAIKPkcs11AuthenticationCanceledException, IAIKPkcs11AuthenticationException
loginSO
in class LoginManager
tokenManager
- The token manager that requests the login.session
- The session to login the SO. If the session is null, the method may open a new
session.IAIKPkcs11AuthenticationCanceledException
- If the login has been canceled.IAIKPkcs11AuthenticationException
- If the user PIN could not be changed; e.g. wrong PIN.iaik.pkcs.pkcs11.TokenException
public void login(TokenManager tokenManager, iaik.pkcs.pkcs11.Session session, boolean useSORole, char[] userPIN) throws iaik.pkcs.pkcs11.TokenException, IAIKPkcs11AuthenticationCanceledException, IAIKPkcs11AuthenticationException
login
in class LoginManager
tokenManager
- The token manager that requests the login.session
- The session to login. If the session is null, the method may open a new session.useSORole
- The role to authenticate to. Use true
to authenticate as SO, false to
authenticate as user.IAIKPkcs11AuthenticationCanceledException
- If the login has been canceled.IAIKPkcs11AuthenticationException
- If the user PIN could not be changed; e.g. wrong PIN.iaik.pkcs.pkcs11.TokenException
public void setUserPIN(TokenManager tokenManager, iaik.pkcs.pkcs11.Session session, char[] oldPIN, char[] newPIN) throws iaik.pkcs.pkcs11.TokenException, IAIKPkcs11AuthenticationCanceledException, IAIKPkcs11AuthenticationException
setUserPIN
in class LoginManager
tokenManager
- The token manager requesting the PIN change.session
- The session to use for changing the PIN. If the session is null, the method may open a
new session.oldPIN
- The old (current) user PIN or null if unavailable.newPIN
- iaik.pkcs.pkcs11.TokenException
- If the change faild because of an unexpected token error.IAIKPkcs11AuthenticationCanceledException
- If the operation has been canceled.IAIKPkcs11AuthenticationException
- If the user PIN could not be changed; e.g. wrong PIN.public void logout(TokenManager tokenManager, iaik.pkcs.pkcs11.Session session) throws iaik.pkcs.pkcs11.TokenException
logout
in class LoginManager
tokenManager
- The token manager requesting the logout.session
- The session to logout. If the session is null, the method may open a new session.iaik.pkcs.pkcs11.TokenException
- If the logout fails because of an unexpected token error.protected boolean useNullPINs(TokenManager tokenManager, iaik.pkcs.pkcs11.Session session) throws iaik.pkcs.pkcs11.TokenException
isForceProtectedAuthenticationPath()
is true, it returns true.tokenManager
- The token manager for the concernde token.session
- The session used for the operation.iaik.pkcs.pkcs11.TokenException
- If getting the token info fails.isUseProtectedAuthenticationPath()
,
setUseProtectedAuthenticationPath(boolean)
,
isForceProtectedAuthenticationPath()
,
setForceProtectedAuthenticationPath(boolean)
protected java.lang.String replaceKeyWord(java.lang.String message, java.lang.String keyWord, java.lang.String keyWordValue)
message
- The message which may contain the key word.keyWord
- The key word to search for.keyWordValue
- The value to replace for the key word.IAIK JavaSecurity Website https://jce.iaik.tugraz.at/
IAIK at Graz University of Technology, Austria, Europe
Copyright 2001-2023 IAIK, Graz University of Technology, Inffeldgasse 16a, 8010 Graz, Austria. All Rights Reserved. Version 1.9.4