Skip to content

bug: plugin(openid-connect): when set use_jwks: true, userinfo is not set #8133

Description

@lovepocky

Current Behavior

When set use_jwks: true, the plugin not set userinfo into headers

local res, err = openidc.bearer_jwt_verify(conf)
if err then
-- Error while validating or token invalid.
ngx.header["WWW-Authenticate"] = 'Bearer realm="' .. conf.realm ..
'", error="invalid_token", error_description="' .. err .. '"'
return ngx.HTTP_UNAUTHORIZED, err, nil, nil
end
-- Token successfully validated.
local method = (conf.public_key and "public_key") or (conf.use_jwks and "jwks")
core.log.debug("token validate successfully by ", method)
return res, err, token, nil

maybe line 240 should be return res, err, token, res ?

Expected Behavior

userinfo set into headers as x-userinfo

Error Logs

No response

Steps to Reproduce

configs:

routes:
  - uri: 
    plugins:
      openid-connect:
        # https://github.com/apache/apisix/issues/5425
        client_id: xxx
        client_secret: xxx
        discovery: some_host/oidc/.well-known/openid-configuration
        use_jwks: true
        bearer_only: true
        access_token_in_authorization_header: true
        set_userinfo_header: true

Environment

  • APISIX version (docker: 2.15.0-alpine):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions