Skip to content

Commit 481aabe

Browse files
committed
release 3.2.2: depend on liboauth2 1.4.2.1
- with fixed iat slack validation defaults - set WWW-Authenticate environment variable to allow for complex Require logic; see OpenIDC/mod_auth_openidc#572 Signed-off-by: Hans Zandbelt <hans.zandbelt@zmartzone.eu>
1 parent a2b2187 commit 481aabe

4 files changed

Lines changed: 28 additions & 6 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@
1717
/.settings/
1818
/.libs/
1919
/mod_oauth2.la
20+
/config.guess~
21+
/config.sub~
22+
/configure~

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
06/07/2021
2+
- depend on liboauth2 1.4.2.1 with fixed iat slack validation defaults
3+
- set WWW-Authenticate environment variable to allow for complex Require logic; see
4+
https://github.com/zmartzone/mod_auth_openidc/discussions/572
5+
- release 3.2.2
6+
17
02/01/2021
28
- depend on liboauth2 1.4.1 with support for RFC 8705 mTLS Client Certificate bound access tokens
39
- release 3.2.1

configure.ac

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
AC_INIT([mod_oauth2],[3.2.1],[hans.zandbelt@zmartzone.eu])
1+
AC_INIT([mod_oauth2],[3.2.2],[hans.zandbelt@zmartzone.eu])
22

33
AM_INIT_AUTOMAKE([foreign no-define subdir-objects])
44
AC_CONFIG_MACRO_DIRS([m4])
@@ -32,11 +32,11 @@ PKG_CHECK_MODULES(APR, [apr-1, apr-util-1])
3232
AC_SUBST(APR_CFLAGS)
3333
AC_SUBST(APR_LIBS)
3434

35-
PKG_CHECK_MODULES(OAUTH2, [liboauth2 >= 1.4.1])
35+
PKG_CHECK_MODULES(OAUTH2, [liboauth2 >= 1.4.2.1])
3636
AC_SUBST(OAUTH2_CFLAGS)
3737
AC_SUBST(OAUTH2_LIBS)
3838

39-
PKG_CHECK_MODULES(OAUTH2_APACHE, [liboauth2_apache >= 1.4.1])
39+
PKG_CHECK_MODULES(OAUTH2_APACHE, [liboauth2_apache >= 1.4.2.1])
4040
AC_SUBST(OAUTH2_APACHE_CFLAGS)
4141
AC_SUBST(OAUTH2_APACHE_LIBS)
4242

src/mod_oauth2.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ static int oauth2_check_user_id_handler(request_rec *r)
192192
return DECLINED;
193193
}
194194

195+
#define OAUTH2_BEARER_SCOPE_ERROR "OAUTH2_BEARER_SCOPE_ERROR"
196+
195197
static authz_status
196198
oauth2_authz_checker(request_rec *r, const char *require_args,
197199
const void *parsed_require_args,
@@ -201,6 +203,7 @@ oauth2_authz_checker(request_rec *r, const char *require_args,
201203
oauth2_cfg_dir_t *cfg = NULL;
202204
oauth2_apache_request_ctx_t *ctx = NULL;
203205
authz_status rc = AUTHZ_DENIED_NO_USER;
206+
const char *value = NULL;
204207

205208
cfg = ap_get_module_config(r->per_dir_config, &oauth2_module);
206209
ctx = OAUTH2_APACHE_REQUEST_CTX(r, oauth2);
@@ -217,12 +220,22 @@ oauth2_authz_checker(request_rec *r, const char *require_args,
217220
if (claims)
218221
json_decref(claims);
219222

220-
if ((rc == AUTHZ_DENIED) && ap_auth_type(r))
223+
if ((rc == AUTHZ_DENIED) && ap_auth_type(r)) {
221224
oauth2_apache_return_www_authenticate(
222225
cfg->source_token, ctx, HTTP_UNAUTHORIZED,
223-
"insufficient_scope", // TODO:
224-
// OAUTH2_ERROR_INSUFFICIENT_SCOPE,
226+
OAUTH2_ERROR_INSUFFICIENT_SCOPE,
225227
"Different scope(s) or other claims required.");
228+
value = apr_table_get(r->err_headers_out,
229+
OAUTH2_HTTP_HDR_WWW_AUTHENTICATE);
230+
apr_table_unset(r->err_headers_out,
231+
OAUTH2_HTTP_HDR_WWW_AUTHENTICATE);
232+
oauth2_debug(ctx->log,
233+
"setting environment variable %s to \"%s\" for "
234+
"usage in mod_headers",
235+
OAUTH2_BEARER_SCOPE_ERROR, value);
236+
apr_table_set(r->subprocess_env, OAUTH2_BEARER_SCOPE_ERROR,
237+
value);
238+
}
226239

227240
oauth2_debug(ctx->log, "leave");
228241

0 commit comments

Comments
 (0)