-
Notifications
You must be signed in to change notification settings - Fork 0
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
Keycloak implementation of SPI #5
Conversation
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.
Looks good, just some comments/suggestions
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.
mostly nits that we can follow up in the future
docs/configuring-gloo-gateway.md
Outdated
{ | ||
"sub": "s2ai3kk4j6vfun6po9747bi1g", | ||
"token_use": "access", | ||
"scope": "access/catstronauts-api tracks-rest-api", |
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.
access/tracks-rest-api
In Gloo Gateway, your RouteTable defines your API Product. Below is an example of such an API Product for the Tracks API: | ||
|
||
```yaml | ||
apiVersion: networking.gloo.solo.io/v2 |
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.
We should probably add a TODO here to update this to use the GGv2 API instead of the GME API
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.
Finally, we can apply the ExtAuthPolicy to our ApiProduct route(s) that performs JWT validation using the Cognito’s JSON Web Key Set (JWKS), which contains the public keys used to verify the validity of the token, and applies to OPA policy to perform Authorization checks: | ||
|
||
```yaml | ||
apiVersion: security.policy.gloo.solo.io/v2 |
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.
Same as above we should use route route options and the AuthConfig
API instead of ExtauthPolicy
Note: Due to updates being done in the schema, the Cognito implementation must be updated as well. Due to the scope of this issue and me (@inFocus7) going on PTO soon, it will likely not be updated as part of this PR.
Adds a second implementation of the SPI, this one for Keycloak.
Since Keycloak supports User Managed Access (UMA), this implementation represents API products as resources and authorisation to them is granted to clients via permissions. This allows a standardised approach to gaining access to these resources through UMA, which differs from the scope-based approach used by the Cognito implementation and therefore requires a different enforcement method (which is provided in the documentation).
It would still be possible to implement permissions via scopes if customers wished to, since they would own the ultimate implementation of the SPI, but the approach taken here shows an implementation aligned to UMA should that be preferred.
Tested with Keycloak 24.0.3.