datopian / ckanext-noanonaccess

Disable anonymous access to CKAN by redirecting users to login page.
GNU Affero General Public License v3.0
7 stars 7 forks source link

Gives Error When Used with ckanext-OAuth2 #1

Open dyaw-Drexel opened 4 years ago

dyaw-Drexel commented 4 years ago

I'm trying to use this in combination with ckanext-OAuth2. When used together, it results in the browser error "ERR_TOO_MANY_REDIRECTS". It's very important we have this working, can anyone help?

Here's the CKAN logs:

[Fri Mar 06 12:08:39.905166 2020] [wsgi:error] [pid 19678:tid 139753570793216] [remote 127.0.0.1:58690] 2020-03-06 12:08:39,905 WARNI [ckanext.oauth2.plugin] The user is not currently logged...
[Fri Mar 06 12:08:39.905769 2020] [wsgi:error] [pid 19678:tid 139753570793216] [remote 127.0.0.1:58690] 2020-03-06 12:08:39,905 DEBUG [ckanext.oauth2.controller] login
[Fri Mar 06 12:08:39.913056 2020] [wsgi:error] [pid 19678:tid 139753570793216] [remote 127.0.0.1:58690] 2020-03-06 12:08:39,912 DEBUG [ckanext.oauth2.oauth2] Challenge: Redirecting challenge to page http://52.184.198.163:8080/auth/realms/UHCID/protocol/openid-connect/auth?response_type=code&client_id=data.uhcdata.org&redirect_uri=https%3A%2F%2Fdata.uhcdata.org%2Foauth2%2Fcallback&scope=profile+openid+email&state=eyJjYW1lX2Zyb20iOiAiL2Rhc2hib2FyZCJ9
[Fri Mar 06 12:08:39.913682 2020] [wsgi:error] [pid 19678:tid 139753570793216] [remote 127.0.0.1:58690] 2020-03-06 12:08:39,913 INFO  [ckan.lib.base]  /user/login render time 0.018 seconds
[Fri Mar 06 12:08:40.310727 2020] [wsgi:error] [pid 19678:tid 139753688291072] [remote 127.0.0.1:58694] 2020-03-06 12:08:40,310 DEBUG [ckanext.oauth2.plugin] identify
[Fri Mar 06 12:08:40.310923 2020] [wsgi:error] [pid 19678:tid 139753688291072] [remote 127.0.0.1:58694] 2020-03-06 12:08:40,310 WARNI [ckanext.oauth2.plugin] The user is not currently logged...
[Fri Mar 06 12:08:40.311518 2020] [wsgi:error] [pid 19678:tid 139753688291072] [remote 127.0.0.1:58694] 2020-03-06 12:08:40,311 DEBUG [ckanext.oauth2.controller] login
[Fri Mar 06 12:08:40.318663 2020] [wsgi:error] [pid 19678:tid 139753688291072] [remote 127.0.0.1:58694] 2020-03-06 12:08:40,318 DEBUG [ckanext.oauth2.oauth2] Challenge: Redirecting challenge to page http://52.184.198.163:8080/auth/realms/UHCID/protocol/openid-connect/auth?response_type=code&client_id=data.uhcdata.org&redirect_uri=https%3A%2F%2Fdata.uhcdata.org%2Foauth2%2Fcallback&scope=profile+openid+email&state=eyJjYW1lX2Zyb20iOiAiL2Rhc2hib2FyZCJ9
[Fri Mar 06 12:08:40.319252 2020] [wsgi:error] [pid 19678:tid 139753688291072] [remote 127.0.0.1:58694] 2020-03-06 12:08:40,319 INFO  [ckan.lib.base]  /user/login render time 0.018 seconds
[Fri Mar 06 12:08:40.455036 2020] [wsgi:error] [pid 19678:tid 139753570793216] [remote 127.0.0.1:58698] 2020-03-06 12:08:40,454 DEBUG [ckanext.oauth2.plugin] identify
[Fri Mar 06 12:08:40.455258 2020] [wsgi:error] [pid 19678:tid 139753570793216] [remote 127.0.0.1:58698] 2020-03-06 12:08:40,455 WARNI [ckanext.oauth2.plugin] The user is not currently logged...
[Fri Mar 06 12:08:40.455792 2020] [wsgi:error] [pid 19678:tid 139753570793216] [remote 127.0.0.1:58698] 2020-03-06 12:08:40,455 DEBUG [ckanext.oauth2.controller] login
[Fri Mar 06 12:08:40.462754 2020] [wsgi:error] [pid 19678:tid 139753570793216] [remote 127.0.0.1:58698] 2020-03-06 12:08:40,462 DEBUG [ckanext.oauth2.oauth2] Challenge: Redirecting challenge to page http://52.184.198.163:8080/auth/realms/UHCID/protocol/openid-connect/auth?response_type=code&client_id=data.uhcdata.org&redirect_uri=https%3A%2F%2Fdata.uhcdata.org%2Foauth2%2Fcallback&scope=profile+openid+email&state=eyJjYW1lX2Zyb20iOiAiL2Rhc2hib2FyZCJ9
[Fri Mar 06 12:08:40.463360 2020] [wsgi:error] [pid 19678:tid 139753570793216] [remote 127.0.0.1:58698] 2020-03-06 12:08:40,463 INFO  [ckan.lib.base]  /user/login render time 0.011 seconds
[Fri Mar 06 12:08:40.613379 2020] [wsgi:error] [pid 19678:tid 139753688291072] [remote 127.0.0.1:58702] 2020-03-06 12:08:40,613 DEBUG [ckanext.oauth2.plugin] identify
[Fri Mar 06 12:08:40.613568 2020] [wsgi:error] [pid 19678:tid 139753688291072] [remote 127.0.0.1:58702] 2020-03-06 12:08:40,613 WARNI [ckanext.oauth2.plugin] The user is not currently logged...
[Fri Mar 06 12:08:40.614121 2020] [wsgi:error] [pid 19678:tid 139753688291072] [remote 127.0.0.1:58702] 2020-03-06 12:08:40,614 DEBUG [ckanext.oauth2.controller] login
[Fri Mar 06 12:08:40.620969 2020] [wsgi:error] [pid 19678:tid 139753688291072] [remote 127.0.0.1:58702] 2020-03-06 12:08:40,620 DEBUG [ckanext.oauth2.oauth2] Challenge: Redirecting challenge to page http://52.184.198.163:8080/auth/realms/UHCID/protocol/openid-connect/auth?response_type=code&client_id=data.uhcdata.org&redirect_uri=https%3A%2F%2Fdata.uhcdata.org%2Foauth2%2Fcallback&scope=profile+openid+email&state=eyJjYW1lX2Zyb20iOiAiL2Rhc2hib2FyZCJ9
[Fri Mar 06 12:08:40.621997 2020] [wsgi:error] [pid 19678:tid 139753688291072] [remote 127.0.0.1:58702] 2020-03-06 12:08:40,621 INFO  [ckan.lib.base]  /user/login render time 0.018 seconds
[Fri Mar 06 12:08:40.767503 2020] [wsgi:error] [pid 19678:tid 139753570793216] [remote 127.0.0.1:58706] 2020-03-06 12:08:40,767 DEBUG [ckanext.oauth2.plugin] identify
[Fri Mar 06 12:08:40.767700 2020] [wsgi:error] [pid 19678:tid 139753570793216] [remote 127.0.0.1:58706] 2020-03-06 12:08:40,767 WARNI [ckanext.oauth2.plugin] The user is not currently logged...
[Fri Mar 06 12:08:40.774726 2020] [wsgi:error] [pid 19678:tid 139753570793216] [remote 127.0.0.1:58706] 2020-03-06 12:08:40,774 DEBUG [ckanext.oauth2.controller] login
[Fri Mar 06 12:08:40.775315 2020] [wsgi:error] [pid 19678:tid 139753570793216] [remote 127.0.0.1:58706] 2020-03-06 12:08:40,775 DEBUG [ckanext.oauth2.oauth2] Challenge: Redirecting challenge to page http://52.184.198.163:8080/auth/realms/UHCID/protocol/openid-connect/auth?response_type=code&client_id=data.uhcdata.org&redirect_uri=https%3A%2F%2Fdata.uhcdata.org%2Foauth2%2Fcallback&scope=profile+openid+email&state=eyJjYW1lX2Zyb20iOiAiL2Rhc2hib2FyZCJ9
[Fri Mar 06 12:08:40.775856 2020] [wsgi:error] [pid 19678:tid 139753570793216] [remote 127.0.0.1:58706] 2020-03-06 12:08:40,775 INFO  [ckan.lib.base]  /user/login render time 0.017 seconds
anuveyatsu commented 3 years ago

Looks like you need to allow /auth/realms/UHCID/protocol/openid-connect/auth path somewhere in https://github.com/datopian/ckanext-noanonaccess/blob/master/ckanext/noanonaccess/plugin.py#L50 ... probably you want to allow anything that starts with /auth