summaryrefslogtreecommitdiff
path: root/module/mod_auth_singleid.c
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2010-02-11 04:01:12 +0000
committerStef Walter <stef@memberwebs.com>2010-02-11 04:01:12 +0000
commit3969967cfc767daf6e5f52b58e8dd7305443160d (patch)
tree9211599acd52419d6da4f267d35050e34e771ac3 /module/mod_auth_singleid.c
parentcec165f2c1850c8c2a8430969330ad5abe63a521 (diff)
Implement redirect after a successful authentication option.
Diffstat (limited to 'module/mod_auth_singleid.c')
-rw-r--r--module/mod_auth_singleid.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/module/mod_auth_singleid.c b/module/mod_auth_singleid.c
index 3559ddd..13770fd 100644
--- a/module/mod_auth_singleid.c
+++ b/module/mod_auth_singleid.c
@@ -107,6 +107,7 @@ typedef struct sid_context {
ap_regex_t *converter;
sid_storage_t *store;
sid_attribute_t *attributes;
+ int redirect_after;
} sid_context_t;
#define SID_AUTHTYPE "SingleID"
@@ -347,7 +348,8 @@ dir_config_creator (apr_pool_t* p, char* dir)
sid_context_t* ctx = apr_pcalloc (p, sizeof (*ctx));
memset (ctx, 0, sizeof (*ctx));
ctx->cookie_name = "mod-auth-singleid";
- return ctx;
+ ctx->redirect_after = 1;
+ return ctx;
}
static const char*
@@ -513,6 +515,14 @@ set_attribute (cmd_parms *cmd, void *config, const char *val)
return NULL;
}
+static const char*
+set_redirect (cmd_parms *cmd, void *config, int val)
+{
+ sid_context_t *ctx = config;
+ ctx->redirect_after = val;
+ return NULL;
+}
+
static const command_rec command_table[] = {
AP_INIT_TAKE1 ("SingleIdProvider", set_identifier, NULL, OR_AUTHCFG,
"The OpenID identifier we should perform identifier selection on when authenticating" ),
@@ -526,6 +536,8 @@ static const command_rec command_table[] = {
"How to convert an OpenID identifier into a user name" ),
AP_INIT_RAW_ARGS ("SingleIdAttribute", set_attribute, NULL, OR_AUTHCFG,
"Specify an attribute exchange url and alias."),
+ AP_INIT_FLAG ("SingleIdRedirect", set_redirect, NULL, OR_AUTHCFG,
+ "Redirect after authentication for a clean bookmarkable URL."),
{ NULL }
};
@@ -1141,8 +1153,11 @@ hook_authenticate (request_rec* r)
ap_set_module_config (r->request_config, &auth_singleid_module, sess);
/* If we actually authenticated the user, then set the cookie */
- if (authenticated)
+ if (authenticated) {
session_send_info (ctx, r, sess);
+ if (ctx->redirect_after)
+ sid_consumer_redirect_after (&req);
+ }
}
/* If any output, send it */