keycloak 2.4.1 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0aa2abcfd866bb390cc92962cf088157dd788d9ce1c1fb631f9c0199fda1cf1b
4
- data.tar.gz: 7a5aca5bde76e62d3f73ef9c0a6c93b24b2f7ce4bba50af1c705863865dfd117
3
+ metadata.gz: c71e040ba83715ddd3e25671c1356402108fb1826954b0d8a0f939a071666fed
4
+ data.tar.gz: 5de8fa49fcd5adf2e9ffb14f45900bac80dad1c1d31a33f4c3bc6bcbdf76899b
5
5
  SHA512:
6
- metadata.gz: 61ab8f0777733efc2102a86cb340222dcd12ba335d0661c9b7d9a4f2f3a98f53c67ec2755e3301c8d629a36f565d78b7608460a67acf19e92d493fd0b2d843d3
7
- data.tar.gz: 38cb5b38f55074a6db68f13366cb625ba77487b12c1ff9360f42bac3a05adbf68b361da52fdc2475e50ee0f8863ef3c710c56f1dee386c8cc308a47a014838cc
6
+ metadata.gz: 83e956681efe0986abb87becc34f23101ae4eca113ec54b8aa872829f486ea2b829d5c1fb95553a3e3ebe2578e5fdf873e1ef2134d9f8dadc3522cbdc1f4bf40
7
+ data.tar.gz: d7b63fc19ca1d01ceacbe94cfbb7d58271ffd94a53863370b7066053d80991c3c972bc76b6d62657b35fcb8bf9b89641bd209837434894198185494e22bb0316
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- keycloak (2.4.1)
4
+ keycloak (2.5.0)
5
5
  json
6
6
  jwt
7
7
  rest-client
@@ -14,11 +14,11 @@ GEM
14
14
  unf (>= 0.0.5, < 1.0.0)
15
15
  http-cookie (1.0.3)
16
16
  domain_name (~> 0.5)
17
- json (2.1.0)
18
- jwt (2.1.0)
17
+ json (2.2.0)
18
+ jwt (2.2.1)
19
19
  mime-types (3.2.2)
20
20
  mime-types-data (~> 3.2015)
21
- mime-types-data (3.2018.0812)
21
+ mime-types-data (3.2019.0331)
22
22
  netrc (0.11.0)
23
23
  rake (10.5.0)
24
24
  rest-client (2.0.2)
@@ -40,7 +40,7 @@ GEM
40
40
  rspec-support (3.7.1)
41
41
  unf (0.1.4)
42
42
  unf_ext
43
- unf_ext (0.0.7.5)
43
+ unf_ext (0.0.7.6)
44
44
 
45
45
  PLATFORMS
46
46
  ruby
data/lib/keycloak.rb CHANGED
@@ -12,7 +12,7 @@ module Keycloak
12
12
  class << self
13
13
  attr_accessor :proxy, :generate_request_exception, :keycloak_controller,
14
14
  :proc_cookie_token, :proc_external_attributes,
15
- :realm, :auth_server_url
15
+ :realm, :auth_server_url, :validate_token_when_call_has_role
16
16
  end
17
17
 
18
18
  def self.explode_exception
@@ -253,7 +253,7 @@ module Keycloak
253
253
  secret = @secret if secret.blank?
254
254
  token_introspection_endpoint = @configuration['token_introspection_endpoint'] if token_introspection_endpoint.blank?
255
255
 
256
- if user_signed_in?(access_token, client_id, secret, token_introspection_endpoint)
256
+ if !Keycloak.validate_token_when_call_has_role || user_signed_in?(access_token, client_id, secret, token_introspection_endpoint)
257
257
  dt = decoded_access_token(access_token)[0]
258
258
  dt = dt["resource_access"][client_id]
259
259
  if dt != nil
@@ -351,6 +351,7 @@ module Keycloak
351
351
  def self.setup_module
352
352
  Keycloak.proxy ||= ''
353
353
  Keycloak.keycloak_controller ||= KEYCLOACK_CONTROLLER_DEFAULT
354
+ Keycloak.validate_token_when_call_has_role ||= false
354
355
  get_installation
355
356
  end
356
357
 
@@ -836,14 +837,15 @@ module Keycloak
836
837
  protected
837
838
 
838
839
  def self.default_call(proc, client_id = '', secret = '')
839
- client_id = Keycloak::Client.client_id if client_id.blank?
840
- secret = Keycloak::Client.secret if secret.blank?
841
840
  begin
842
841
  tk = nil
843
842
  resp = nil
844
843
 
845
844
  Keycloak::Client.get_installation
846
845
 
846
+ client_id = Keycloak::Client.client_id if client_id.blank?
847
+ secret = Keycloak::Client.secret if secret.blank?
848
+
847
849
  payload = { 'client_id' => client_id,
848
850
  'client_secret' => secret,
849
851
  'grant_type' => 'client_credentials' }
@@ -1,3 +1,3 @@
1
1
  module Keycloak
2
- VERSION = "2.4.1"
2
+ VERSION = "2.5.0"
3
3
  end
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.4.1
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guilherme Portugues
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-14 00:00:00.000000000 Z
11
+ date: 2019-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler