-
-
Notifications
You must be signed in to change notification settings - Fork 249
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
Problem with integration with keycloak #514
Comments
I have exactly the same error after i updated my Windows to Windows 11 Version 23H2. Before all worked perfectly. |
The most common case is the Cookie's |
Still not working. This is my Configuration: ` events { http { server {
} The strange thing is that it worked until yesterday, before i made the update of Widnows 11 |
Most likely your Windows update has given you a different Browser with changed (default) settings. The most reliable source for debugging the problem are the developer tools of your browser. Does you browser see the Cooke when lua-resty-openidc redirects your browser to your OIDC provider? Does it reject it for any reason? Does it send it back when returning? If not, does it tell you why not? If it does send back the Cookie, then SameSite is not the issue and the problem is a different one. |
Sending screenshots is not going to help, I'm afraid. You need to look at the individual requests (the last two in your screenshot) in your dev tools and see whether the cookies are present and if it is not present in the second to see why it is not included.This may or may not get logged to your browser's console. Please understand I'm trying to help you to help yourself here as the problem is with your setup. In order to rule out SameSite, you should set the value to None and verify this is what the Set-Cookie header says when redirecting to Keycloak. You may also want to check whether any kind of 3rd party cookie policy is present that would reject 3rd party cookies regardless of SameSite=None. |
I think it is a problem of keycloak |
Could there be a problem on the keyCloak server side? maybe there is a parameter that prevents cookies from being returned? |
This is not how Cookies work. Keycloak has no way to influence the cookies your browser sends to your relying party server. |
Where is then the place to search for this problem? |
I have same issue with another idp provider. I have added some logs in codes and I saw that cookies work fine. but still I get this error. |
You might have done what I just spent 5 hours troubleshooting.. lua-resty-session needs to be fixed at version 3.10 or lower. If you've pulled the latest by defult, these kinds of errors will pop up |
@lexiconzero |
That's right - pinning lua-resty-session to version 3.10 corrected this issue |
@lexiconzero lua entry thread aborted: runtime error: /usr/local/openresty/lualib/resty/openidc.lua:965: bad argument #1 to 'match' (string expected, got nil) |
Here's my code for the location I'm using in openresty. Ive also set a session secret above in the server block.
Here's how I load this into the podman container it runs in via a compose file
And the entrypoint file
|
Any news about that ? |
What is the issue and how can I help to resolve this ? |
Environment
Expected behaviour
I have the following openresty configuration:
##I added these dictionaries based on recommendations from previous threads on this issue
lua_shared_dict discovery 1m;
lua_shared_dict jwks 1m;
lua_shared_dict introspection 10m;
lua_shared_dict sessions 10m;
##For correct operation of ssl
lua_ssl_verify_depth 5;
lua_ssl_trusted_certificate /etc/ssl/certs/ca-certificates.pem;
server {
listen 443 ssl;
ssl_certificate /etc/ssl/certs/domain.crt;
ssl_certificate_key /etc/ssl/private/domain.key;
access_log /home/portal/logs/log.log;
error_log /home/portal/logs/log_error.log info;
resolver 8.8.8.8;
fastcgi_read_timeout 600;
client_header_timeout 30;
##I added these session secret based on recommendations from previous threads on this issue
set $session_secret 1234567890;
location / {
access_by_lua_block {
local opts = {
redirect_uri = "https://domain.com/callback",
discovery = "https://sso.domain.com/realms/ditust/.well-known/openid-configuration",
client_id = "test_app",
client_secret = "123123123132132132132132131323211",
ssl_verify = "no",
}
}
}
Steps to reproduce:
More details:
When I go to my site https://domain.com/
I get a redirect to keycloak.
After successful authentication, I receive a reverse redirect to my site with all the headers necessary for authentication, but it returns a 403 error.
This is due to the fact that the authenticate(opts) method could not return res and lua will throw a 403 error.
After my research, I found out that the problem is that openresty does not remember the session. the session.create() method, when used again, does not restore the previous session, but creates a new one.
This can also be observed from the error in the logs:
openidc.lua:1511: authenticate(): request to the redirect_uri path but there's no session state found
After researching a lot of articles, I think that this configuration should work correctly in this form
If you have any ideas or suggestions on how to help, I would be grateful
thank you in advance!
The text was updated successfully, but these errors were encountered: