Skip to content

Require cas-attribute not work for rewrited url #214

Description

@chrislywhkust

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)) {

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions