-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #26168: Add OAuth2 Bearer token with client_credentials flow for Rudder API authentication #783
Conversation
07bdad8
to
24b8e03
Compare
PR updated with a new commit |
30e2ada
to
25b6ba6
Compare
PR updated with a new commit |
@@ -0,0 +1,42 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file is needed since the JWT
filter is a new rudder backend, and for now, they are looked-up by the existence of that file (which is a scare from another time).
PR updated with a new commit |
b52b52d
to
47d30f7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM !
The refactoring is nice !
A few questions and considerations but once they addressed it can be merged
auth-backends/src/main/scala/bootstrap/rudder/plugin/AuthBackendsConf.scala
Outdated
Show resolved
Hide resolved
auth-backends/src/main/scala/bootstrap/rudder/plugin/AuthBackendsConf.scala
Outdated
Show resolved
Hide resolved
auth-backends/src/main/scala/com/normation/plugins/authbackends/Oauth2Authentication.scala
Outdated
Show resolved
Hide resolved
auth-backends/src/main/scala/bootstrap/rudder/plugin/AuthBackendsConf.scala
Outdated
Show resolved
Hide resolved
auth-backends/src/main/scala/bootstrap/rudder/plugin/AuthBackendsConf.scala
Outdated
Show resolved
Hide resolved
5b139e4
to
ffadfef
Compare
PR updated with a new commit |
OK, squash merging this PR |
…r Rudder API authentication
a4df336
to
36ffebe
Compare
https://issues.rudder.io/issues/26168
Implements the possibility to use Rudder API with a JWT token.
From an arch point of view, we use spring-security. We add the corresponding filter in the API security chain if our rudder config has at least one
JWT
(oauth2api
) provider configured and enabled.The configuration file is simpler that for OIDC and use the same format with a "jwt" in place of "oauth2" in the first part of the path (see below for an example).
This fact lead me to (massively) refactor the config parsing part of the code, so that we are sure the common idioms are parsed similarly.
I also added
tenants
parsing here, since it's exactly the same than for roles. Here again, care was taken to make the parsing as similar as possible.The JWT filter is quite simple, and most of the logic goes into the converter that takes the authenticated token and convert it into
RudderUserDetails
.NOTE: for now, it seems that we can have only one JWT registration, since spring security doesn't seem able to manage several JWT key URL. So all client must be in the same domain.
Here again, there is a lot of simirality with OIDC, so again code was share when possible.
Config example for JWT: