Skip to content

Commit dec7fd3

Browse files
committed
3.4.0: support client credentials grant type
depend on liboauth >= 1.6.0 Signed-off-by: Hans Zandbelt <[email protected]>
1 parent 4c4c0f8 commit dec7fd3

File tree

6 files changed

+59
-10
lines changed

6 files changed

+59
-10
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
12/06/2023
2+
- add support for the client credentials grant type
3+
- depend on liboauth >= 1.6.0
4+
- release 3.4.0
5+
16
03/08/2023
27
- move repo to OpenIDC github organization
38

Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ lib_LTLIBRARIES = @[email protected]
2323
src/liboauth2-sts/src/sts.c \
2424
src/liboauth2-sts/src/wstrust.c \
2525
src/liboauth2-sts/src/ropc.c \
26+
src/liboauth2-sts/src/cc.c \
2627
src/liboauth2-sts/src/otx.c \
2728
2829
@PACKAGE_NAME@_la_LDFLAGS = -module

README.md

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ but can be configured/programmed to validate a token presented in the `password`
6868
OAuth 2.0 Resource Owner Password Credentials grant and return a target token in the `access token`
6969
claim of the token response.
7070

71+
##### OAuth 2.0 Client Credentials (CC)
72+
This leverages the [OAuth 2.0 Client Credentials](https://datatracker.ietf.org/doc/html/rfc6749#section-4.4) grant type
73+
but does not actually require a source token. Instead the configured client credentials are used as a bootstrapping
74+
mechanism to obtain an OAuth 2.0 access token that can be used to authenticate the service towards the backend.
75+
7176
## Quickstart
7277

7378
WS-Trust STS using HTTP Basic authentication.
@@ -83,8 +88,8 @@ value_type=urn:pingidentity.com:oauth2:grant_type:validate_bearer&\
8388
token_type=urn:bogus:token&\
8489
ssl_verify=false
8590
86-
ProxyPass http://echo:8080/headers
87-
ProxyPassReverse http://echo:8080/headers
91+
ProxyPass http://echo:8080
92+
ProxyPassReverse http://echo:8080
8893
</Location>
8994
```
9095

@@ -101,8 +106,28 @@ client_secret=2Federate&\
101106
username=dummy&\
102107
ssl_verify=false
103108
104-
ProxyPass http://echo:8080/headers
105-
ProxyPassReverse http://echo:8080/headers
109+
ProxyPass http://echo:8080
110+
ProxyPassReverse http://echo:8080
111+
</Location>
112+
```
113+
114+
OAuth 2.0 Client Credentials token retrieval using `client_secret_basic` authentication.
115+
116+
```apache
117+
LogLevel sts:debug
118+
119+
<Location /sts/cc>
120+
SetEnvIfExpr true dummy=dummy
121+
STSAcceptSourceTokenIn environment name=dummy
122+
STSPassTargetTokenIn header
123+
STSExchange cc https://keycloak:8443/realms/master/protocol/openid-connect/token \
124+
auth=client_secret_basic&\
125+
client_id=cc_client&\
126+
client_secret=mysecret&\
127+
ssl_verify=false
128+
129+
ProxyPass http://echo:8080
130+
ProxyPassReverse http://echo:8080
106131
</Location>
107132
```
108133

@@ -119,8 +144,8 @@ client_id=otxclient&\
119144
client_secret=2Federate&\
120145
ssl_verify=false
121146
122-
ProxyPass http://echo:8080/headers
123-
ProxyPassReverse http://echo:8080/headers
147+
ProxyPass http://echo:8080
148+
ProxyPassReverse http://echo:8080
124149
</Location>
125150
```
126151

configure.ac

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
AC_INIT([mod_sts],[3.3.0],[[email protected]])
1+
AC_INIT([mod_sts],[3.4.0],[[email protected]])
22

33
AM_INIT_AUTOMAKE([foreign no-define subdir-objects])
44
AC_CONFIG_MACRO_DIRS([m4])
@@ -27,11 +27,11 @@ AC_SUBST(APR_LIBS)
2727
AC_SUBST(APACHE_CFLAGS)
2828
AC_ARG_VAR(APXS_OPTS, [additional command line options to pass to apxs])
2929

30-
PKG_CHECK_MODULES(OAUTH2, [liboauth2 >= 1.4.5.2])
30+
PKG_CHECK_MODULES(OAUTH2, [liboauth2 >= 1.6.0])
3131
AC_SUBST(OAUTH2_CFLAGS)
3232
AC_SUBST(OAUTH2_LIBS)
3333

34-
PKG_CHECK_MODULES(OAUTH2_APACHE, [liboauth2_apache >= 1.4.5.2])
34+
PKG_CHECK_MODULES(OAUTH2_APACHE, [liboauth2_apache >= 1.6.0])
3535
AC_SUBST(OAUTH2_APACHE_CFLAGS)
3636
AC_SUBST(OAUTH2_APACHE_LIBS)
3737

sts.conf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# <type>=[ wstrust | ropc | otx | disabled ]
66
# wstrust : WS-Trust
77
# ropc : OAuth 2.0 Resource Owner Password Credentials grant
8+
# cc : OAuth 2.0 Client Credentials grant
89
# otx : OAuth 2.0 Token Exchange
910
# disabled : don't perform any attempt to exchange a token
1011
#
@@ -114,6 +115,23 @@
114115
# aud myresource
115116
# When not defined the default is not to add any additional parameters.
116117

118+
#
119+
# OAuth 2.0 Client Credentials token retrieval protocol settings
120+
# (<type>=cc)
121+
#
122+
# <endpoint>
123+
# Set the OAuth 2.0 Token endpoint.
124+
#
125+
# OAuth 2.0 Client Credentials Options:
126+
#
127+
# client_id=<string>
128+
# Set the client identifier value to be used in the client_id parameter towards the token endpoint
129+
# when no authentication has been configured.
130+
#
131+
# params=<form-encoded-request-parameters>
132+
# Set extra parameters added to the token request. Sample value(s) are:
133+
# scope=resource-set-basic
134+
# When not defined the default is not to add any additional parameters.
117135

118136
#
119137
# OAuth 2.0 Token Exchange protocol settings

0 commit comments

Comments
 (0)