Skip to content

Commit

Permalink
GH-451 Rename /api/auth endpoint to /api/auth/me
Browse files Browse the repository at this point in the history
  • Loading branch information
dzikoysk committed Aug 16, 2021
1 parent c74c828 commit 69ef2aa
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import io.javalin.openapi.OpenApiResponse
internal class AuthenticationEndpoint(private val authenticationFacade: AuthenticationFacade) : ReposiliteRoutes() {

@OpenApi(
path = "/api/auth",
path = "/api/auth/me",
methods = [HttpMethod.GET],
summary = "Get token details",
description = "Returns details about the requested token",
Expand All @@ -49,15 +49,14 @@ internal class AuthenticationEndpoint(private val authenticationFacade: Authenti
)
]
)
private val authInfo = ReposiliteRoute("/api/auth", GET) {
authenticationFacade.authenticateByHeader(ctx.headerMap())
private val authInfo = ReposiliteRoute("/api/auth/me", GET) {
response = authenticationFacade.authenticateByHeader(ctx.headerMap())
.map {
AuthenticationResponse(
it.alias,
it.permissions.map { permission -> permission.toString() }
)
}
.let { ctx.json(it.any) }
}

override val routes = setOf(authInfo)
Expand Down

0 comments on commit 69ef2aa

Please sign in to comment.