public abstract class AbstractIdentity extends Object implements Identity
Base implementation for Identity
types.
Identity.AuthenticationResult
Constructor and Description |
---|
AbstractIdentity() |
Modifier and Type | Method and Description |
---|---|
protected Account |
authenticate() |
Account |
getAccount() |
protected void |
handleSuccessfulLoginAttempt(Account validatedAccount) |
protected void |
handleUnsuccesfulLoginAttempt(Throwable e) |
boolean |
hasPermission(Class<?> resourceClass,
Serializable identifier,
String operation)
As above, however this method should be used when a reference to the resource is not available, or
is expensive to retrieve, for example looking up an entity from a relational database.
|
boolean |
hasPermission(Object resource,
String operation)
Tests if the currently authenticated user has permission to perform the specified operation on
the specified resource.
|
boolean |
isLoggedIn()
Simple check that returns true if the user is logged in, without attempting to authenticate
|
Identity.AuthenticationResult |
login()
Attempts to authenticate the user.
|
void |
logout()
Logs out the currently authenticated user
|
protected void |
logout(boolean invalidateLoginCredential) |
protected void |
postAuthenticate(Authenticator authenticator) |
public boolean isLoggedIn()
Identity
isLoggedIn
in interface Identity
public Account getAccount()
getAccount
in interface Identity
public Identity.AuthenticationResult login()
Identity
LoggedInEvent
- raised when authentication is successful
LoginFailedEvent
- raised when authentication fails
AlreadyLoggedInEvent
- raised if the user is already authenticated
LockedAccountEvent
- raised if the user is lockedlogin
in interface Identity
protected void handleSuccessfulLoginAttempt(Account validatedAccount)
protected void handleUnsuccesfulLoginAttempt(Throwable e)
protected Account authenticate() throws AuthenticationException
AuthenticationException
protected void postAuthenticate(Authenticator authenticator)
public void logout()
Identity
protected void logout(boolean invalidateLoginCredential)
public boolean hasPermission(Object resource, String operation)
Identity
hasPermission
in interface Identity
resource
- The resource for which the permission is requiredoperation
- The operation that the user wishes to perform on the resourcepublic boolean hasPermission(Class<?> resourceClass, Serializable identifier, String operation)
Identity
hasPermission
in interface Identity
resourceClass
- The class of the resourceidentifier
- The identifier of the resource, for example may be a primary key value if an entityoperation
- The operation that the user wishes to perform on the resourceCopyright © 2018 JBoss by Red Hat. All rights reserved.