keycloak-admin 0.7.6 → 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/Gemfile.lock +1 -1
- data/README.md +2 -6
- data/lib/keycloak-admin/client/configurable_token_client.rb +12 -7
- data/lib/keycloak-admin/client/user_client.rb +37 -12
- data/lib/keycloak-admin/version.rb +1 -1
- 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: 8be78b3854a7d3ac95ddb700599f49f8b108f2eda85de66df200aa5e362b7f5e
|
4
|
+
data.tar.gz: 81103f2021f10e78c92327d7beace0ea30bc23175e3605c408e70f01a172203b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83bda7a2b12cd6384710234618392aebfe0b29aa61378bf8350c8c8b3c70ad9725293f150c0074137351b21825cd3798d6ca180180a4b5d9c84909bef67a32b3
|
7
|
+
data.tar.gz: c052198198d30a8978229dfc71d2d5cb0d26db94e22291e6286dea7d8133b2060d5d658f26fc5e7e5f4b9b35fc11f3dce0eff13c1451aa48e85ee2678e90fde6
|
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.7] - 2020-07-10
|
9
|
+
|
10
|
+
* Fix: `Replace request method shorthand with .execute for proper RestClient option support` (thanks to @RomanHargrave)
|
11
|
+
* When sending action emails, add lifespan as an optional parameter (thanks to @hobbypunk90)
|
12
|
+
|
8
13
|
## [0.7.6] - 2020-06-22
|
9
14
|
|
10
15
|
Thanks to @hobbypunk90
|
@@ -21,7 +26,7 @@ Thanks to @RomanHargrave
|
|
21
26
|
|
22
27
|
## [0.7.3] - 2019-07-11
|
23
28
|
|
24
|
-
Thanks to @cederigo
|
29
|
+
Thanks to @cederigo:
|
25
30
|
* For a given user, get her list of groups
|
26
31
|
|
27
32
|
## [0.7.2] - 2019-06-17
|
data/Gemfile.lock
CHANGED
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.7"
|
16
16
|
```
|
17
17
|
|
18
18
|
## Login
|
@@ -343,8 +343,4 @@ From the `keycloak-admin-api` directory:
|
|
343
343
|
```
|
344
344
|
$ docker build . -t keycloak-admin:test
|
345
345
|
$ docker run -v `pwd`:/usr/src/app/ keycloak-admin:test bundle exec rspec spec
|
346
|
-
```
|
347
|
-
|
348
|
-
## Future work
|
349
|
-
|
350
|
-
* Allow authentication using JWT assertions
|
346
|
+
```
|
@@ -16,13 +16,18 @@ module KeycloakAdmin
|
|
16
16
|
|
17
17
|
def exchange_with(user_access_token, token_lifespan_in_seconds)
|
18
18
|
response = execute_http do
|
19
|
-
RestClient.
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
RestClient::Request.execute(
|
20
|
+
@configuration.rest_client_options.merge(
|
21
|
+
method: :post,
|
22
|
+
url: token_url,
|
23
|
+
payload: { tokenLifespanInSeconds: token_lifespan_in_seconds }.to_json,
|
24
|
+
headers: {
|
25
|
+
Authorization: "Bearer #{user_access_token}",
|
26
|
+
content_type: :json,
|
27
|
+
accept: :json
|
28
|
+
}
|
29
|
+
)
|
30
|
+
)
|
26
31
|
end
|
27
32
|
TokenRepresentation.from_json(response.body)
|
28
33
|
end
|
@@ -21,7 +21,14 @@ module KeycloakAdmin
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def update(user_id, user_representation_body)
|
24
|
-
RestClient.
|
24
|
+
RestClient::Request.execute(
|
25
|
+
@configuration.rest_client_options.merge(
|
26
|
+
method: :put,
|
27
|
+
url: users_url(user_id),
|
28
|
+
payload: user_representation_body.to_json,
|
29
|
+
headers: headers
|
30
|
+
)
|
31
|
+
)
|
25
32
|
end
|
26
33
|
|
27
34
|
def get(user_id)
|
@@ -59,22 +66,26 @@ module KeycloakAdmin
|
|
59
66
|
|
60
67
|
def update_password(user_id, new_password)
|
61
68
|
execute_http do
|
62
|
-
RestClient.
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
69
|
+
RestClient::Request.execute(
|
70
|
+
@configuration.rest_client_options.merge(
|
71
|
+
method: :put,
|
72
|
+
url: reset_password_url(user_id),
|
73
|
+
payload: { type: 'password', value: new_password, temporary: false }.to_json,
|
74
|
+
headers: headers
|
75
|
+
)
|
76
|
+
)
|
67
77
|
end
|
68
78
|
user_id
|
69
79
|
end
|
70
80
|
|
71
|
-
def forgot_password(user_id)
|
72
|
-
execute_actions_email(user_id, ["UPDATE_PASSWORD"])
|
81
|
+
def forgot_password(user_id, lifespan=nil)
|
82
|
+
execute_actions_email(user_id, ["UPDATE_PASSWORD"], lifespan)
|
73
83
|
end
|
74
84
|
|
75
|
-
def execute_actions_email(user_id, actions=[])
|
85
|
+
def execute_actions_email(user_id, actions=[], lifespan=nil)
|
76
86
|
execute_http do
|
77
|
-
|
87
|
+
lifespan_param = lifespan.nil? ? "" : "lifespan=#{lifespan.seconds}"
|
88
|
+
RestClient.put("#{execute_actions_email_url(user_id)}?#{lifespan_param}", actions.to_json, headers)
|
78
89
|
end
|
79
90
|
user_id
|
80
91
|
end
|
@@ -82,7 +93,14 @@ module KeycloakAdmin
|
|
82
93
|
def impersonate(user_id)
|
83
94
|
impersonation = get_redirect_impersonation(user_id)
|
84
95
|
response = execute_http do
|
85
|
-
RestClient.
|
96
|
+
RestClient::Request.execute(
|
97
|
+
@configuration.rest_client_options.merge(
|
98
|
+
method: :post,
|
99
|
+
url: impersonation.impersonation_url,
|
100
|
+
payload: impersonation.body.to_json,
|
101
|
+
headers: impersonation.headers
|
102
|
+
)
|
103
|
+
)
|
86
104
|
end
|
87
105
|
ImpersonationRepresentation.from_response(response, @configuration.server_domain)
|
88
106
|
end
|
@@ -98,7 +116,14 @@ module KeycloakAdmin
|
|
98
116
|
fed_id_rep.identity_provider = idp_id
|
99
117
|
|
100
118
|
execute_http do
|
101
|
-
RestClient.
|
119
|
+
RestClient::Request.execute(
|
120
|
+
@configuration.rest_client_options.merge(
|
121
|
+
method: :post,
|
122
|
+
url: federated_identity_url(user_id, idp_id),
|
123
|
+
payload: fed_id_rep.to_json,
|
124
|
+
headers: headers
|
125
|
+
)
|
126
|
+
)
|
102
127
|
end
|
103
128
|
end
|
104
129
|
|
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.7
|
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-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http-cookie
|