-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
feature : OAuth Authorization plugin for Keycloak #1679
Comments
LGTM |
This looks like a subset of PEP. I fell little confused, what's the relationship of the |
Yes @chnliyong its the implementation of PEP to enforce policies for API calls. Keycloak only provides adapters for Java and JS. Keycloak provides the above API to check if you have permission to access a resource or not. In the official authorization adapter, you can define the scopes and paths for your resources and Keycloak internally makes these API calls to check if you have the permission to the required scope and resource. Also, in the Keycloak policy enforcer file, you can opt-out to not to define the paths. Then the adapters do a lazy loading to fetch the matching paths and resources dynamically. The following image shows a sample configuration of Keycloak JSON with matching paths, methods, and scopes: Therefore, as the first implementation, I propose to implement the authorization flow by having the definitions of what is the resource and scope needed to access a route, and future enhancements would support the lazy loading of paths and permissions. Please do have a look at the unit tests of the PR on how the authorization is enforced. The following is a reference from the Keycloak adapter on how it tries to find the relevant resources by trying to match the URI. |
Issue description
Keycloak is an Identity Server from RedHad based on OAuth/OIDC. Keycloak provides a very powerful policy engine for Authorization. It can support Roles based, Attribute-based, and Dynamic authorization strategies.
The following image shows how APISIX can be integrated with Keycloak Server.
The following is a proposed schema for the authz-keycloak plugin:
Policy enforcing mode
will reject calls that do not have associated permissions andPermissive enforcement policy
will allow the API call if no permission is tied with the resource/path.It's not mandatory to provide the permissions but if not provided APISIX should call Keycloak twice to first identify the protected resource path and in the second call to evaluate the permissions.
I would like to contribute to this plugin and would like to hear the thoughts of the community.
The text was updated successfully, but these errors were encountered: