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

Require cas-attribute not work for rewrited url #214

Open
chrislywhkust opened this issue Mar 7, 2024 · 0 comments
Open

Require cas-attribute not work for rewrited url #214

chrislywhkust opened this issue Mar 7, 2024 · 0 comments

Comments

@chrislywhkust
Copy link

chrislywhkust commented Mar 7, 2024

require cas-attribute won't work for rewrite url

e.g.,

.htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]

It rewrite everything to index.php. If the directory is protected by require cas-attribute, Apache will deny the access.

The workaround is using SAMLValidate instead.

Following patch could help even not using SAMLValidate:

diff --git a/src/mod_auth_cas.c b/src/mod_auth_cas.c
index a3c5561..48bd846 100644
--- a/src/mod_auth_cas.c
+++ b/src/mod_auth_cas.c
@@ -2305,6 +2305,10 @@ int cas_authenticate(request_rec *r)
 				return HTTP_MOVED_TEMPORARILY;
 			}
 
+                        if(!isValidCASCookie(r, c, cookieString, &remoteUser, &attrs)) {
+                           remoteUser = NULL;
+                        }
+
 			if (c->CASDebug)
 				ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "recycling user '%s' from initial request for sub request", remoteUser);
 		} else if(!isValidCASCookie(r, c, cookieString, &remoteUser, &attrs)) {
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

1 participant