Package org.trellisldp.webac
Class WebAcFilter
- java.lang.Object
-
- org.trellisldp.webac.WebAcFilter
-
- All Implemented Interfaces:
ContainerRequestFilter
,ContainerResponseFilter
@Provider @Priority(2000) public class WebAcFilter extends Object implements ContainerRequestFilter, ContainerResponseFilter
AContainerRequestFilter
that implements WebAC-based authorization.- See Also:
- SOLID WebACL Specification
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONFIG_WEBAC_APPENDABLE_METHODS
The configuration key controlling with HTTP methods should apply to the acl:Append.static String
CONFIG_WEBAC_CHALLENGES
The configuration key controlling which WWW-Authenticate challenges are provided on 401 errors.static String
CONFIG_WEBAC_ENABED
The configuration key controlling if WebAC checks are enabled or not.static String
CONFIG_WEBAC_READABLE_METHODS
The configuration key controlling with HTTP methods should apply to the acl:Read.static String
CONFIG_WEBAC_REALM
The configuration key controlling the realm used in a WWW-Authenticate header, or 'trellis' by default.static String
CONFIG_WEBAC_SCOPE
The configuration key controlling the scope(s) used in a WWW-Authenticate header.static String
CONFIG_WEBAC_WRITABLE_METHODS
The configuration key controlling with HTTP methods should apply to the acl:Write.static String
SESSION_WEBAC_MODES
The session value for storing access modes.
-
Constructor Summary
Constructors Constructor Description WebAcFilter()
Create a WebAC filter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
filter(ContainerRequestContext ctx)
void
filter(ContainerRequestContext req, ContainerResponseContext res)
void
setAccessService(WebAcService accessService)
Set the access service.void
setBaseUrl(String baseUrl)
Set the base URL.void
setChallenges(List<String> challenges)
Set the challenges.void
setResourceService(ResourceService resourceService)
Set the resource service.
-
-
-
Field Detail
-
CONFIG_WEBAC_CHALLENGES
public static final String CONFIG_WEBAC_CHALLENGES
The configuration key controlling which WWW-Authenticate challenges are provided on 401 errors.Multiple challenges should be separated with commas.
- See Also:
- Constant Field Values
-
CONFIG_WEBAC_READABLE_METHODS
public static final String CONFIG_WEBAC_READABLE_METHODS
The configuration key controlling with HTTP methods should apply to the acl:Read.Values defined here will be in addition to GET, HEAD and OPTIONS. Multiple methods should be separated with commas.
- See Also:
- Constant Field Values
-
CONFIG_WEBAC_WRITABLE_METHODS
public static final String CONFIG_WEBAC_WRITABLE_METHODS
The configuration key controlling with HTTP methods should apply to the acl:Write.Values defined here will be in addition to GET, HEAD and OPTIONS. Multiple methods should be separated with commas.
- See Also:
- Constant Field Values
-
CONFIG_WEBAC_APPENDABLE_METHODS
public static final String CONFIG_WEBAC_APPENDABLE_METHODS
The configuration key controlling with HTTP methods should apply to the acl:Append.Values defined here will be in addition to GET, HEAD and OPTIONS. Multiple methods should be separated with commas.
- See Also:
- Constant Field Values
-
CONFIG_WEBAC_REALM
public static final String CONFIG_WEBAC_REALM
The configuration key controlling the realm used in a WWW-Authenticate header, or 'trellis' by default.- See Also:
- Constant Field Values
-
CONFIG_WEBAC_SCOPE
public static final String CONFIG_WEBAC_SCOPE
The configuration key controlling the scope(s) used in a WWW-Authenticate header.- See Also:
- Constant Field Values
-
CONFIG_WEBAC_ENABED
public static final String CONFIG_WEBAC_ENABED
The configuration key controlling if WebAC checks are enabled or not. Its enabled by default.- See Also:
- Constant Field Values
-
SESSION_WEBAC_MODES
public static final String SESSION_WEBAC_MODES
The session value for storing access modes.- See Also:
- Constant Field Values
-
-
Method Detail
-
setAccessService
@Inject public void setAccessService(WebAcService accessService)
Set the access service.- Parameters:
accessService
- the access service
-
setResourceService
@Inject public void setResourceService(ResourceService resourceService)
Set the resource service.- Parameters:
resourceService
- the resource service
-
setChallenges
public void setChallenges(List<String> challenges)
Set the challenges.- Parameters:
challenges
- the response challenges
-
setBaseUrl
public void setBaseUrl(String baseUrl)
Set the base URL.- Parameters:
baseUrl
- the base URL
-
filter
@Timed public void filter(ContainerRequestContext ctx)
- Specified by:
filter
in interfaceContainerRequestFilter
-
filter
public void filter(ContainerRequestContext req, ContainerResponseContext res)
- Specified by:
filter
in interfaceContainerResponseFilter
-
-