keycloak 2.2.6 → 2.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/keycloak.rb +24 -1
- data/lib/keycloak/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f151bb8561f0c327862f07db144aef5f5323e55
|
4
|
+
data.tar.gz: cc61afa7012092512f4864fdb7830bddf9ddae8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97e0f048f2926a3632b1c4dfb2acd9a37a1d8c905f5b0559d7d8ef775b49a941e14aa4531150a4cbb9372f91ea499b71708ebb8251c4769ae625f9aaf362e012
|
7
|
+
data.tar.gz: 95b983769f4b144c19f653ade86c0ba25069cd9aefcc0c9f112d1d6c84e40be5def35f5a0f27b76b9cff5561713ad74defefec9ab2a2e777d03e629fe3949571
|
data/lib/keycloak.rb
CHANGED
@@ -589,8 +589,9 @@ module Keycloak
|
|
589
589
|
info['federationLink'] != nil
|
590
590
|
end
|
591
591
|
|
592
|
-
def self.
|
592
|
+
def self.create_simple_user(username, password, email, first_name, last_name, realm_roles_names, client_roles_names, proc = nil)
|
593
593
|
begin
|
594
|
+
username.downcase!
|
594
595
|
user = get_user_info(username, true)
|
595
596
|
newUser = false
|
596
597
|
rescue Keycloak::UserLoginNotFound
|
@@ -602,6 +603,8 @@ module Keycloak
|
|
602
603
|
proc_default = lambda { |token|
|
603
604
|
user_representation = { username: username,
|
604
605
|
email: email,
|
606
|
+
firstName: first_name,
|
607
|
+
lastName: last_name,
|
605
608
|
enabled: true }
|
606
609
|
|
607
610
|
if !newUser || Keycloak.generic_request(token["access_token"],
|
@@ -637,6 +640,22 @@ module Keycloak
|
|
637
640
|
Keycloak::Admin.full_url("users/#{user['id']}/role-mappings/clients/#{client[0]['id']}"),
|
638
641
|
nil, roles, 'POST')
|
639
642
|
end
|
643
|
+
|
644
|
+
roles = []
|
645
|
+
realm_roles_names.each do |r|
|
646
|
+
if r.present?
|
647
|
+
role = JSON Keycloak.generic_request(token["access_token"],
|
648
|
+
Keycloak::Admin.full_url("roles/#{r}"),
|
649
|
+
nil, nil, 'GET')
|
650
|
+
roles.push(role)
|
651
|
+
end
|
652
|
+
end
|
653
|
+
|
654
|
+
if roles.count > 0
|
655
|
+
Keycloak.generic_request(token["access_token"],
|
656
|
+
Keycloak::Admin.full_url("users/#{user['id']}/role-mappings/realm"),
|
657
|
+
nil, roles, 'POST')
|
658
|
+
end
|
640
659
|
end
|
641
660
|
|
642
661
|
end
|
@@ -647,6 +666,10 @@ module Keycloak
|
|
647
666
|
end
|
648
667
|
end
|
649
668
|
|
669
|
+
def self.create_starter_user(username, password, email, client_roles_names, proc = nil)
|
670
|
+
Keycloak::Internal.create_simple_user(username, password, email, '', '', [], client_roles_names, proc)
|
671
|
+
end
|
672
|
+
|
650
673
|
def self.get_client_roles
|
651
674
|
proc = lambda {|token|
|
652
675
|
client = JSON Keycloak::Admin.get_clients({ clientId: Keycloak::Client.client_id }, token["access_token"])
|
data/lib/keycloak/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: keycloak
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guilherme Portugues
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|