diff options
author | Stef Walter <stef@memberwebs.com> | 2010-02-12 19:53:15 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2010-02-12 19:53:15 +0000 |
commit | fcb94d7ab5660fb047507c7565f04759611272e1 (patch) | |
tree | 1334a0262ef2b557298bfe081f52e56874818ba8 /module | |
parent | 11ce918b62d0c881e94b67c08124e0f35a64a3cc (diff) |
Handle logout path ourselves, if it doesn't exist.
Diffstat (limited to 'module')
-rw-r--r-- | module/mod_auth_singleid.c | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/module/mod_auth_singleid.c b/module/mod_auth_singleid.c index e9e6a0a..4520009 100644 --- a/module/mod_auth_singleid.c +++ b/module/mod_auth_singleid.c @@ -1195,16 +1195,10 @@ hook_authenticate (request_rec* r) compare_paths ("/robots.txt", r->uri) == 0) return OK; - /* Should we logout? */ + /* The logout path is not authenticated.*/ if (compare_paths (ctx->logout_path, r->uri) == 0) { session_send_clear (ctx, r); - if (ctx->logout_dest) { - sid_request_respond_headers (&req, 302, "Found", - "Location", ctx->logout_dest, - "Cache-Control", "no-cache", - NULL); - } - return req.result; + return OK; } mainreq = r; @@ -1262,6 +1256,41 @@ hook_authenticate (request_rec* r) } static int +hook_handler (request_rec *r) +{ + sid_request_t req; + sid_context_t *ctx; + const char* authtype; + + /* Make sure it's for us */ + if (!(authtype = ap_auth_type (r)) || strcasecmp (SID_AUTHTYPE, authtype) != 0) + return DECLINED; + + ctx = (sid_context_t*)ap_get_module_config (r->per_dir_config, &auth_singleid_module); + if (ctx->identifier == NULL) + return DECLINED; + + /* Handle the logout redirect properly.*/ + if (compare_paths (ctx->logout_path, r->uri) == 0) { + if (ctx->logout_dest) { + + req.result = OK; + req.rec = r; + req.sess = NULL; + req.output = NULL; + + sid_request_respond_headers (&req, 302, "Found", + "Location", ctx->logout_dest, + "Cache-Control", "no-cache", + NULL); + return req.result; + } + } + + return DECLINED; +} + +static int hook_access(request_rec *r) { sid_context_t* ctx; @@ -1322,6 +1351,7 @@ static void register_hooks(apr_pool_t *p) { ap_hook_post_config (hook_initialize, NULL, NULL, APR_HOOK_MIDDLE); + ap_hook_handler (hook_handler, NULL, NULL, APR_HOOK_FIRST); ap_hook_child_init (hook_child, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_check_user_id (hook_authenticate, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_auth_checker (hook_access, NULL, NULL, APR_HOOK_MIDDLE); |