Hi Stian,
I think this is possible to do that with a version of my authz authenticator [1] combined with a custom `org.keycloak.authorization.policy.provider.PolicyProvider` implementation
which evaluates a OPA policy with the data from the current EvaluationContext (user, (user roles, groups, attributes), client).
Or do you really want to introduce a dedicated "AuthorizationProvider" layer with the two implementations KeycloakAuthorizationProvider and OpaAuthorizationProvider?
However I think it would be more convenient for users of they had simpler ways to configure this instead of having to declare an authz policy.
In the client configuration we could have a new section: "Access Management" or "Access Policies".
In this section there could be a simple setting like:
- "Required Roles" -> specify the roles that users need to have in order to access this client, default empty.
- "Required Group" -> specify the Groups that user need to be member of in order to access this client, default empty
- "Required Attributes" -> specify the attributes that users need to have in order to access this client, default empty
- "Required Policy Outcome" -> specify the policies that need to evaluate to a certain outcome have in order to access this client, default empty.
- "Default Access" -> Deny / Allow
Some options probable need some additional configuration to configure things like:
- require all / at least one role / attribute / group membership
- logic: positive / negative
Btw. it would be cool if there were a way to group clients within a realm to bind access policies to a set of clients, either via explicit client groups, or based on tags / labels.
Cheers,
Thomas