Class: KeycloakAdmin::RoleMapperClient

Inherits:
Client
  • Object
show all
Defined in:
lib/keycloak-admin/client/role_mapper_client.rb

Instance Method Summary collapse

Methods inherited from Client

#create_payload, #created_id, #current_token, #execute_http, #headers, #server_url

Constructor Details

#initialize(configuration, user_resource) ⇒ RoleMapperClient

Returns a new instance of RoleMapperClient.



3
4
5
6
# File 'lib/keycloak-admin/client/role_mapper_client.rb', line 3

def initialize(configuration, user_resource)
  super(configuration)
  @user_resource = user_resource
end

Instance Method Details

#realm_level_urlObject



23
24
25
# File 'lib/keycloak-admin/client/role_mapper_client.rb', line 23

def realm_level_url
  "#{@user_resource.resource_url}/role-mappings/realm"
end

#remove_all_realm_rolesObject



16
17
18
19
20
21
# File 'lib/keycloak-admin/client/role_mapper_client.rb', line 16

def remove_all_realm_roles
  execute_http do
    RestClient::Resource.new(realm_level_url, @configuration.rest_client_options).delete(headers)
  end
  true
end

#save_realm_level(role_representation_list) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/keycloak-admin/client/role_mapper_client.rb', line 8

def save_realm_level(role_representation_list)
  execute_http do
    RestClient::Resource.new(realm_level_url, @configuration.rest_client_options).post(
      create_payload(role_representation_list), headers
    )
  end
end