public interface Realm extends Authenticator<AuthenticationToken>, Authorizer<Permission>, Authenticator.MessageAuthenticator, Authentication.AuthenticationNotifier
A Realm may be identified by name, which should be unique within the same application.
Authentication is performed using Authenticator
interface, but it is delegated to concrete
Authenticator
instances which must be registered in realm using addAuthenticator(Authenticator)
.
Authorization is performed through Authorizer
interface, and delegated to concrete Authorizer
instances which must be registered in realm using addAuthorizer(Authorizer)
.
Supports AuthenticationToken.AuthenticationTokenResolver
registration to perform authentication requests translation into
AuthenticationToken
s.
Extends Authenticator.MessageAuthenticator
to support authentication using generic authentication request Message
.
Extends Authentication.AuthenticationNotifier
to allow Authentication.AuthenticationListener
registration.
Authenticator.MessageAuthenticator
,
Authentication.AuthenticationNotifier
Modifier and Type | Interface and Description |
---|---|
static interface |
Realm.Builder
Builder to create
Realm instances. |
Authenticator.MessageAuthenticator
Modifier and Type | Field and Description |
---|---|
static String |
CONTEXT_KEY
Default
Context resource reference |
Modifier and Type | Method and Description |
---|---|
<T extends AuthenticationToken> |
addAuthenticator(Authenticator<T> authenticator)
Add a concrete
Authenticator for a specific AuthenticationToken type to this Realm |
<P extends Permission> |
addAuthorizer(Authorizer<P> authorizer)
Add and
Authorizer to support a specific Permission type |
static Realm.Builder |
builder()
Builder to create Realm instances
|
static Optional<Realm> |
getCurrent()
Convenience method to obtain the current
Realm made available as Context resource, using default
ClassLoader . |
Optional<String> |
getName()
Get optional realm name.
|
static Realm |
require()
Requires the current
Realm . |
boolean |
supportsPermission(Class<? extends Permission> permissionType)
Returns whether this Realm supports given
Permission type |
boolean |
supportsToken(Class<? extends AuthenticationToken> authenticationTokenType)
Returns whether this Realm supports given
AuthenticationToken type (i.e. and Authenticator bound
to given token type is registered in realm) |
authenticate, create, getTokenType
create, getPermissionType, isPermitted, isPermitted, isPermitted, isPermittedAny, isPermittedAny, isPermittedAny
addAuthenticationTokenResolver, authenticate, getResolversForMessageType, supportsMessage
addAuthenticationListener, removeAuthenticationListener
Optional<String> getName()
boolean supportsToken(Class<? extends AuthenticationToken> authenticationTokenType)
AuthenticationToken
type (i.e. and Authenticator
bound
to given token type is registered in realm)authenticationTokenType
- AuthenticationToken typetrue
if Realm supports given AuthenticationToken type<T extends AuthenticationToken> void addAuthenticator(Authenticator<T> authenticator)
Authenticator
for a specific AuthenticationToken
type to this RealmT
- Authentication token typeauthenticator
- Authenticator to addboolean supportsPermission(Class<? extends Permission> permissionType)
Permission
typepermissionType
- Permission typetrue
if this Realm supports given Permission type<P extends Permission> void addAuthorizer(Authorizer<P> authorizer)
Authorizer
to support a specific Permission
typeP
- Permission typeauthorizer
- Authorizer to addstatic Realm.Builder builder()
static Optional<Realm> getCurrent()
Realm
made available as Context
resource, using default
ClassLoader
.
See Context.resource(String, Class)
for details about context resources availability conditions.
static Realm require()
Realm
. If not available using getCurrent()
, an
IllegalStateException
is thrown.IllegalStateException
- Realm is not available as a Context
resourceCopyright © 2018 The Holon Platform. All rights reserved.