public final class Authorization extends Object
Modifier and Type | Method and Description |
---|---|
static void |
evaluateComponent(XdevComponent component,
Subject subject)
|
static void |
evaluateComponents(XdevComponent root)
Evaluates all
SubjectEvaluatingComponentExtension s in the
component hierarchy of root against the current user. |
static void |
evaluateComponents(XdevComponent root,
Subject subject)
Evaluates all
SubjectEvaluatingComponentExtension s in the
component hierarchy of root against the given
subject . |
static AuthorizationManager |
getAuthorizationManager()
Returns the
AuthorizationManager of the current user session. |
static Resource |
getResource(String name)
Searches for a specific resource in the current
AuthorizationManager . |
static Resource |
resource(String name)
Searches for a specific resource with
getResource(String) . |
static void |
setAuthorizationManager(AuthorizationManager authorizationManager)
Registers an
AuthorizationManager in the current user session. |
static void |
setSubjectEvaluatingComponentExtension(XdevComponent component,
SubjectEvaluatingComponentExtension extension)
Registers a
SubjectEvaluatingComponentExtension with
component . |
public static void setAuthorizationManager(AuthorizationManager authorizationManager)
AuthorizationManager
in the current user session.authorizationManager
- the AuthorizationManager
to registergetAuthorizationManager()
public static AuthorizationManager getAuthorizationManager()
AuthorizationManager
of the current user session.AuthorizationManager
setAuthorizationManager(AuthorizationManager)
public static Resource getResource(String name) throws IllegalStateException, IllegalArgumentException
AuthorizationManager
. If no resource is found an
IllegalArgumentException
is thrown.name
- the resource's name to search forIllegalStateException
- if no authorization manager has been initializedIllegalArgumentException
- if the resources couldn't be foundresource(String)
public static Resource resource(String name)
getResource(String)
. If no
resource with the specific name is present a new one will be created and
returned.name
- the resource's namegetResource(String)
public static void setSubjectEvaluatingComponentExtension(XdevComponent component, SubjectEvaluatingComponentExtension extension)
SubjectEvaluatingComponentExtension
with
component
.component
- the component to register the extension withextension
- the extension to registerevaluateComponents(XdevComponent)
public static void evaluateComponents(XdevComponent root)
SubjectEvaluatingComponentExtension
s in the
component hierarchy of root
against the current user.root
- the root componentAuthentication.isUserLoggedIn()
,
Authentication.login(Subject, Object)
,
Authentication.setUser(Subject, Object)
,
Authentication.getUser()
,
setSubjectEvaluatingComponentExtension(XdevComponent,
SubjectEvaluatingComponentExtension)
public static void evaluateComponents(XdevComponent root, Subject subject)
SubjectEvaluatingComponentExtension
s in the
component hierarchy of root
against the given
subject
.root
- the root componentsubject
- the subject to evaluate againstevaluateComponents(XdevComponent)
,
setSubjectEvaluatingComponentExtension(XdevComponent,
SubjectEvaluatingComponentExtension)
public static void evaluateComponent(XdevComponent component, Subject subject)
SubjectEvaluatingComponentExtension
of the
component
against the given subject
.
If no SubjectEvaluatingComponentExtension
has been registered
with the component
this method has no effect.
component
- the component to checksubject
- the subject to evaluate againstsetSubjectEvaluatingComponentExtension(XdevComponent,
SubjectEvaluatingComponentExtension)