|
12 | 12 | using Intersect.Server.Web.Http; |
13 | 13 | using Intersect.Server.Web.RestApi.Types; |
14 | 14 | using Microsoft.AspNetCore.Authorization; |
| 15 | +using Microsoft.AspNetCore.Http; |
15 | 16 | using Microsoft.Extensions.Options; |
16 | 17 | using Microsoft.IdentityModel.Tokens; |
17 | 18 | using Newtonsoft.Json; |
@@ -197,6 +198,8 @@ public class TokenRequestRefreshTokenGrant : TokenRequest |
197 | 198 | } |
198 | 199 |
|
199 | 200 | [HttpPost("token")] |
| 201 | + [EndpointSummary("Request an Access Token")] |
| 202 | + [EndpointDescription("Request an access token (and a refresh token) with a `password` grant, or a `refresh_token` grant.")] |
200 | 203 | [Consumes(typeof(TokenRequest), ContentTypes.Json)] |
201 | 204 | [ProducesResponseType<TokenResponse>((int)HttpStatusCode.OK, ContentTypes.Json)] |
202 | 205 | [ProducesResponseType<StatusMessageResponseBody>((int)HttpStatusCode.BadRequest, ContentTypes.Json)] |
@@ -300,7 +303,10 @@ private async Task<IActionResult> RequestTokenFrom(TokenRequestRefreshTokenGrant |
300 | 303 | }; |
301 | 304 | } |
302 | 305 |
|
| 306 | + [Authorize] |
303 | 307 | [HttpDelete("tokens/{tokenId:guid}")] |
| 308 | + [EndpointSummary("Delete a Refresh Token by ID")] |
| 309 | + [EndpointDescription("Delete the Refresh Token specified by the tokenId parameter.")] |
304 | 310 | [ProducesResponseType<UsernameAndTokenResponse>((int)HttpStatusCode.OK, ContentTypes.Json)] |
305 | 311 | [ProducesResponseType<StatusMessageResponseBody>((int)HttpStatusCode.Forbidden, ContentTypes.Json)] |
306 | 312 | [ProducesResponseType<StatusMessageResponseBody>((int)HttpStatusCode.InternalServerError, ContentTypes.Json)] |
@@ -349,6 +355,8 @@ public async Task<IActionResult> DeleteTokenById(Guid tokenId) |
349 | 355 |
|
350 | 356 | [Authorize] |
351 | 357 | [HttpDelete("tokens/{username}")] |
| 358 | + [EndpointSummary("Delete all Refresh Tokens for a User")] |
| 359 | + [EndpointDescription("Delete all refresh tokens for the user specified by the username parameter.")] |
352 | 360 | [ProducesResponseType<UsernameAndTokenResponse>((int)HttpStatusCode.OK, ContentTypes.Json)] |
353 | 361 | [ProducesResponseType<StatusMessageResponseBody>((int)HttpStatusCode.Forbidden, ContentTypes.Json)] |
354 | 362 | [ProducesResponseType<StatusMessageResponseBody>((int)HttpStatusCode.Gone, ContentTypes.Json)] |
@@ -408,7 +416,10 @@ public async Task<IActionResult> DeleteTokensForUsername(string username, Cancel |
408 | 416 | return InternalServerError("Failed to delete token"); |
409 | 417 | } |
410 | 418 |
|
| 419 | + [Authorize] |
411 | 420 | [HttpDelete("tokens/{username}/{tokenId:guid}")] |
| 421 | + [EndpointSummary("Delete a Refresh Token by ID for a User")] |
| 422 | + [EndpointDescription("Delete the Refresh Token specified by the tokenId parameter for the user specified by the username parameter.")] |
412 | 423 | [ProducesResponseType<UsernameAndTokenResponse>((int)HttpStatusCode.OK, ContentTypes.Json)] |
413 | 424 | [ProducesResponseType<StatusMessageResponseBody>((int)HttpStatusCode.Forbidden, ContentTypes.Json)] |
414 | 425 | [ProducesResponseType<StatusMessageResponseBody>((int)HttpStatusCode.InternalServerError, ContentTypes.Json)] |
|
0 commit comments