org.keycloak.services.resources.admin

## Class ScopeMappedResource

- java.lang.Object
- - org.keycloak.services.resources.admin.ScopeMappedResource

-     public class ScopeMappedResource
      extends Object

  Base class for managing the scope mappings of a specific client (application or oauth).
  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ClientModel` | `client`
    `protected RealmModel` | `realm`
    `protected KeycloakSession` | `session`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ScopeMappedResource(RealmModel realm, RealmAuth auth, ClientModel client, KeycloakSession session)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addApplicationScopeMapping(String appName, List<RoleRepresentation> roles)` Add application-level roles to the client's scope
    `void` | `addRealmScopeMappings(List<RoleRepresentation> roles)` Add a set of realm-level roles to the client's scope
    `void` | `deleteApplicationScopeMapping(String appName, List<RoleRepresentation> roles)` Remove application-level roles from the client's scope.
    `void` | `deleteRealmScopeMappings(List<RoleRepresentation> roles)` Remove a set of realm-level roles from the client's scope
    `List<RoleRepresentation>` | `getApplicationScopeMappings(String appName)` Get the roles associated with a client's scope for a specific application.
    `List<RoleRepresentation>` | `getAvailableApplicationScopeMappings(String appName)` The available application-level roles that can be associated with the client's scope
    `List<RoleRepresentation>` | `getAvailableRealmScopeMappings()` Get list of realm-level roles that are available to attach to this client's scope.
    `List<RoleRepresentation>` | `getCompositeApplicationScopeMappings(String appName)` Get effective application roles that are associated with the client's scope for a specific application.
    `List<RoleRepresentation>` | `getCompositeRealmScopeMappings()` Get all effective realm-level roles that are associated with this client's scope.
    `List<RoleRepresentation>` | `getRealmScopeMappings()` Get list of realm-level roles associated with this client's scope.
    `MappingsRepresentation` | `getScopeMappings()` Get all scope mappings for this client

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

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

- - ### Field Detail

    - #### realm

          protected RealmModel realm

    - #### client

          protected ClientModel client

    - #### session

          protected KeycloakSession session

  - ### Constructor Detail

    - #### ScopeMappedResource

          public ScopeMappedResource(RealmModel realm,
                             RealmAuth auth,
                             ClientModel client,
                             KeycloakSession session)

  - ### Method Detail

    - #### getScopeMappings

          @GET
          @Produces(value="application/json")
          public MappingsRepresentation getScopeMappings()

      Get all scope mappings for this client
      Returns:

    - #### getRealmScopeMappings

          @Path(value="realm")
          @GET
          @Produces(value="application/json")
          public List<RoleRepresentation> getRealmScopeMappings()

      Get list of realm-level roles associated with this client's scope.
      Returns:

    - #### getAvailableRealmScopeMappings

          @Path(value="realm/available")
          @GET
          @Produces(value="application/json")
          public List<RoleRepresentation> getAvailableRealmScopeMappings()

      Get list of realm-level roles that are available to attach to this client's scope.
      Returns:

    - #### getCompositeRealmScopeMappings

          @Path(value="realm/composite")
          @GET
          @Produces(value="application/json")
          public List<RoleRepresentation> getCompositeRealmScopeMappings()

      Get all effective realm-level roles that are associated with this client's scope. What this does is recurse any composite roles associated with the client's scope and adds the roles to this lists. The method is really to show a comprehensive total view of realm-level roles associated with the client.
      Returns:

    - #### addRealmScopeMappings

          @Path(value="realm")
          @POST
          @Consumes(value="application/json")
          public void addRealmScopeMappings(List<RoleRepresentation> roles)

      Add a set of realm-level roles to the client's scope
      Parameters:
        `roles` -

    - #### deleteRealmScopeMappings

          @Path(value="realm")
          @DELETE
          @Consumes(value="application/json")
          public void deleteRealmScopeMappings(List<RoleRepresentation> roles)

      Remove a set of realm-level roles from the client's scope
      Parameters:
        `roles` -

    - #### getApplicationScopeMappings

          @Path(value="applications/{app}")
          @GET
          @Produces(value="application/json")
          public List<RoleRepresentation> getApplicationScopeMappings(@PathParam(value="app")
                                                                               String appName)

      Get the roles associated with a client's scope for a specific application.
      Parameters:
        `appName` - roles associated with client's scope for a specific application
      Returns:

    - #### getAvailableApplicationScopeMappings

          @Path(value="applications/{app}/available")
          @GET
          @Produces(value="application/json")
          public List<RoleRepresentation> getAvailableApplicationScopeMappings(@PathParam(value="app")
                                                                                        String appName)

      The available application-level roles that can be associated with the client's scope
      Parameters:
        `appName` - available roles for a specific application
      Returns:

    - #### getCompositeApplicationScopeMappings

          @Path(value="applications/{app}/composite")
          @GET
          @Produces(value="application/json")
          public List<RoleRepresentation> getCompositeApplicationScopeMappings(@PathParam(value="app")
                                                                                        String appName)

      Get effective application roles that are associated with the client's scope for a specific application.
      Parameters:
        `appName` - effective roles for a specific app
      Returns:

    - #### addApplicationScopeMapping

          @Path(value="applications/{app}")
          @POST
          @Consumes(value="application/json")
          public void addApplicationScopeMapping(@PathParam(value="app")
                                                           String appName,
                                                           List<RoleRepresentation> roles)

      Add application-level roles to the client's scope
      Parameters:
        `appName` -
        `roles` -

    - #### deleteApplicationScopeMapping

          @Path(value="applications/{app}")
          @DELETE
          @Consumes(value="application/json")
          public void deleteApplicationScopeMapping(@PathParam(value="app")
                                                                String appName,
                                                                List<RoleRepresentation> roles)

      Remove application-level roles from the client's scope.
      Parameters:
        `appName` -
        `roles` -

Copyright © 2014. All Rights Reserved.