Class ReverseUsernameAsPassword
- java.lang.Object
-
- com.portwise.mvpnms.authentication.BaseAuthenticationPlugin
-
- com.portwise.mvpnms.authentication.UsernamePasswordMechanism
-
- com.portwise.mvpnms.authentication.example.ReverseUsernameAsPassword
-
- All Implemented Interfaces:
AuthenticationMechanismInterface
public class ReverseUsernameAsPassword extends UsernamePasswordMechanism
Example of an authentication method that returns ok when password is the reversed username. I.e. username "niber" and password "rebin" returns success.
-
-
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 ReverseUsernameAsPassword()
Constructs a new ReverseUsernameAsPassword 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 method that checks if the password is the reversed username.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 method that checks if the password is the reversed username.E.g. Username: johndoe, Password: eodnhoj -> OK! Username: kalle, Password: elak -> NOT OK!
- Specified by:
authenticate
in classUsernamePasswordMechanism
- Parameters:
username
- The username.password
- The password.- Returns:
- UsernamePasswordMechanismResponse encapsulating the response code.
-
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 authentication method is appropriately configured, false otherwise.
-
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)
-
-