-
Notifications
You must be signed in to change notification settings - Fork 98
If the cookie is invalid, send an expired cookie value #63
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
Conversation
Yes, we're using mod_auth_cas in production for almost all of our Apache servers. |
Is this one good to go? Could someone please review? |
OK, upon further thought, I do have some suggestions here. It seems like this largely duplicates setCASCookie, but with the exception that it adds support for Expires and simply sets an empty value. It seems like the better approach would be to modify setCASCookie to accept an expiration timestamp and call that instead of duplicating the code. |
How's this? Seems to work fine for issuing new cookies and for when the server-side XML file is somehow corrupt (invalid XML, not present). |
I note I never replied publicly to the above committer comments. I have reached out to Marvin for guidance on current process for adding committers. Minimally, I understand an ICLA is required. Will let you know when I have something more definitive. |
Just forgot all about apr_time_t and the standard time_t too. All fixed up now, I think. Not sure about the style, and I couldn't get the tests to run on my setup for some reason (CentOS 6 x64) but I wrote a quick program separately and I think it'll come out correctly. |
Is there anything else to be changed with this? |
@@ -763,7 +764,24 @@ void setCASCookie(request_rec *r, char *cookieName, char *cookieValue, apr_byte_ | |||
if(c->CASRootProxiedAs.is_initialized) | |||
pathPrefix = urlEncode(r, c->CASRootProxiedAs.path, " "); | |||
|
|||
headerString = apr_psprintf(r->pool, "%s=%s%s;Path=%s%s%s%s%s", cookieName, cookieValue, (secure ? ";Secure" : ""), pathPrefix, urlEncode(r, getCASScope(r), " "), (c->CASCookieDomain != NULL ? ";Domain=" : ""), (c->CASCookieDomain != NULL ? c->CASCookieDomain : ""), (c->CASCookieHttpOnly != FALSE ? "; HttpOnly" : "")); | |||
if(-1 != expireTime) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe #define this as a constant, or declare a global "apr_time_t CAS_SESSION_EXPIRE_COOKIE_TIMEOUT = -1;" to improve readability?
I've got these changes made, but I still can't figure out why the tests won't run. What I'm running is: autoreconf
./configure --with-check --with-apxs=/usr/sbin/apxs
make check And what I'm getting is:
Any ideas what I'm missing? I'm not familiar with GNU autotools so I'm hoping there's some flag to CentOS 6 x64 |
I had the same issue -- it works if you remove the @APACHE_INCLUDES@ line (and the '' on the line before) from that makefile. Maybe @forsetti knows why it doesn't get converted to a path. |
@@ -1968,7 +1992,7 @@ int cas_authenticate(request_rec *r) | |||
if(cookieString == NULL) { /* they have not made a gateway trip yet */ | |||
if(c->CASDebug) | |||
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "Gateway initial access (%s)", r->parsed_uri.path); | |||
setCASCookie(r, d->CASGatewayCookie, "TRUE", ssl); | |||
setCASCookie(r, d->CASGatewayCookie, "TRUE", ssl, -1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should also be CAS_SESSION_EXPIRE_TIMEOUT right? (and below, in cas_authenticate)
LGTM modulo those last few nits (domainString, use of the #defined value). Also, there's 1 broken test (that isn't a hard fail()), but it's also broken in master so it's not your changes, I'll have to look into that later. |
Apropos APACHE_INCLUDES, that looks like a bad/copy paste job. It's supposed to be accompanied by a rule in configure.ac that replaces it with something that evaluates to |
Use apr_time_t instead of a pre-defined string Address comments for changes and fix up tests
OK, I think I got all the instances of '-1' and '0' being used as arguments to setCASCookie(), replaced '2048' with CAS_MAX_ERROR_SIZE, and the tests for expiring cookie strings works. |
{ | ||
char *headerString, *currentCookies, *pathPrefix = ""; | ||
char *headerString, *currentCookies, *pathPrefix = "", *expireTimeString = NULL, *errString; | ||
char *domainString = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not one line?
char *headerString, *currentCookies, *errString, *domainString = "", *pathPrefix = "", *expireTimeString = NULL;
Still LGTM, just bikeshedding at this point. |
Actually, given that APR_INCLUDES and APXS_INCLUDES are already listed, On Fri, Apr 4, 2014 at 11:27 AM, Ben Noordhuis [email protected]:
[email protected] |
… by Joel Goguen in apereo#63
If the cookie is invalid, send an expired cookie value
Remove extraneous APACHE_INCLUDES from tests/Makefile.am, as reported by Joel Goguen in apereo#63
If a user's browser has a mod_auth_cas cookie that is not mapped to a valid cache file, currently it redirects in a loop back to CAS and the application. This PR expires the cookie before sending the user back to CAS so they're forced to get a new mod_auth_cas cookie when they return.