public interface Identity extends Serializable
Modifier and Type | Interface and Description |
---|---|
static class |
Identity.AuthenticationResult |
Modifier and Type | Method and Description |
---|---|
Account |
getAccount() |
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
|
boolean isLoggedIn()
Account getAccount()
Identity.AuthenticationResult login() throws AuthenticationException
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 lockedAuthenticationException
- if some unexpected error occurs or a subclass which identifies why the login
failed.void logout()
boolean hasPermission(Object resource, String operation)
resource
- The resource for which the permission is requiredoperation
- The operation that the user wishes to perform on the resourceboolean hasPermission(Class<?> resourceClass, Serializable identifier, String operation)
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.