-
Notifications
You must be signed in to change notification settings - Fork 791
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add jwt claim based access validator policy templates
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
.../distribution/resources/operation_policies/definitions/jwtClaimBasedAccessValidator_v1.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<property name="grantVerificationClaim" value = "{{grantVerificationClaim}}"/> | ||
<property name="grantVerificationClaimValue" value="{{grantVerificationClaimValue}}"/> | ||
<property name="shouldAllowValidation" value="{{shouldAllowValidation}}"/> | ||
<class name="{{claimBasedAccessGrantValidator}}"/> |
52 changes: 52 additions & 0 deletions
52
...ribution/resources/operation_policies/specifications/jwtClaimBasedAccessValidator_v1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"category": "Mediation", | ||
"name": "jwtClaimBasedAccessValidator", | ||
"version": "v1", | ||
"displayName": "JWT claim based access grant validator", | ||
"description": "This policy validates configured claim name and value in this policy with the claim name and value sent in the JWT access token to grant access to the API resource.", | ||
"applicableFlows": [ | ||
"request" | ||
], | ||
"supportedGateways": [ | ||
"Synapse" | ||
], | ||
"supportedApiTypes": [ | ||
"HTTP" | ||
], | ||
"policyAttributes": [ | ||
{ | ||
"name": "grantVerificationClaim", | ||
"displayName": "Access grant claim name", | ||
"description": "This should be the name the custom claim which is expected in the JWT access token", | ||
"validationRegex": "^[a-zA-Z_]+$", | ||
"type": "String", | ||
"defaultValue": "aut", | ||
"required": true | ||
}, | ||
{ | ||
"name": "grantVerificationClaimValue", | ||
"displayName": "Access grant claim value", | ||
"description": "This should be the alue of a custom claim which is expected in the JWT access token", | ||
"type": "String", | ||
"defaultValue": "APPLICATION", | ||
"required": true | ||
}, | ||
{ | ||
"name": "shouldAllowValidation", | ||
"displayName": "Allow claim based access grant validation", | ||
"description": "If ticked, the claim based access grant validation will be performed.", | ||
"type": "Boolean", | ||
"defaultValue": "true", | ||
"required": false | ||
}, | ||
{ | ||
"name": "claimBasedAccessGrantValidator", | ||
"displayName": "JWT claim based access grant validation mediator", | ||
"description": "Fully qualified class name for the validation implementation", | ||
"validationRegex": "^([a-zA-Z_$][a-zA-Z\\d_$.]*)$", | ||
"type": "String", | ||
"defaultValue": "org.wso2.carbon.apimgt.gateway.mediators.ClaimBasedResourceAccessValidationMediator", | ||
"required": true | ||
} | ||
] | ||
} |