org.keycloak.adapters

## Class AdapterUtils

- java.lang.Object
- - org.keycloak.adapters.AdapterUtils

-     public class AdapterUtils
      extends Object

  Author:
    Marek Posolda

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AdapterUtils()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static KeycloakPrincipal<RefreshableKeycloakSecurityContext>` | `createPrincipal(KeycloakDeployment deployment, RefreshableKeycloakSecurityContext securityContext)`
    `static String` | `getOriginForRestCalls(String browserRequestURL, KeycloakSecurityContext session)` Best effort to find origin for REST request calls from web UI application to REST application.
    `static String` | `getPrincipalName(KeycloakDeployment deployment, AccessToken token)`
    `static Set<String>` | `getRolesFromSecurityContext(RefreshableKeycloakSecurityContext session)`

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

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

- - ### Constructor Detail

    - #### AdapterUtils

          public AdapterUtils()

  - ### Method Detail

    - #### getOriginForRestCalls

          public static String getOriginForRestCalls(String browserRequestURL,
                                     KeycloakSecurityContext session)

      Best effort to find origin for REST request calls from web UI application to REST application. In case of relative or absolute "auth-server-url" is returned the URL from request. In case of "auth-server-url-for-backend-request" used in configuration, it returns the origin of auth server. This may be the optimization in cluster, so if you have keycloak and applications on same host, the REST request doesn't need to go through loadbalancer, but can be sent directly to same host.
      Parameters:
        `browserRequestURL` -
        `session` -
      Returns:

    - #### getRolesFromSecurityContext

          public static Set<String> getRolesFromSecurityContext(RefreshableKeycloakSecurityContext session)

    - #### getPrincipalName

          public static String getPrincipalName(KeycloakDeployment deployment,
                                AccessToken token)

    - #### createPrincipal

          public static KeycloakPrincipal<RefreshableKeycloakSecurityContext> createPrincipal(KeycloakDeployment deployment,
                                                                              RefreshableKeycloakSecurityContext securityContext)

Copyright © 2015. All rights reserved.