onecx-permissions

Installation

If you want to use this extension, you need to add the org.tkit.onecx.quarkus:onecx-permission extension first to your build file.

For instance, with Maven, add the following dependency to your POM file:

<dependency>
    <groupId>org.tkit.onecx.quarkus</groupId>
    <artifactId>onecx-permission</artifactId>
    <version>2.0.0</version>
</dependency>

Usage

  1. First you need to add the maven dependency shown at the top

  2. Then you can use @PermissionsAllowed annotation

    @GET
    @Path("write")
    @PermissionsAllowed(value = "onecx:resource#action")
    public Response adminWrite() {
        return Response.ok("OK").build();
    }

Configuration

Configuration property fixed at build time - All other configuration properties are overridable at runtime

Configuration property

Type

Default

Tenant client URL configuration. This property is alias for rest-client generated configuration property quarkus.rest-client.onecx_permission.url

Environment variable: ONECX_PERMISSIONS_SERVICE_CLIENT_URL

string

http://onecx-permission-svc:8080

Enable interface mapping

Environment variable: ONECX_PERMISSIONS_ENABLED

boolean

true

Enable interface mapping

Environment variable: ONECX_PERMISSIONS_CACHE_ENABLED

boolean

true

Allow all permissions

Environment variable: ONECX_PERMISSIONS_ALLOW_ALL

boolean

false

Product name.

Environment variable: ONECX_PERMISSIONS_PRODUCT_NAME

string

required

Permissions application ID.

Environment variable: ONECX_PERMISSIONS_APPLICATION_ID

string

${quarkus.application.name}

Permissions prefix name.

Environment variable: ONECX_PERMISSIONS_NAME

string

onecx

Permissions access token header parameter.

Environment variable: ONECX_PERMISSIONS_REQUEST_TOKEN_FROM_HEADER_PARAM

string

Authorization

Permissions principal token header parameter.

Environment variable: ONECX_PERMISSIONS_TOKEN_HEADER_PARAM

string

${tkit.rs.context.token.header-param:apm-principal-token}

Permissions resource action separator.

Environment variable: ONECX_PERMISSIONS_KEY_SEPARATOR

string

#

Enable or disable mock service

Environment variable: ONECX_PERMISSIONS_MOCK_ENABLED

boolean

false

Mock data for role Map format : [role].[permission]=[actions]

Environment variable: ONECX_PERMISSIONS_MOCK_ROLES__ROLES_

Map<String,Map<String,List<String>>>