OpenID conformance test: Allow posting the access token in the body for userinfo endpoint
Some checks failed
Some checks failed
This commit is contained in:
@@ -603,15 +603,19 @@ class OidcController < ApplicationController
|
||||
# GET/POST /oauth/userinfo
|
||||
# OIDC Core spec: UserInfo endpoint MUST support GET, SHOULD support POST
|
||||
def userinfo
|
||||
# Extract access token from Authorization header
|
||||
auth_header = request.headers["Authorization"]
|
||||
unless auth_header&.start_with?("Bearer ")
|
||||
# Extract access token from Authorization header or POST body
|
||||
# RFC 6750: Bearer token can be in Authorization header, request body, or query string
|
||||
token = if request.headers["Authorization"]&.start_with?("Bearer ")
|
||||
request.headers["Authorization"].sub("Bearer ", "")
|
||||
elsif request.params["access_token"].present?
|
||||
request.params["access_token"]
|
||||
end
|
||||
|
||||
unless token
|
||||
head :unauthorized
|
||||
return
|
||||
end
|
||||
|
||||
token = auth_header.sub("Bearer ", "")
|
||||
|
||||
# Find and validate access token (opaque token with BCrypt hashing)
|
||||
access_token = OidcAccessToken.find_by_token(token)
|
||||
unless access_token&.active?
|
||||
|
||||
Reference in New Issue
Block a user