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
AContainerRequestFilterthat implements WebAC-based authorization.- See Also:
- SOLID WebACL Specification
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONFIG_WEBAC_APPENDABLE_METHODSThe configuration key controlling with HTTP methods should apply to the acl:Append.static StringCONFIG_WEBAC_CHALLENGESThe configuration key controlling which WWW-Authenticate challenges are provided on 401 errors.static StringCONFIG_WEBAC_ENABEDThe configuration key controlling if WebAC checks are enabled or not.static StringCONFIG_WEBAC_READABLE_METHODSThe configuration key controlling with HTTP methods should apply to the acl:Read.static StringCONFIG_WEBAC_REALMThe configuration key controlling the realm used in a WWW-Authenticate header, or 'trellis' by default.static StringCONFIG_WEBAC_SCOPEThe configuration key controlling the scope(s) used in a WWW-Authenticate header.static StringCONFIG_WEBAC_WRITABLE_METHODSThe configuration key controlling with HTTP methods should apply to the acl:Write.static StringSESSION_WEBAC_MODESThe 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 voidfilter(ContainerRequestContext ctx)voidfilter(ContainerRequestContext req, ContainerResponseContext res)voidsetAccessService(WebAcService accessService)Set the access service.voidsetBaseUrl(String baseUrl)Set the base URL.voidsetChallenges(List<String> challenges)Set the challenges.voidsetResourceService(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:
filterin interfaceContainerRequestFilter
-
filter
public void filter(ContainerRequestContext req, ContainerResponseContext res)
- Specified by:
filterin interfaceContainerResponseFilter
-
-