org.keycloak.services.clientpolicy

## Class ClientPoliciesUtil

- java.lang.Object
- - org.keycloak.services.clientpolicy.ClientPoliciesUtil

-     public class ClientPoliciesUtil
      extends Object

  Utilities for treating client policies/profiles
  Author:
    Takashi Norimatsu

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClientPoliciesUtil()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `convertClientPoliciesRepresentationToJson(ClientPoliciesRepresentation reps)` convert client policies as representation to json.
    `static String` | `convertClientProfilesRepresentationToJson(ClientProfilesRepresentation reps)` convert client profiles as representation to json.
    `static ClientPoliciesRepresentation` | `getClientPoliciesRepresentation(KeycloakSession session, RealmModel realm)` get existing client policies in a realm as representation.
    `static Map<String,ClientProfileModel>` | `getClientProfilesModel(KeycloakSession session, RealmModel realm)` gets existing client profiles in a realm as model.
    `static ClientProfilesRepresentation` | `getClientProfilesRepresentation(KeycloakSession session, RealmModel realm)` gets existing client profiles in a realm as representation.
    `static List<ClientPolicyModel>` | `getEnabledClientProfilesModel(KeycloakSession session, RealmModel realm)` get existing enabled client policies in a realm as model.
    `static ClientPoliciesRepresentation` | `getValidatedBuiltinClientPoliciesRepresentation(KeycloakSession session, InputStream is)` get validated and modified builtin client policies set on keycloak app as representation.
    `static ClientProfilesRepresentation` | `getValidatedBuiltinClientProfilesRepresentation(KeycloakSession session, InputStream is)` get validated and modified builtin client profiles set on keycloak app as representation.
    `static String` | `getValidatedClientPoliciesJson(KeycloakSession session, RealmModel realm, ClientPoliciesRepresentation proposedPoliciesRep)` get validated and modified client policies as json.
    `static ClientPoliciesRepresentation` | `getValidatedClientPoliciesRepresentation(KeycloakSession session, RealmModel realm, String policiesJson)` get validated and modified builtin client policies in a realm as representation.
    `static String` | `getValidatedClientProfilesJson(KeycloakSession session, RealmModel realm, ClientProfilesRepresentation proposedProfilesRep)` get validated and modified client profiles as json.
    `static ClientProfilesRepresentation` | `getValidatedClientProfilesRepresentation(KeycloakSession session, RealmModel realm, String profilesJson)` get validated and modified builtin client profiles in a realm as representation.

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

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

- - ### Constructor Detail

    - #### ClientPoliciesUtil

          public ClientPoliciesUtil()

  - ### Method Detail

    - #### getClientProfilesRepresentation

          public static ClientProfilesRepresentation getClientProfilesRepresentation(KeycloakSession session,
                                                                                     RealmModel realm)
                                                                              throws ClientPolicyException

      gets existing client profiles in a realm as representation. not return null.
      Throws:
        `ClientPolicyException`

    - #### getClientProfilesModel

          public static Map<String,ClientProfileModel> getClientProfilesModel(KeycloakSession session,
                                                                              RealmModel realm)

      gets existing client profiles in a realm as model. not return null.

    - #### getValidatedBuiltinClientProfilesRepresentation

          public static ClientProfilesRepresentation getValidatedBuiltinClientProfilesRepresentation(KeycloakSession session,
                                                                                                     InputStream is)
                                                                                              throws ClientPolicyException

      get validated and modified builtin client profiles set on keycloak app as representation. it is loaded from json file enclosed in keycloak's binary. not return null.
      Throws:
        `ClientPolicyException`

    - #### convertClientProfilesRepresentationToJson

          public static String convertClientProfilesRepresentationToJson(ClientProfilesRepresentation reps)
                                                                  throws ClientPolicyException

      convert client profiles as representation to json. can return null.
      Throws:
        `ClientPolicyException`

    - #### getValidatedClientProfilesJson

          public static String getValidatedClientProfilesJson(KeycloakSession session,
                                                              RealmModel realm,
                                                              ClientProfilesRepresentation proposedProfilesRep)
                                                       throws ClientPolicyException

      get validated and modified client profiles as json. it can be constructed by merging proposed client profiles with existing client profiles. can return null.
      Throws:
        `ClientPolicyException`

    - #### getValidatedClientProfilesRepresentation

          public static ClientProfilesRepresentation getValidatedClientProfilesRepresentation(KeycloakSession session,
                                                                                              RealmModel realm,
                                                                                              String profilesJson)
                                                                                       throws ClientPolicyException

      get validated and modified builtin client profiles in a realm as representation. it can be constructed by merging proposed client profiles with existing client profiles. not return null.
      Throws:
        `ClientPolicyException`

    - #### getClientPoliciesRepresentation

          public static ClientPoliciesRepresentation getClientPoliciesRepresentation(KeycloakSession session,
                                                                                     RealmModel realm)
                                                                              throws ClientPolicyException

      get existing client policies in a realm as representation. not return null.
      Throws:
        `ClientPolicyException`

    - #### getEnabledClientProfilesModel

          public static List<ClientPolicyModel> getEnabledClientProfilesModel(KeycloakSession session,
                                                                              RealmModel realm)

      get existing enabled client policies in a realm as model. not return null.

    - #### getValidatedBuiltinClientPoliciesRepresentation

          public static ClientPoliciesRepresentation getValidatedBuiltinClientPoliciesRepresentation(KeycloakSession session,
                                                                                                     InputStream is)
                                                                                              throws ClientPolicyException

      get validated and modified builtin client policies set on keycloak app as representation. it is loaded from json file enclosed in keycloak's binary. not return null.
      Throws:
        `ClientPolicyException`

    - #### convertClientPoliciesRepresentationToJson

          public static String convertClientPoliciesRepresentationToJson(ClientPoliciesRepresentation reps)
                                                                  throws ClientPolicyException

      convert client policies as representation to json. can return null.
      Throws:
        `ClientPolicyException`

    - #### getValidatedClientPoliciesJson

          public static String getValidatedClientPoliciesJson(KeycloakSession session,
                                                              RealmModel realm,
                                                              ClientPoliciesRepresentation proposedPoliciesRep)
                                                       throws ClientPolicyException

      get validated and modified client policies as json. it can be constructed by merging proposed client policies with existing client policies. can return null.
      Throws:
        `ClientPolicyException`

    - #### getValidatedClientPoliciesRepresentation

          public static ClientPoliciesRepresentation getValidatedClientPoliciesRepresentation(KeycloakSession session,
                                                                                              RealmModel realm,
                                                                                              String policiesJson)
                                                                                       throws ClientPolicyException

      get validated and modified builtin client policies in a realm as representation. it can be constructed by merging proposed client policies with existing client policies. not return null.
      Throws:
        `ClientPolicyException`

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