Package org.trellisldp.webac
Class WebAcService
- java.lang.Object
-
- org.trellisldp.webac.WebAcService
-
@ApplicationScoped public class WebAcService extends Object
A WebAc implementation, based on the rules defined by SOLID.- See Also:
- SOLID Web Access Control
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WebAcService.NoopAuthorizationCache
static interface
WebAcService.TrellisAuthorizationCache
ACacheService
that can be used for authorization information.
-
Field Summary
Fields Modifier and Type Field Description static String
CONFIG_WEBAC_DEFAULT_ACL_LOCATION
The configuration key controlling the classpath location of the default root acl.static String
CONFIG_WEBAC_INITIALIZE_ROOT_ACL
The configuration key controlling whether the root ACL is initialized.static String
CONFIG_WEBAC_MEMBERSHIP_CHECK
The configuration key controlling whether to check member resources at the AuthZ enforcement point.static String
DEFAULT_ACL_LOCATION
The default classpath location of the default root acl.
-
Constructor Summary
Constructors Constructor Description WebAcService()
Create a WebAC-based authorization service.WebAcService(ResourceService resourceService, CacheService<String,AuthorizedModes> cache)
Create a WebAC-based authorization service.WebAcService(ResourceService resourceService, CacheService<String,AuthorizedModes> cache, boolean checkMembershipResources, String defaultAuthResourceLocation)
Create a WebAC-based authorization service.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
generateCacheKey(IRI identifier, IRI agent)
Generate a key suitable for cache lookups for the given arguments.Set<IRI>
getAccessModes(IRI identifier, Session session)
Get the allowable access modes for the given session to the specified resource.AuthorizedModes
getAuthorizedModes(IRI identifier, Session session)
Get the authorized modes for the resources.void
initialize()
Initializes the root ACL, if there is no root ACL.
-
-
-
Field Detail
-
CONFIG_WEBAC_MEMBERSHIP_CHECK
public static final String CONFIG_WEBAC_MEMBERSHIP_CHECK
The configuration key controlling whether to check member resources at the AuthZ enforcement point.- See Also:
- Constant Field Values
-
CONFIG_WEBAC_DEFAULT_ACL_LOCATION
public static final String CONFIG_WEBAC_DEFAULT_ACL_LOCATION
The configuration key controlling the classpath location of the default root acl.- See Also:
- Constant Field Values
-
CONFIG_WEBAC_INITIALIZE_ROOT_ACL
public static final String CONFIG_WEBAC_INITIALIZE_ROOT_ACL
The configuration key controlling whether the root ACL is initialized.- See Also:
- Constant Field Values
-
DEFAULT_ACL_LOCATION
public static final String DEFAULT_ACL_LOCATION
The default classpath location of the default root acl.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
WebAcService
public WebAcService()
Create a WebAC-based authorization service.
-
WebAcService
@Inject public WebAcService(ResourceService resourceService, @TrellisAuthorizationCache CacheService<String,AuthorizedModes> cache)
Create a WebAC-based authorization service.- Parameters:
resourceService
- the trellis service bundlercache
- a cache
-
WebAcService
public WebAcService(ResourceService resourceService, CacheService<String,AuthorizedModes> cache, boolean checkMembershipResources, String defaultAuthResourceLocation)
Create a WebAC-based authorization service.- Parameters:
resourceService
- the resource servicecache
- a cachecheckMembershipResources
- whether to check membership resource permissions (default=false)defaultAuthResourceLocation
- a classpath location of a default root ACL (in Turtle)
-
-
Method Detail
-
initialize
@PostConstruct public void initialize()
Initializes the root ACL, if there is no root ACL.
-
getAccessModes
public Set<IRI> getAccessModes(IRI identifier, Session session)
Get the allowable access modes for the given session to the specified resource.- Parameters:
identifier
- the resource identifiersession
- the agent's session- Returns:
- a set of allowable access modes
-
getAuthorizedModes
public AuthorizedModes getAuthorizedModes(IRI identifier, Session session)
Get the authorized modes for the resources.- Parameters:
identifier
- the resource identifiersession
- the agent's session- Returns:
- the authorized modes
-
-