Software Quality assurance
complex = {}
function complex.config()
return {
redirect_uri = "https://app.example.com/redirect",
discovery = "https://drupal.example.com/.well-known/openid-configuration",
client_id = "Publicly-Visible-Client-ID",
client_secret = "Super-Secret-Client-Secret",
scope = "openid email profile",
refresh_session_interval = 300,
ssl_verify = "yes",
timeout = 300,
}
end
return complex
server {
...
location / {
access_by_lua_block {
local opts = require('/etc/openresty/lua/oidc/config/app').config()
local res, err = require("resty.openidc").authenticate(opts)
if err then
ngx.status = 500
ngx.say(err)
ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
end
ngx.req.set_header("X-USER", res.id_token.sub)
}
}
location ~ \.php$
access_by_lua_block {
local opts = require('/etc/openresty/lua/oidc/config/app').config()<
local res, err = require("resty.openidc").authenticate(opts, nil, "pass")
...
}
...
}