Skip to content

Support ready for keycloak jwt authentication? #159

@cdbattags

Description

@cdbattags

Hi folks!

So I've been following this tutorial:

https://eclipsesource.com/blogs/2018/01/11/authenticating-reverse-proxy-with-keycloak/

And I have an access_by_lua block of:

(EDITED)

local opts = {
  discovery = "https://auth-devci.poc.learning.amplify.com/auth/realms/Amplify/.well-known/openid-configuration",

  -- the signature algorithm that you expect has been used;
  -- can be a single string or a table.
  -- You should set this for security reasons in order to
  -- avoid accepting a token claiming to be signed by HMAC
  -- using a public RSA key.
  token_signing_alg_values_expected = { "HS256" },

  -- if you want to accept unsigned tokens (using the
  -- "none" signature algorithm) then set this to true.
  accept_none_alg = false,

  -- if you want to reject tokens signed using an algorithm
  -- not supported by lua-resty-jwt set this to false. If
  -- you leave it unset, the token signature will not be
  -- verified at all.
  accept_unsupported_alg = true
}

-- call bearer_jwt_verify for OAuth 2.0 JWT validation
local res, err = require("resty.openidc").bearer_jwt_verify(opts, nil, "pass")

 if err or not res then
  ngx.status = 403
  ngx.say(err and err or "no access_token provided")
  ngx.exit(ngx.HTTP_FORBIDDEN)
end

How could I get this working using cookie jwt validation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions