services/src/main/java/org/keycloak/services/resources/admin/ScopeMappedClientResource.java
/**
     * Add client-level roles to the client's scope
     *
     * @param roles
     */
Add client-level roles to the client's scope

@param roles
Add client - level roles to the client ' s scope @param roles
@POST
    @Consumes(MediaType.APPLICATION_JSON)
    public void addClientScopeMapping(List<RoleRepresentation> roles) {
        auth.requireManage();
        for (RoleRepresentation role : roles) {
            RoleModel roleModel = scopedClient.getRole(role.getName());
            if (roleModel == null) {
                throw new NotFoundException("Role not found");
            }
            client.addScopeMapping(roleModel);
            adminEvent.operation(OperationType.CREATE).resourcePath(session.getContext().getUri(), roleModel.getId()).representation(roles).success();
        }
    }
@ POST @ Consumes ( MediaType . APPLICATION_JSON ) public void addClientScopeMapping ( List < RoleRepresentation > roles ) { auth . requireManage ( ) ; for ( RoleRepresentation role : roles ) { RoleModel roleModel = scopedClient . getRole ( role . getName ( ) ) ; if ( roleModel == null ) { throw new NotFoundException ( "Role not found" ) ; } client . addScopeMapping ( roleModel ) ; adminEvent . operation ( OperationType . CREATE ) . resourcePath ( session . getContext ( ) . getUri ( ) , roleModel . getId ( ) ) . representation ( roles ) . success ( ) ; } }
Add client-level roles to the client's scope
Add client - level roles to the client ' s scope