<?xml version="1.0" encoding="UTF-8"?>
<regex-rbac xmlns="http://docs.openrepose.org/repose/regex-rbac/v1.0">
    <resources> (1)
       /path/[^/]+/.* GET admin (2)
    </resources>
</regex-rbac>
The RegEx Role Based Access Control (RBAC) filter provides a way to get API validation for services without the constraints of a WADL.
The Role-Based Access Control (RBAC) is achieved using a request header populated by an authentication filter.
Name: regex-rbac
Default Configuration: regex-rbac.cfg.xml
Released: v8.7.3.0
Bundle: repose-filter-bundle
X-Roles - A header containing the roles belonging to the user making the request.
| This header is not configurable. | 
This filter has no dependencies on other filters and can be placed wherever it is needed in the filter chain.
However, due to the nature of this filter, it is typically placed early in the filter chain immediately after any authentication filters (e.g., Keystone v2 Filter).
X-Relevant-Roles - Lists the user roles from the X-Roles header which matched allowing access to the requested resource.
This header will contain ANY and/or ALL if a match allowing access is a resource containing one of these wildcard roles.
X-Delegated - Provides details about the failure being delegated by this filter.
This is mainly intended for use by the Highly Efficient Record Processor (HERP) filter and Delegation Response Processor (DeRP) filter for internal delegation processing within Repose.
However, it can be exposed to the origin service under certain configurations.
| This header is only added if delegation is enabled. | 
This filter is not strictly required by any other filters.
| Status Code | Reasons | 
|---|---|
| 
 | A requested resource or method requires a specific  | 
| 
 | The filter determined that the URI is invalid.   When  | 
| 
 | The URI is valid, but the Method is not appropriate for the URI. | 
This configuration is a basic example that exhibits a common use-case.
<?xml version="1.0" encoding="UTF-8"?>
<regex-rbac xmlns="http://docs.openrepose.org/repose/regex-rbac/v1.0">
    <resources> (1)
       /path/[^/]+/.* GET admin (2)
    </resources>
</regex-rbac>| 1 | Defines the available resources locally in the config.
Resources are listed one per line in the <PATH> <METHODS> <ROLES>format.
That is, each line should present the path to the resource, any amount of whitespace, the methods available on the resource, a set of whitespace, and the roles which grant access to the resource.
If a resource is not listed, requests to that resource will be rejected. | 
| 2 | Defines a single resource at /path/{any-single-segment}/{anything}that can only be accessed with aGETand only if theX-Rolesheader has the requiredadminrole. | 
| The resources are defined using Java Regular Expressions. The requested resource endpoint must exactly match a RegEx to be considered a match. That is to say, there can not be any extra characters in the request, including or excluding trailing slashes, that are not accounted for in the RegEx. | 
| 
 | 
| Roles are allowed to have spaces in the names through the use of an embedded Non-Breaking Space (NBSP) (i.e., Unicode character:  | 
This configuration is a basic example that exhibits a common use-case.
<?xml version="1.0" encoding="UTF-8"?>
<regex-rbac xmlns="http://docs.openrepose.org/repose/regex-rbac/v1.0">
    <resources>
/path/[^/]+/this GET     role1,role2,role3,role4 (1)
/path/[^/]+/this put     role1,role2,role3       (2)
/path/[^/]+/this POST    role1,role2             (3)
/path/[^/]+/this DELETE  role1                   (4)
/path/[^/]+/that get,PUT ANY                     (5)
/Path/[^/]+    GET       admin,role1             (6)
/Path/[^/]+    GET       admin,role2             (6)
/Path/[^/]+/.* ALL       admin,role with space   (7)
    </resources>
</regex-rbac>| 1 | The resource at /path/{any-single-segment}/thiscan only be accessed with aGETif theX-Rolesheader has at least one of the required roles:role1,role2,role3, orrole4 | 
| 2 | The resource at /path/{any-single-segment}/thiscan only be accessed with aPUTif theX-Rolesheader has at least one of the required roles:role1,role2, orrole3 | 
| 3 | The resource at /path/{any-single-segment}/thiscan only be accessed with aPOSTif theX-Rolesheader has at least one of the required roles:role1orrole2 | 
| 4 | The resource at /path/{any-single-segment}/thiscan only be accessed with aDELETEif theX-Rolesheader has the required role:role1 | 
| 5 | The resource at /path/{any-single-segment}/thatcan only be accessed with aGETorPUT, but there is no required role that must be in theX-Rolesheader. | 
| 6 | The resource at /Path/{any-single-segment}can only be accessed with aGETand must either have theadminrole or bothrole1androle2in theX-Rolesheader. | 
| 7 | The resource at /Path/{any-single-segment}/{anything}can be accessed with any HTTP method, but must have eitheradminofrole with spacein theX-Rolesheader. | 
This configuration is a full example that uses every possible configuration item.
It does not, however, cover the resources format, as including resources both inline and via the href attribute will cause only the inline resources to be used.
<?xml version="1.0" encoding="UTF-8"?>
<regex-rbac xmlns="http://docs.openrepose.org/repose/regex-rbac/v1.0"
             mask-rax-roles-403="false" (1)
>
    <delegating (2)
        quality="0.3" (3)
        component-name="regex-rbac"/> (4)
    <resources href="/path/to/resources"/> (5)
</regex-rbac>| 1 | If set to true, instead of returning a FORBIDDEN (403) or a METHOD NOT ALLOWED (405), the response will be a NOT FOUND (404). Default: false | 
| 2 | Inclusion of this element prevents this filter from returning errors, and directs this filter to populate delegation headers instead. | 
| 3 | Specifies the quality of specific output headers.
When setting up a chain of delegating filters, the highest quality number will be the one that is eventually output. Default: 0.3 | 
| 4 | The component name used in the delegation header.
This is particularly useful when multiple instances of an API-Checker based filter are used in the same filter chain. Default: regex-rbac | 
| 5 | Specifies a location to an external file which contains the RegEx RBAC resources.
If the message element has a value and the hrefattribute is configured, the RegEx RBAC will use what is configured in the value.
If the file that thehrefattribute points to is modified, the RegEx RBAC will not reload the configuration.
So the new RBAC file should be placed in a new file name (e.g., Dated) and the regex-rbac.cfg.xml file updated to point to it in order to guarantee the changes are utilized. | 
In some cases (e.g., User Access Events), you may want to delegate the validation of a request down the chain to either another filter or to the origin service.
Delegation prevents the RegEx RBAC filter from failing the request by forwarding the request with the X-Delegated header that is set with a value which indicates how the filter would have failed if not in delegating mode.
To place the filter in delegating mode, add the delegating element to the filter configuration with a quality that determines the delegation priority.
The format for the X-Delegated header value is:
status_code={status-code}`component={filter-name}`message={failure message};q={delegating-quality}