Skip to content

feature : OAuth Authorization plugin for Keycloak  #1679

@sshniro

Description

@sshniro

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.

image

The following is a proposed schema for the authz-keycloak plugin:

curl http://127.0.0.1:9080/apisix/admin/routes/5  -X PUT -d '
{
    "uri": "/get",
    "host": "httpbin.org",
    "plugins": {
        "authz-keycloak": {
          "token_endpoint": "token_endpoint_url",
          "grant_type": "urn:ietf:params:oauth:grant-type:uma-ticket",
          "enforcement_policy": "Permissive OR Enforcing",
          "permissions": [{"resourse_name#scope_1_name"}, {{"resourse_name#scope_2_name"}}]
        }
    },
    "upstream_id": 50
}'

Policy enforcing mode will reject calls that do not have associated permissions and Permissive 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions