keycloak-admin 0.7.5 → 0.7.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +3 -3
- data/README.md +3 -1
- data/lib/keycloak-admin/client/user_client.rb +16 -0
- data/lib/keycloak-admin/version.rb +1 -1
- data/spec/client/user_client_spec.rb +25 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4496dbc0b6fbd52610640546a149a2bc42cc7fb114acc210876c88c8b3626216
|
4
|
+
data.tar.gz: f9426c7701e10cac266df4a75a39fc20a717d3d31e92de88ca7bd3a6e2716a92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17ce324b2a3e555c756a095443902fbb616f88a91168b2f07245ca055c3714bd0aff0435afd1346b81fa456f60eaf5a07b3b1d4a01d66f0af3b3e39490d916f2
|
7
|
+
data.tar.gz: c7e81693e55556d5bb8f6fa4ead25a1172c9e5cb3f5e77a34ed420c92baa1b574a4b0746e5dfc314097a3a3f28c9d97e4f651444fee76a60dda89bda65e6a8ff
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## [0.7.6] - 2020-06-22
|
9
|
+
|
10
|
+
Thanks to @hobbypunk90
|
11
|
+
* Support for action emails and send forgot passsword mail
|
12
|
+
|
8
13
|
## [0.7.5] - 2020-03-28
|
9
14
|
|
10
15
|
Thanks to @RomanHargrave
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
keycloak-admin (0.7.
|
4
|
+
keycloak-admin (0.7.6)
|
5
5
|
http-cookie (~> 1.0, >= 1.0.3)
|
6
6
|
rest-client (~> 2.0)
|
7
7
|
|
@@ -17,7 +17,7 @@ GEM
|
|
17
17
|
domain_name (~> 0.5)
|
18
18
|
mime-types (3.3.1)
|
19
19
|
mime-types-data (~> 3.2015)
|
20
|
-
mime-types-data (3.
|
20
|
+
mime-types-data (3.2020.0512)
|
21
21
|
netrc (0.11.0)
|
22
22
|
rest-client (2.1.0)
|
23
23
|
http-accept (>= 1.7.0, < 2.0)
|
@@ -39,7 +39,7 @@ GEM
|
|
39
39
|
rspec-support (3.7.0)
|
40
40
|
unf (0.1.4)
|
41
41
|
unf_ext
|
42
|
-
unf_ext (0.0.7.
|
42
|
+
unf_ext (0.0.7.7)
|
43
43
|
|
44
44
|
PLATFORMS
|
45
45
|
ruby
|
data/README.md
CHANGED
@@ -12,7 +12,7 @@ This gem *does not* require Rails.
|
|
12
12
|
For example, using `bundle`, add this line to your Gemfile.
|
13
13
|
|
14
14
|
```ruby
|
15
|
-
gem "keycloak-admin", "0.7.
|
15
|
+
gem "keycloak-admin", "0.7.6"
|
16
16
|
```
|
17
17
|
|
18
18
|
## Login
|
@@ -98,6 +98,8 @@ All options have a default value. However, all of them can be changed in your in
|
|
98
98
|
* Save client role mappings for a user/group
|
99
99
|
* Save realm-level role mappings for a user/group
|
100
100
|
* Link/Unlink users to federated identity provider brokers
|
101
|
+
* Execute actions emails
|
102
|
+
* Send forgot passsword mail
|
101
103
|
|
102
104
|
### Get an access token
|
103
105
|
|
@@ -68,6 +68,17 @@ module KeycloakAdmin
|
|
68
68
|
user_id
|
69
69
|
end
|
70
70
|
|
71
|
+
def forgot_password(user_id)
|
72
|
+
execute_actions_email(user_id, ["UPDATE_PASSWORD"])
|
73
|
+
end
|
74
|
+
|
75
|
+
def execute_actions_email(user_id, actions=[])
|
76
|
+
execute_http do
|
77
|
+
RestClient.put(execute_actions_email_url(user_id), actions.to_json, headers)
|
78
|
+
end
|
79
|
+
user_id
|
80
|
+
end
|
81
|
+
|
71
82
|
def impersonate(user_id)
|
72
83
|
impersonation = get_redirect_impersonation(user_id)
|
73
84
|
response = execute_http do
|
@@ -110,6 +121,11 @@ module KeycloakAdmin
|
|
110
121
|
"#{users_url(user_id)}/reset-password"
|
111
122
|
end
|
112
123
|
|
124
|
+
def execute_actions_email_url(user_id)
|
125
|
+
raise ArgumentError.new("user_id must be defined") if user_id.nil?
|
126
|
+
"#{users_url(user_id)}/execute-actions-email"
|
127
|
+
end
|
128
|
+
|
113
129
|
def groups_url(user_id)
|
114
130
|
raise ArgumentError.new("user_id must be defined") if user_id.nil?
|
115
131
|
"#{users_url(user_id)}/groups"
|
@@ -72,6 +72,31 @@ RSpec.describe KeycloakAdmin::TokenClient do
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
+
describe "#execute_actions_email_url" do
|
76
|
+
let(:realm_name) { "valid-realm" }
|
77
|
+
let(:user_id) { nil }
|
78
|
+
|
79
|
+
before(:each) do
|
80
|
+
@client = KeycloakAdmin.realm(realm_name).users
|
81
|
+
end
|
82
|
+
|
83
|
+
context "when user_id is not defined" do
|
84
|
+
let(:user_id) { nil }
|
85
|
+
it "raises an error" do
|
86
|
+
expect {
|
87
|
+
@client.execute_actions_email_url(user_id)
|
88
|
+
}.to raise_error(ArgumentError)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
context "when user_id is defined" do
|
93
|
+
let(:user_id) { 42 }
|
94
|
+
it "return a proper url" do
|
95
|
+
expect(@client.execute_actions_email_url(user_id)).to eq "http://auth.service.io/auth/admin/realms/valid-realm/users/42/execute-actions-email"
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
75
100
|
describe "#impersonation_url" do
|
76
101
|
let(:realm_name) { "valid-realm" }
|
77
102
|
let(:user_id) { nil }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: keycloak-admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lorent Lempereur
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http-cookie
|