Class UsernamePasswordOnFile
- java.lang.Object
-
- com.portwise.mvpnms.authentication.BaseAuthenticationPlugin
-
- com.portwise.mvpnms.authentication.UsernamePasswordMechanism
-
- com.portwise.mvpnms.authentication.example.UsernamePasswordOnFile
-
- All Implemented Interfaces:
AuthenticationMechanismInterface
public class UsernamePasswordOnFile extends UsernamePasswordMechanism
Example of an authentication method that returns ok when username and password is defined in the 'USER.db' file.E.g. " ... niber rebin kalle:ellak erik=kire ... "
The username-password pairs can be specified in various manners in terms of delimitation and works successfully when using hyphens such as white space, colon, or equals as delimiter between usernames and passwords.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.portwise.mvpnms.authentication.UsernamePasswordMechanism
UsernamePasswordMechanism.UsernamePasswordMechanismResponse
-
-
Field Summary
-
Fields inherited from class com.portwise.mvpnms.authentication.BaseAuthenticationPlugin
sLogger
-
Fields inherited from interface com.portwise.mvpnms.authentication.AuthenticationMechanismInterface
ARG, AUTHENTICATED, AUTHORIZATION_PARAMETER, CA_STATUS_DISABLED, CA_STATUS_REVOKED, CERT_ERROR_MESSAGE, CERTIFICATE_ATTRIBUTE_MAPPING, CHALLENGE, CVC_FAILED_USER_CERTIFICATE, DO_PARAMETER, DOMAIN, IMAGE_DATA_URI, INVALID_CA_CERTIFICATE, INVALID_CREDENTIALS, INVALID_CRL, INVALID_USER_CERTIFICATE, MESSAGE, NO_CERTIFICATE, NO_PASSWORD, NO_USERNAME, NOT_AUTHENTICATED, NOT_AVAILABLE_SERVICE, NOT_BOUND_USER_CERTIFICATE, NOT_MAPPED_NO_UNIQUE_USER_FOUND, NOT_MAPPED_SUBJECT_DN_IN_CERT, NOT_MAPPED_USER_CERTIFICATE, PASSWORD, RADIUS_REPLY_MESSAGE, REVOKED_USER_CERTIFICATE, SERVER_INDEX, SHARED_SECRET, STATE, SVC_FAILED_USER_CERTIFICATE, TMP_MSG_BOX_URI, TVC_FAILED_CA_CERTIFICATE_EXPIRED, TVC_FAILED_CA_CERTIFICATE_NOT_YET_VALID, TVC_FAILED_USER_CERTIFICATE_EXPIRED, TVC_FAILED_USER_CERTIFICATE_NOT_YET_VALID, URL, USER_ATTRIBUTE_MAPPING, USERNAME, VENDOR
-
-
Constructor Summary
Constructors Constructor Description UsernamePasswordOnFile()
Constructs a new UsernamePasswordOnFile instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UsernamePasswordMechanism.UsernamePasswordMechanismResponse
authenticate(java.lang.String username, java.lang.String password)
The authentication call which checks the database which is populated during initialization.boolean
exit()
According to abstract class this must be implemented.java.lang.String
getName()
Returns the name of the authentication method.protected boolean
initInternal(AuthenticationMechanismConfiguration configuration, AuthenticationMechanismHandler handler)
According to abstract class this must be implemented.boolean
needsReloading(java.lang.String transactionKey)
protected boolean
testConnect()
According to abstract class this must be implemented.-
Methods inherited from class com.portwise.mvpnms.authentication.UsernamePasswordMechanism
authenticate, init
-
Methods inherited from class com.portwise.mvpnms.authentication.BaseAuthenticationPlugin
addSessionAttribute, base64decode, clearSessionAttributes, getConfiguration, getConfigurationAttributeNameList, getConfigurationAttributeValue, getHandler, getNewSessionId, getRequestParameterValue, getSessionAttributeNameList, getSessionAttributeValue, getUserAttributeValue, getUsername
-
-
-
-
Method Detail
-
authenticate
public UsernamePasswordMechanism.UsernamePasswordMechanismResponse authenticate(java.lang.String username, java.lang.String password)
The authentication call which checks the database which is populated during initialization.- Specified by:
authenticate
in classUsernamePasswordMechanism
- Parameters:
username
- The username.password
- The password.- Returns:
- A UsernamePasswordMechanismResponse object containing status codes and if needed an error message.
-
exit
public boolean exit()
According to abstract class this must be implemented.- Specified by:
exit
in interfaceAuthenticationMechanismInterface
- Specified by:
exit
in classUsernamePasswordMechanism
- Returns:
- Always true since this authentication method does not need disallocation of necessary resources.
-
initInternal
protected boolean initInternal(AuthenticationMechanismConfiguration configuration, AuthenticationMechanismHandler handler)
According to abstract class this must be implemented.- Specified by:
initInternal
in classUsernamePasswordMechanism
- Parameters:
configuration
- The authentication method configuration handler.handler
- The authentication method handler.- Returns:
- True if the file username-password database file existed and was successfully opened and read. Otherwise false.
-
testConnect
protected boolean testConnect()
According to abstract class this must be implemented.- Specified by:
testConnect
in classUsernamePasswordMechanism
- Returns:
- Always true since this authentication method does not need to test any connection or allocation of necessary resources.
-
getName
public java.lang.String getName()
Description copied from interface:AuthenticationMechanismInterface
Returns the name of the authentication method.- Returns:
- The name of the authentication method.
- See Also:
AuthenticationMechanismInterface.getName()
-
needsReloading
public boolean needsReloading(java.lang.String transactionKey)
-
-