Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Intersect.Server/Web/RestApi/Routes/OAuthController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Intersect.Server.Web.Http;
using Intersect.Server.Web.RestApi.Types;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Options;
using Microsoft.IdentityModel.Tokens;
using Newtonsoft.Json;
Expand Down Expand Up @@ -197,6 +198,8 @@ public class TokenRequestRefreshTokenGrant : TokenRequest
}

[HttpPost("token")]
[EndpointSummary("Request an Access Token")]
[EndpointDescription("Request an access token (and a refresh token) with a `password` grant, or a `refresh_token` grant.")]
[Consumes(typeof(TokenRequest), ContentTypes.Json)]
[ProducesResponseType<TokenResponse>((int)HttpStatusCode.OK, ContentTypes.Json)]
[ProducesResponseType<StatusMessageResponseBody>((int)HttpStatusCode.BadRequest, ContentTypes.Json)]
Expand Down Expand Up @@ -300,7 +303,10 @@ private async Task<IActionResult> RequestTokenFrom(TokenRequestRefreshTokenGrant
};
}

[Authorize]
[HttpDelete("tokens/{tokenId:guid}")]
[EndpointSummary("Delete a Refresh Token by ID")]
[EndpointDescription("Delete the Refresh Token specified by the tokenId parameter.")]
[ProducesResponseType<UsernameAndTokenResponse>((int)HttpStatusCode.OK, ContentTypes.Json)]
[ProducesResponseType<StatusMessageResponseBody>((int)HttpStatusCode.Forbidden, ContentTypes.Json)]
[ProducesResponseType<StatusMessageResponseBody>((int)HttpStatusCode.InternalServerError, ContentTypes.Json)]
Expand Down Expand Up @@ -349,6 +355,8 @@ public async Task<IActionResult> DeleteTokenById(Guid tokenId)

[Authorize]
[HttpDelete("tokens/{username}")]
[EndpointSummary("Delete all Refresh Tokens for a User")]
[EndpointDescription("Delete all refresh tokens for the user specified by the username parameter.")]
[ProducesResponseType<UsernameAndTokenResponse>((int)HttpStatusCode.OK, ContentTypes.Json)]
[ProducesResponseType<StatusMessageResponseBody>((int)HttpStatusCode.Forbidden, ContentTypes.Json)]
[ProducesResponseType<StatusMessageResponseBody>((int)HttpStatusCode.Gone, ContentTypes.Json)]
Expand Down Expand Up @@ -408,7 +416,10 @@ public async Task<IActionResult> DeleteTokensForUsername(string username, Cancel
return InternalServerError("Failed to delete token");
}

[Authorize]
[HttpDelete("tokens/{username}/{tokenId:guid}")]
[EndpointSummary("Delete a Refresh Token by ID for a User")]
[EndpointDescription("Delete the Refresh Token specified by the tokenId parameter for the user specified by the username parameter.")]
[ProducesResponseType<UsernameAndTokenResponse>((int)HttpStatusCode.OK, ContentTypes.Json)]
[ProducesResponseType<StatusMessageResponseBody>((int)HttpStatusCode.Forbidden, ContentTypes.Json)]
[ProducesResponseType<StatusMessageResponseBody>((int)HttpStatusCode.InternalServerError, ContentTypes.Json)]
Expand Down
Loading