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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4496dbc0b6fbd52610640546a149a2bc42cc7fb114acc210876c88c8b3626216
4
- data.tar.gz: f9426c7701e10cac266df4a75a39fc20a717d3d31e92de88ca7bd3a6e2716a92
3
+ metadata.gz: 8be78b3854a7d3ac95ddb700599f49f8b108f2eda85de66df200aa5e362b7f5e
4
+ data.tar.gz: 81103f2021f10e78c92327d7beace0ea30bc23175e3605c408e70f01a172203b
5
5
  SHA512:
6
- metadata.gz: 17ce324b2a3e555c756a095443902fbb616f88a91168b2f07245ca055c3714bd0aff0435afd1346b81fa456f60eaf5a07b3b1d4a01d66f0af3b3e39490d916f2
7
- data.tar.gz: c7e81693e55556d5bb8f6fa4ead25a1172c9e5cb3f5e77a34ed420c92baa1b574a4b0746e5dfc314097a3a3f28c9d97e4f651444fee76a60dda89bda65e6a8ff
6
+ metadata.gz: 83bda7a2b12cd6384710234618392aebfe0b29aa61378bf8350c8c8b3c70ad9725293f150c0074137351b21825cd3798d6ca180180a4b5d9c84909bef67a32b3
7
+ data.tar.gz: c052198198d30a8978229dfc71d2d5cb0d26db94e22291e6286dea7d8133b2060d5d658f26fc5e7e5f4b9b35fc11f3dce0eff13c1451aa48e85ee2678e90fde6
@@ -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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- keycloak-admin (0.7.6)
4
+ keycloak-admin (0.7.7)
5
5
  http-cookie (~> 1.0, >= 1.0.3)
6
6
  rest-client (~> 2.0)
7
7
 
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.6"
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.post(token_url, {
20
- tokenLifespanInSeconds: token_lifespan_in_seconds
21
- }.to_json, {
22
- Authorization: "Bearer #{user_access_token}",
23
- content_type: :json,
24
- accept: :json
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.put(users_url(user_id), user_representation_body.to_json, headers)
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.put(reset_password_url(user_id), {
63
- type: "password",
64
- value: new_password,
65
- temporary: false
66
- }.to_json, headers)
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
- RestClient.put(execute_actions_email_url(user_id), actions.to_json, headers)
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.post(impersonation.impersonation_url, impersonation.body.to_json, impersonation.headers)
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.post(federated_identity_url(user_id, idp_id), fed_id_rep.to_json, headers)
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
 
@@ -1,3 +1,3 @@
1
1
  module KeycloakAdmin
2
- VERSION = "0.7.6"
2
+ VERSION = "0.7.7"
3
3
  end
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.6
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-06-22 00:00:00.000000000 Z
11
+ date: 2020-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http-cookie