org.keycloak.authorization.admin

## Class PolicyService

- java.lang.Object
- - org.keycloak.authorization.admin.PolicyService

- Direct Known Subclasses:
    PermissionService, PolicyTypeService

      public class PolicyService
      extends Object

  Author:
    Pedro Igor

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected AdminEventBuilder` | `adminEvent`
    `protected AdminPermissionEvaluator` | `auth`
    `protected AuthorizationProvider` | `authorization`
    `protected ResourceServer` | `resourceServer`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PolicyService(ResourceServer resourceServer, AuthorizationProvider authorization, AdminPermissionEvaluator auth, AdminEventBuilder adminEvent)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Policy` | `create(AbstractPolicyRepresentation representation)`
    `javax.ws.rs.core.Response` | `create(String payload, KeycloakSession session)`
    `protected Object` | `doCreatePolicyResource(Policy policy)`
    `protected PolicyTypeService` | `doCreatePolicyTypeResource(String type)`
    `protected AbstractPolicyRepresentation` | `doCreateRepresentation(String payload)`
    `protected List<Object>` | `doSearch(Integer firstResult, Integer maxResult, String fields, Map<Policy.FilterOption,String[]> filters)`
    `javax.ws.rs.core.Response` | `findAll(String id, String name, String type, String resource, String scope, Boolean permission, String owner, String fields, Integer firstResult, Integer maxResult)`
    `javax.ws.rs.core.Response` | `findByName(String name, String fields)`
    `javax.ws.rs.core.Response` | `findPolicyProviders()`
    `PolicyEvaluationService` | `getPolicyEvaluateResource()`
    `protected PolicyProviderAdminService` | `getPolicyProviderAdminResource(String policyType)`
    `protected PolicyProviderFactory` | `getPolicyProviderFactory(String policyType)`
    `Object` | `getResource(String type)`
    `protected AbstractPolicyRepresentation` | `toRepresentation(Policy model, String fields, AuthorizationProvider authorization)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### resourceServer

          protected final ResourceServer resourceServer

    - #### authorization

          protected final AuthorizationProvider authorization

    - #### auth

          protected final AdminPermissionEvaluator auth

    - #### adminEvent

          protected final AdminEventBuilder adminEvent

  - ### Constructor Detail

    - #### PolicyService

          public PolicyService(ResourceServer resourceServer,
                               AuthorizationProvider authorization,
                               AdminPermissionEvaluator auth,
                               AdminEventBuilder adminEvent)

  - ### Method Detail

    - #### getResource

          @Path(value="{type}")
          public Object getResource(@PathParam(value="type")
                                                          String type)

    - #### doCreatePolicyTypeResource

          protected PolicyTypeService doCreatePolicyTypeResource(String type)

    - #### doCreatePolicyResource

          protected Object doCreatePolicyResource(Policy policy)

    - #### create

          @POST
           @Consumes(value="application/json")
           @Produces(value="application/json")
          public javax.ws.rs.core.Response create(String payload,
                                                                                                                                  @Context
                                                                                                                                  KeycloakSession session)

    - #### doCreateRepresentation

          protected AbstractPolicyRepresentation doCreateRepresentation(String payload)

    - #### create

          public Policy create(AbstractPolicyRepresentation representation)

    - #### findByName

          @Path(value="/search")
           @GET
           @Produces(value="application/json")
          public javax.ws.rs.core.Response findByName(@QueryParam(value="name")
                                                                                                                        String name,
                                                                                                                        @QueryParam(value="fields")
                                                                                                                        String fields)

    - #### findAll

          @GET
           @Produces(value="application/json")
          public javax.ws.rs.core.Response findAll(@QueryParam(value="policyId")
                                                                                             String id,
                                                                                             @QueryParam(value="name")
                                                                                             String name,
                                                                                             @QueryParam(value="type")
                                                                                             String type,
                                                                                             @QueryParam(value="resource")
                                                                                             String resource,
                                                                                             @QueryParam(value="scope")
                                                                                             String scope,
                                                                                             @QueryParam(value="permission")
                                                                                             Boolean permission,
                                                                                             @QueryParam(value="owner")
                                                                                             String owner,
                                                                                             @QueryParam(value="fields")
                                                                                             String fields,
                                                                                             @QueryParam(value="first")
                                                                                             Integer firstResult,
                                                                                             @QueryParam(value="max")
                                                                                             Integer maxResult)

    - #### toRepresentation

          protected AbstractPolicyRepresentation toRepresentation(Policy model,
                                                                  String fields,
                                                                  AuthorizationProvider authorization)

    - #### doSearch

          protected List<Object> doSearch(Integer firstResult,
                                          Integer maxResult,
                                          String fields,
                                          Map<Policy.FilterOption,String[]> filters)

    - #### findPolicyProviders

          @Path(value="providers")
           @GET
           @Produces(value="application/json")
          public javax.ws.rs.core.Response findPolicyProviders()

    - #### getPolicyEvaluateResource

          @Path(value="evaluate")
          public PolicyEvaluationService getPolicyEvaluateResource()

    - #### getPolicyProviderAdminResource

          protected PolicyProviderAdminService getPolicyProviderAdminResource(String policyType)

    - #### getPolicyProviderFactory

          protected PolicyProviderFactory getPolicyProviderFactory(String policyType)

Copyright © 2021 JBoss by Red Hat. All rights reserved.