Class LoginInterceptor
- All Implemented Interfaces:
Interceptor
- Description
The login interceptor can be used to restrict and secure end user access to an arbitrary web application.
Users firstly have to authenticate themselves against a directory server using a username and password. Secondly, a numeric token is then sent to the user's cell phone using a text message service. After token verification, access to the web application is granted for the user's session. Single Sign On can easily be realized using a small source code extension or modification of a web application.
- Explanation
The login interceptor combines 4 modules to implement its functionality. One implementation of each of the 4 module types is required. (The session manager and account blocker have default implementations.)
-
The user data provider checks user passwords and provides additional data for each user (e.g. cell phone number, Single Sign On data, etc.).
-
The session manager tracks the users' sessions across different HTTP requests (e.g. using a session cookie).
-
The account blocker tracks the number of failed login attempts and might block future login attempts for a specified amount of time.
-
The token provider generates the numeric token (possibly transmitting it to the user via a secondary channel like text messaging).
(Whether text messages and LDAP is actually used depends on the configuration. Alternatives are possible.)
The login interceptor realizes the login workflow. If all information entered by the user is valid, the workflow is as follows:
- The unauthenticated user is redirected to a login dialog.
- The user enters her username and password. (Step 1.)
- (A numeric token is sent to the user via text message, in case the telekomSMSTokenProvider is used. Steps 5 and 6.)
- The user enters her token. (Step 7.)
- The user is redirected to the originally requested URL (or a generic URL, in case the login dialog was directly requested). (Step 8.)
-
- Topic
- 6. Security
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.predic8.membrane.core.interceptor.Interceptor
Interceptor.Flow -
Field Summary
Fields inherited from class com.predic8.membrane.core.interceptor.AbstractInterceptor
name, router -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetPath()handleRequest(Exchange exc) handleResponse(Exchange exc) voidinit()Called after parsing is complete and this has been added to the object tree (whose root is Router).voidbooleanvoidsetAccountBlocker(AccountBlocker accountBlocker) voidsetExposeUserCredentialsToSession(boolean exposeUserCredentialsToSession) voidsetLocation(String location) voidsetMessage(String message) voidvoidsetSessionManager(SessionManager sessionManager) voidsetTokenProvider(TokenProvider tokenProvider) voidsetUserDataProvider(UserDataProvider userDataProvider) Methods inherited from class com.predic8.membrane.core.interceptor.AbstractInterceptor
getFlow, getHelpId, getLongDescription, getMessage, getRouter, getRule, getShortDescription, handleAbort, setDisplayName, setFlow
-
Constructor Details
-
LoginInterceptor
public LoginInterceptor()
-
-
Method Details
-
init
Description copied from class:AbstractInterceptorCalled after parsing is complete and this has been added to the object tree (whose root is Router).- Overrides:
initin classAbstractInterceptor- Throws:
Exception
-
getBasePath
-
init
- Specified by:
initin interfaceInterceptor- Overrides:
initin classAbstractInterceptor- Throws:
Exception
-
handleRequest
- Specified by:
handleRequestin interfaceInterceptor- Overrides:
handleRequestin classAbstractInterceptor- Throws:
Exception
-
handleResponse
- Specified by:
handleResponsein interfaceInterceptor- Overrides:
handleResponsein classAbstractInterceptor- Throws:
Exception
-
getLocation
-
setLocation
- Description
- location of the login dialog template (a directory containing the index.html file as well as possibly other resources) See here for a description of the format.
- Example
- file:c:/work/login/
-
getPath
-
setPath
- Description
- context path of the login dialog
- Example
- /login/
-
getUserDataProvider
-
setUserDataProvider
- Description
- The user data provider verifying a combination of a username with a password.
-
getTokenProvider
-
setTokenProvider
- Description
- The token provider computing or generating a numeric value used for two-factor authentication.
-
getSessionManager
-
setSessionManager
- Description
- The sessionManager. (Default values will be used, if the element is not specified.)
-
getAccountBlocker
-
setAccountBlocker
- Description
- The accountBlocker. (Default values will be used, if the element is not specified.)
-
isExposeUserCredentialsToSession
public boolean isExposeUserCredentialsToSession() -
setExposeUserCredentialsToSession
public void setExposeUserCredentialsToSession(boolean exposeUserCredentialsToSession) - Description
- Whether the user's credentials should be copied over to the session. This means they will stay in memory and will be available to all Membrane components.
-
getMessage
-
setMessage
- Description
- Set the message displayed during redirect.
-
getDisplayName
- Specified by:
getDisplayNamein interfaceInterceptor- Overrides:
getDisplayNamein classAbstractInterceptor
-