Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$session_secret error #1

Closed
cyf992002 opened this issue Jun 26, 2017 · 5 comments
Closed

$session_secret error #1

cyf992002 opened this issue Jun 26, 2017 · 5 comments

Comments

@cyf992002
Copy link

Hello,
I am using this plugin to work with keycloak and get following error every time I send a request to the server. Please help.
2017/06/26 22:15:51 [error] 1014#0: *3793 lua entry thread aborted: runtime error: /usr/local/share/lua/5.1/kong/plugins/oidc/session.lua:11: variable "session_secret" not found for writing; maybe it is a built-in variable that is not changeable or you forgot to use "set $session_secret '';" in the config file to define it first?G?
stack traceback:
coroutine 0:
[C]: in function '__newindex'
/usr/local/share/lua/5.1/kong/plugins/oidc/session.lua:11: in function 'configure'
/usr/local/share/lua/5.1/kong/plugins/oidc/handler.lua:27: in function 'access'
/usr/local/share/lua/5.1/kong.lua:295: in function 'access'
access_by_lua(nginx-kong.conf:85):2: in function <access_by_lua(nginx-kong.conf:85):1>, client: 127.0.0.1, server: kong, request: "GET /services/v2/Product HTTP/1.1", host: "127.0.0.1:8000"

@cyf992002
Copy link
Author

cyf992002 commented Jun 27, 2017 via email

@cyf992002
Copy link
Author

here comes the config
image

@tsyrjanen
Copy link
Collaborator

Hi, sorry that I deleted my question.
But it is good that you gave your config because I noticed that we have a bug (there should be no default value, and we have "no").

We have added session_secret because of this
zmartzone/lua-resty-openidc#39

We should correct this (remove default value) and give instructions how to set session_secret (you need also something in ngix configuration).

@cyf992002
Copy link
Author

cyf992002 commented Jun 27, 2017

Could you please tell what Nginx config should I do? and how to set the session secret? Thanks for your help

@tsyrjanen
Copy link
Collaborator

tsyrjanen commented Jun 28, 2017

In nginx conf-file we have added under

server {
server_name kong;

following line

set_decode_base64 $session_secret 'XX';

In XX we use some decoded default value which kong-oidc will later change.

When enabling oidc plugin you could give also session_secret, for example

curl -i -X POST --url http://localhost:8001/plugins/
--data 'name=<plugin_name>'
--data "config.client_id=<client_name_in_oidc_provider>"
--data "config.client_secret=<client_secret_in_oidc_provider>"
--data "config.discovery=https://<oidc_provider_hostname>/auth/realms/<realm_name>/.well-known/openid-configuration"
--data "config.session_secret=<base64_encoded password>"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants