Introduction
Authlete supports “parameterized scopes” so that you can use a scope string with a dynamic value as a part of it. This article describes how to configure and use the feature.This feature is available since Authlete 2.2.
Configuring parameterized scopes
A parameterized scope can be defined by specifying a scope attribute for a static scope. The instructions are as follows.1. Open the scope attribute setting window. (See “Scope Attributes ” for detailed instructions) 2. Enter “regex” (a special value for parameterized scopes) in the “key” field of the scope attribute. 3. Enter a regular expression in the “value” field of the scope attribute. The expression must match a scope string that may include dynamic values. The example below specifies a regular expression “^consent:.+*$” for a static scope “consent” to configure Authlete to accept scope values that match the expression (e.g. “consent:urn:bancoex:C1DD33123”) as well as the static value “consent.”
Example of parameterized scopes
Authorization request
The following request/response example using curl shows how Authlete’s /auth/authorization API processes an authorization request that includes a dynamic value in its “scope” parameter.- Request
- Response
Introspection
You can check if an access token has specific “parameterized scopes” in the same way as the checking for static scopes. The following is an example of /auth/introspection API request/response using curl.- Request
- Response
Discovery Document
Only the scope name will be shown in a discovery document even if “parameterized scopes” feature is enabled. The following is an example of /service/configuration API response.See also
- DynamicScope class in authlete-java-common library