Class UsernamePasswordMechanism
- java.lang.Object
-
- com.portwise.mvpnms.authentication.BaseAuthenticationPlugin
-
- com.portwise.mvpnms.authentication.UsernamePasswordMechanism
-
- All Implemented Interfaces:
AuthenticationMechanismInterface
- Direct Known Subclasses:
ReverseUsernameAsPassword
,UsernamePasswordOnFile
public abstract class UsernamePasswordMechanism extends BaseAuthenticationPlugin
This class enables developers to develop simple "username/password" based authentication methods. By extending this abstract authentication method the developer is offered means to develop just the functionality of taking decision whether an username and password is correct.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
UsernamePasswordMechanism.UsernamePasswordMechanismResponse
Simple inner class to delimit the response codes and progress some error messages.
-
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 UsernamePasswordMechanism()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description AuthenticationReply
authenticate(AuthenticationRequest request)
This is the authentication method from the Policy Service to the actual implementation authentication method.protected abstract UsernamePasswordMechanism.UsernamePasswordMechanismResponse
authenticate(java.lang.String username, java.lang.String password)
This is the progress of the authentication request to the actual authentication method implementation with just the username and password progressed to the authentication method.abstract boolean
exit()
This method is called during a termination of the Policy Service.boolean
init(AuthenticationMechanismConfiguration configuration, AuthenticationMechanismHandler handler)
This is the call from the Policy Service to the authentication method.protected abstract boolean
initInternal(AuthenticationMechanismConfiguration configuration, AuthenticationMechanismHandler handler)
The init call to the authentication method.protected abstract boolean
testConnect()
This method is called during initialization of the authentication method.-
Methods inherited from class com.portwise.mvpnms.authentication.BaseAuthenticationPlugin
addSessionAttribute, base64decode, clearSessionAttributes, getConfiguration, getConfigurationAttributeNameList, getConfigurationAttributeValue, getHandler, getNewSessionId, getRequestParameterValue, getSessionAttributeNameList, getSessionAttributeValue, getUserAttributeValue, getUsername
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.portwise.mvpnms.authentication.AuthenticationMechanismInterface
getName, needsReloading
-
-
-
-
Method Detail
-
authenticate
public final AuthenticationReply authenticate(AuthenticationRequest request)
This is the authentication method from the Policy Service to the actual implementation authentication method. Not of interest for an developer implementing a sub class.- Parameters:
request
- The authentication request.- Returns:
- The authentication reply.
-
exit
public abstract boolean exit()
This method is called during a termination of the Policy Service. This enables the authentication method developer to dispose any persistent connections or other resources that should be closed and finalized in a correct manner.- Returns:
- True on success, false on failure.
-
init
public final boolean init(AuthenticationMechanismConfiguration configuration, AuthenticationMechanismHandler handler)
This is the call from the Policy Service to the authentication method. Not of interest for an developer implementing a sub class.- Specified by:
init
in interfaceAuthenticationMechanismInterface
- Overrides:
init
in classBaseAuthenticationPlugin
- Parameters:
configuration
- The configuration handler.handler
- The authentication method handler.- Returns:
- The authentication method should return true if it is ready to receive authentication requests. It should return false, if the authentication method already in this call can determine that it will be unable to perform authentication requests, e.g. if for instance a configuration parameter is missing.
-
authenticate
protected abstract UsernamePasswordMechanism.UsernamePasswordMechanismResponse authenticate(java.lang.String username, java.lang.String password)
This is the progress of the authentication request to the actual authentication method implementation with just the username and password progressed to the authentication method.- Parameters:
username
- The username.password
- the password.- Returns:
- A response object containing response codes.
-
initInternal
protected abstract boolean initInternal(AuthenticationMechanismConfiguration configuration, AuthenticationMechanismHandler handler)
The init call to the authentication method. The same method parameters are progressed to the authentication method as in the AuthenticationMechanismInterface.- Parameters:
configuration
- The configuration handler.handler
- The authentication method handler.- Returns:
- True if initialization went well. Should return false if any paramters are missing or inappropriate since then it is handled as a not loaded mechanism from then on.
-
testConnect
protected abstract boolean testConnect()
This method is called during initialization of the authentication method. Enables the extending class to set-up and initialize anyMechanismServer
objects received from configuration and determine whether these configured values corresponds to correct authentication servers. If returning false, the authentication service in Policy Service will regard this as non functioning and will not propagate any authentication requests.- Returns:
- Should return true if ok, false if any error occurs and the authentication method is unable to perform the authentication service.
-
-