Class TextAuthenticationPlugin
- java.lang.Object
-
- io.vertigo.account.plugins.authentication.text.TextAuthenticationPlugin
-
- All Implemented Interfaces:
AuthenticationPlugin,io.vertigo.core.node.component.Activeable,io.vertigo.core.node.component.CoreComponent,io.vertigo.core.node.component.Plugin
public class TextAuthenticationPlugin extends Object implements AuthenticationPlugin, io.vertigo.core.node.component.Activeable
A simple implementation of the Realm interface that uses a set of configured user accounts and roles to support authentication and authorization. Each account entry specifies the username, password, and roles for a user. Roles can also be mapped to permissions and associated with users. User accounts and roles are stored in twoMaps in memory, so it is expected that the total number of either is not sufficiently large.- Since:
- 0.1
-
-
Constructor Summary
Constructors Constructor Description TextAuthenticationPlugin(String filePath, io.vertigo.core.resource.ResourceManager resourceManager)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<String>authenticateAccount(AuthenticationToken token)voidstart()voidstop()booleansupports(AuthenticationToken token)Convenience implementation that returns getAuthenticationTokenClass().isAssignableFrom( token.getClass() );.
-
-
-
Constructor Detail
-
TextAuthenticationPlugin
@Inject public TextAuthenticationPlugin(String filePath, io.vertigo.core.resource.ResourceManager resourceManager)
Constructor.- Parameters:
resourceManager- Resource ManagerfilePath- File path
-
-
Method Detail
-
supports
public boolean supports(AuthenticationToken token)
Convenience implementation that returns getAuthenticationTokenClass().isAssignableFrom( token.getClass() );. Can be overridden by subclasses for more complex token checking. Most configurations will only need to set a different class via setAuthenticationTokenClass(java.lang.Class extends org.apache.shiro.authc.AuthenticationToken>), as opposed to overriding this method.- Specified by:
supportsin interfaceAuthenticationPlugin- Parameters:
token- the token being submitted for authentication.- Returns:
- true if this authentication realm can process the submitted token instance of the class, false otherwise.
-
authenticateAccount
public Optional<String> authenticateAccount(AuthenticationToken token)
- Specified by:
authenticateAccountin interfaceAuthenticationPlugin- Parameters:
token- the token being submitted for authentication.- Returns:
- Validated Principal corresponding to the given token, or Option.empty if authentication fail.
-
start
public void start()
- Specified by:
startin interfaceio.vertigo.core.node.component.Activeable
-
stop
public void stop()
- Specified by:
stopin interfaceio.vertigo.core.node.component.Activeable
-
-