Skip to content

Commit e6d9a30

Browse files
committed
Remove forward basic auth and fix docs
Fixes #8
1 parent 7407b64 commit e6d9a30

File tree

3 files changed

+21
-35
lines changed

3 files changed

+21
-35
lines changed

README

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,19 @@ Example:
176176

177177
### GssapiBasicAuth
178178
Allows the use of Basic Auth in conjunction with Negotiate.
179-
Two modes are supported, direct usage of the received username and password
180-
to try to acquire credentials via GSSAPI, or forwarding to following apache
181-
module.
179+
If the browser fails to use Negotiate is will instead fallback to Basic and
180+
the username and password will be used to try to acquire credentials in the
181+
module via GSSAPI. If credentials are acquire successfully then they are
182+
validated agaist the server's keytab.
183+
184+
Enable with: GssapiBasicAuth On
185+
Default: GssapiBasicAuth Off
182186

183187
Example:
184-
GssapiBasicAuth Forward
188+
<Location /gssapi>
189+
AuthType GSSAPI
190+
AuthName "Login"
191+
GssapiBasicAuth On
192+
GssapiCredStore keytab:/etc/httpd/http.keytab
193+
Require valid-user
194+
</Location>

src/mod_auth_gssapi.c

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -255,26 +255,14 @@ static int mag_auth(request_rec *req)
255255
input.value = apr_pcalloc(req->pool, input.length);
256256
if (!input.value) goto done;
257257
input.length = apr_base64_decode(input.value, auth_header_value);
258-
} else if (strcasecmp(auth_header_type, "Basic") == 0) {
258+
} else if ((strcasecmp(auth_header_type, "Basic") == 0) &&
259+
(cfg->use_basic_auth == true)) {
259260
auth_type = "Basic";
260261
is_basic = true;
261262

262263
gss_buffer_desc ba_user;
263264
gss_buffer_desc ba_pwd;
264265

265-
switch (cfg->basic_auth) {
266-
case BA_ON:
267-
/* handle directly */
268-
break;
269-
case BA_FORWARD:
270-
/* decline to handle ourselves, let other modules do it */
271-
ret = DECLINED;
272-
goto done;
273-
case BA_OFF:
274-
goto done;
275-
default:
276-
goto done;
277-
}
278266
ba_pwd.value = ap_pbase64decode(req->pool, auth_header);
279267
if (!ba_pwd.value) goto done;
280268
ba_user.value = ap_getword_nulls_nc(req->pool,
@@ -483,7 +471,7 @@ static int mag_auth(request_rec *req)
483471
} else {
484472
apr_table_add(req->err_headers_out,
485473
"WWW-Authenticate", "Negotiate");
486-
if (cfg->basic_auth != BA_OFF) {
474+
if (cfg->use_basic_auth) {
487475
apr_table_add(req->err_headers_out,
488476
"WWW-Authenticate",
489477
apr_psprintf(req->pool, "Basic realm=\"%s\"",
@@ -674,19 +662,11 @@ static const char *mag_deleg_ccache_dir(cmd_parms *parms, void *mconfig,
674662
return NULL;
675663
}
676664

677-
static const char *mag_use_basic_auth(cmd_parms *parms, void *mconfig,
678-
const char *value)
665+
static const char *mag_use_basic_auth(cmd_parms *parms, void *mconfig, int on)
679666
{
680667
struct mag_config *cfg = (struct mag_config *)mconfig;
681668

682-
if (strcasecmp(value, "on") == 0) {
683-
cfg->basic_auth = BA_ON;
684-
} else if (strcasecmp(value, "forward") == 0) {
685-
cfg->basic_auth = BA_FORWARD;
686-
} else {
687-
cfg->basic_auth = BA_OFF;
688-
}
689-
669+
cfg->use_basic_auth = on ? true : false;
690670
return NULL;
691671
}
692672

@@ -712,7 +692,7 @@ static const command_rec mag_commands[] = {
712692
OR_AUTHCFG, "Directory to store delegated credentials"),
713693
#endif
714694
#ifdef HAVE_GSS_ACQUIRE_CRED_WITH_PASSWORD
715-
AP_INIT_TAKE1("GssapiBasicAuth", mag_use_basic_auth, NULL, OR_AUTHCFG,
695+
AP_INIT_FLAG("GssapiBasicAuth", mag_use_basic_auth, NULL, OR_AUTHCFG,
716696
"Allows use of Basic Auth for authentication"),
717697
#endif
718698
{ NULL }

src/mod_auth_gssapi.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,7 @@ struct mag_config {
4343
char *deleg_ccache_dir;
4444
gss_key_value_set_desc *cred_store;
4545
struct seal_key *mag_skey;
46-
enum {
47-
BA_OFF = 0,
48-
BA_FORWARD = 1,
49-
BA_ON = 2
50-
} basic_auth;
46+
bool use_basic_auth;
5147
};
5248

5349
struct mag_conn {

0 commit comments

Comments
 (0)