Skip to content

Commit 7147c1f

Browse files
committed
Update docs
1 parent 5198f16 commit 7147c1f

3 files changed

Lines changed: 118 additions & 5 deletions

File tree

docs/1-oidc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,4 @@ Upgrading? See the [upgrade guide](6-oidc-upgrade.md).
7777
- Conformance tests: [OpenID Conformance](5-oidc-conformance.md)
7878
- Upgrading between versions: [Upgrade guide](6-oidc-upgrade.md)
7979
- Common questions: [FAQ](7-oidc-faq.md)
80+
- API documentation: [API](8-api.md)

docs/api.md renamed to docs/8-api.md

Lines changed: 117 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ ModuleConfig::OPTION_API_TOKENS => [
3030
Scopes determine which endpoints are accessible by the API access token. The following scopes are available:
3131

3232
* `\SimpleSAML\Module\oidc\Codebooks\ApiScopesEnum::All`: Access to all endpoints.
33-
* `\SimpleSAML\Module\oidc\Codebooks\ApiScopesEnum::VciAll`: Access to all VCI-related endpoints
33+
* `\SimpleSAML\Module\oidc\Codebooks\ApiScopesEnum::VciAll`: Access to all VCI-related endpoints.
3434
* `\SimpleSAML\Module\oidc\Codebooks\ApiScopesEnum::VciCredentialOffer`: Access to credential offer endpoint.
35+
* `\SimpleSAML\Module\oidc\Codebooks\ApiScopesEnum::OAuth2All`: Access to all OAuth2-related endpoints.
36+
* `\SimpleSAML\Module\oidc\Codebooks\ApiScopesEnum::OAuth2TokenIntrospection`: Access to the OAuth2 token introspection endpoint.
3537

3638
## API Endpoints
3739

@@ -142,4 +144,117 @@ Response:
142144
{
143145
"credential_offer_uri": "openid-credential-offer://?credential_offer={\"credential_issuer\":\"https:\\/\\/idp.mivanci.incubator.hexaa.eu\",\"credential_configuration_ids\":[\"ResearchAndScholarshipCredentialDcSdJwt\"],\"grants\":{\"urn:ietf:params:oauth:grant-type:pre-authorized_code\":{\"pre-authorized_code\":\"_ffcdf6d86cd564c300346351dce0b4ccb2fde304e2\",\"tx_code\":{\"input_mode\":\"numeric\",\"length\":4,\"description\":\"Please provide the one-time code that was sent to e-mail testuser@example.com\"}}}}"
144146
}
145-
```
147+
```
148+
149+
### Token Introspection
150+
151+
Enables token introspection for OAuth2 access tokens and refresh tokens as per
152+
[RFC 7662](https://datatracker.ietf.org/doc/html/rfc7662).
153+
154+
#### Path
155+
156+
`/api/oauth2/token-introspection`
157+
158+
#### Method
159+
160+
`POST`
161+
162+
#### Authorization
163+
164+
Access is granted if:
165+
* The client is authenticated using one of the supported OAuth2 client
166+
authentication methods (Basic, Post, Private Key JWT, Bearer).
167+
* Or, if the request is authorized using an API Bearer Token with
168+
the appropriate scope.
169+
170+
#### Request
171+
172+
The request is sent with `application/x-www-form-urlencoded` encoding with the
173+
following parameters:
174+
175+
* __token__ (string, mandatory): The string value of the token.
176+
* __token_type_hint__ (string, optional): A hint about the type of the
177+
token submitted for introspection. Allowed values:
178+
* `access_token`
179+
* `refresh_token`
180+
181+
#### Response
182+
183+
The response is a JSON object with the following fields:
184+
185+
* __active__ (boolean, mandatory): Indicator of whether or not the presented
186+
token is currently active.
187+
* __scope__ (string, optional): A JSON string containing a space-separated
188+
list of scopes associated with this token.
189+
* __client_id__ (string, optional): Client identifier for the OAuth 2.0 client
190+
that requested this token.
191+
* __token_type__ (string, optional): Type of the token as defined in OAuth 2.0.
192+
* __exp__ (integer, optional): Expiration time.
193+
* __iat__ (integer, optional): Issued at time.
194+
* __nbf__ (integer, optional): Not before time.
195+
* __sub__ (string, optional): Subject identifier for the user who
196+
authorized the token.
197+
* __aud__ (string/array, optional): Audience for the token.
198+
* __iss__ (string, optional): Issuer of the token.
199+
* __jti__ (string, optional): Identifier for the token.
200+
201+
If the token is not active, only the `active` field with a value of
202+
`false` is returned.
203+
204+
#### Sample 1
205+
206+
Introspect an active access token using an API Bearer Token.
207+
208+
Request:
209+
210+
```shell
211+
curl --location 'https://idp.mivanci.incubator.hexaa.eu/ssp/module.php/oidc/api/oauth2/token-introspection' \
212+
--header 'Content-Type: application/x-www-form-urlencoded' \
213+
--header 'Authorization: Bearer ***' \
214+
--data-urlencode 'token=access-token-string'
215+
```
216+
217+
Response:
218+
219+
```json
220+
{
221+
"active": true,
222+
"scope": "openid profile email",
223+
"client_id": "test-client",
224+
"token_type": "Bearer",
225+
"exp": 1712662800,
226+
"iat": 1712659200,
227+
"sub": "user-id",
228+
"aud": "test-client",
229+
"iss": "https://idp.mivanci.incubator.hexaa.eu",
230+
"jti": "token-id"
231+
}
232+
```
233+
234+
#### Sample 2
235+
236+
Introspect a refresh token using an API Bearer Token.
237+
238+
Request:
239+
240+
```shell
241+
curl --location 'https://idp.mivanci.incubator.hexaa.eu/ssp/module.php/oidc/api/oauth2/token-introspection' \
242+
--header 'Content-Type: application/x-www-form-urlencoded' \
243+
--header 'Authorization: Bearer ***' \
244+
--data-urlencode 'token=refresh-token-string' \
245+
--data-urlencode 'token_type_hint=refresh_token'
246+
```
247+
248+
Response:
249+
250+
```json
251+
{
252+
"active": true,
253+
"scope": "openid profile",
254+
"client_id": "test-client",
255+
"exp": 1715251200,
256+
"sub": "user-id",
257+
"aud": "test-client",
258+
"jti": "refresh-token-id"
259+
}
260+
```

docs/index.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)