Skip to content

Commit be62898

Browse files
committed
return 401 (Unauthorized) header when missing credentials in request
1 parent 8b51f3a commit be62898

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

oauth2-server-core/src/main/java/nl/myndocs/oauth2/CallRouter.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ class CallRouter(
160160
"token" -> routeAccessTokenRedirect(callContext, credentials)
161161
else -> throw InvalidGrantException("'grant_type' with value '$responseType' not allowed")
162162
}
163+
} catch (invalidIdentityException: InvalidIdentityException) {
164+
callContext.respondStatus(STATUS_UNAUTHORIZED)
165+
callContext.respondJson(invalidIdentityException.toMap())
166+
return RedirectRouterResponse(false)
163167
} catch (oauthException: OauthException) {
164168
callContext.respondStatus(STATUS_BAD_REQUEST)
165169
callContext.respondJson(oauthException.toMap())

0 commit comments

Comments
 (0)