Skip to content

Commit

Permalink
Merge pull request #67 from alanwilkie-finocomp/authz-extra-args
Browse files Browse the repository at this point in the history
Allow extra args to be provided to the OIDC auth endpoint
  • Loading branch information
route443 authored Dec 9, 2022
2 parents 62b5e04 + d001b8e commit 6ad8ec6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions openid_connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,10 @@ function getAuthZArgs(r) {
var nonceHash = h.digest('base64url');
var authZArgs = "?response_type=code&scope=" + r.variables.oidc_scopes + "&client_id=" + r.variables.oidc_client + "&redirect_uri="+ r.variables.redirect_base + r.variables.redir_location + "&nonce=" + nonceHash;

if (r.variables.oidc_authz_extra_args) {
authZArgs += "&" + r.variables.oidc_authz_extra_args;
}

r.headersOut['Set-Cookie'] = [
"auth_redir=" + r.variables.request_uri + "; " + r.variables.oidc_cookie_flags,
"auth_nonce=" + noncePlain + "; " + r.variables.oidc_cookie_flags
Expand Down
12 changes: 12 additions & 0 deletions openid_connect_configuration.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ map $host $oidc_authz_endpoint {
#www.example.com "https://my-idp/oauth2/v1/authorize";
}

map $host $oidc_authz_extra_args {
# Extra arguments to include in the request to the IdP's authorization
# endpoint.
# Some IdPs provide extended capabilities controlled by extra arguments,
# for example Keycloak can select an IdP to delegate to via the
# "kc_idp_hint" argument.
# Arguments must be expressed as query string parameters and URL-encoded
# if required.
default "";
#www.example.com "kc_idp_hint=another_provider"
}

map $host $oidc_token_endpoint {
default "http://127.0.0.1:8080/auth/realms/master/protocol/openid-connect/token";
}
Expand Down

0 comments on commit 6ad8ec6

Please sign in to comment.