Skip to content

Commit

Permalink
Merge pull request #31 from morinoparty/develop
Browse files Browse the repository at this point in the history
Add logger
  • Loading branch information
Nlkomaru authored Apr 28, 2024
2 parents e5765fa + d17e01e commit 3fa9bcf
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,22 @@ object TokenRouter: KoinComponent {
call.respond(HttpStatusCode.BadRequest, "Invalid code")
return@post
}
plugin.logger.info("Removing $code from authorizedData")
authorizedData.remove(code)

if (grantType == null || code == null || redirectUri == null || clientId == null || codeVerifier == null) {
plugin.logger.warning("Invalid request")
call.respond(HttpStatusCode.BadRequest, "Invalid request")
return@post
}
if (grantType != "authorization_code") {
plugin.logger.warning("Invalid grant_type is sent. Expected: authorization_code, Actual: $grantType")
call.respond(HttpStatusCode.BadRequest, "Invalid grant_type")
return@post
}

if (data.clientId != clientId || data.redirectUri != redirectUri) {
plugin.logger.warning("Invalid client_id or redirect_uri is sent. Expected: $clientId, $redirectUri, Actual: ${data.clientId}, ${data.redirectUri}")
call.respond(HttpStatusCode.BadRequest, "Invalid client_id or redirect_uri")
return@post
}
Expand Down

0 comments on commit 3fa9bcf

Please sign in to comment.