hydra-keycloak-client 0.1.10 → 0.1.13

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: 516229617ccd659620dd11a197eadbb3d5f2085bd59afdc44371af351b013009
4
- data.tar.gz: be901750b274b69fec1544e6268c0a0016d9b8ba254afec831215da440260de1
3
+ metadata.gz: 6b9fb72f474785e45fca86279c8a7877f73605bf3da22507a801ef7458f107b1
4
+ data.tar.gz: cc12951887ddd3f14aa662788b36c06d41095934707be9a4fe1ba685b8b1afa1
5
5
  SHA512:
6
- metadata.gz: 01df11417b5231dc9651568b84c2c08f63580bfa1a7fcc951b169eddfeb4849ec833115416cb807f19ed6457445b7927e4d554cae6201811d4021d57616e2c19
7
- data.tar.gz: 0f7af8f307e65ff7eae75bb5d9a5367c2af56a69f96b2d5723b6bb3e7ac54da5042ec499f84b2a741c55785a0cad2acef5c3e3b1d4d10939ccd0c48696d2ceea
6
+ metadata.gz: 5b026319391803ea1da1bee4bd47eb019a6c99ca48abd4a330353cdf55285378d1ef7d57f38d42520b59499962bbc393e6d17a1ed4b78e18087dc8e892d69ab5
7
+ data.tar.gz: 2bf4d76068843e4e82bb65c86653b04ed506d373f14990b77991f8c1064f1e193967c39a265536b364228bf1afa6bd4d2ad77f74201488f0d0d7e124c5c130b0
@@ -10,10 +10,23 @@ jobs:
10
10
  - uses: actions/checkout@v2
11
11
 
12
12
  - name: Build image
13
- run: docker build -f Dockerfile.test -t hkc_test_image .
13
+ run: docker build -f Dockerfile.test -t hkc_image:testing .
14
14
 
15
- - name: Run rubocop
16
- run: docker run hkc_test_image rubocop
15
+ - name: "Run tests"
16
+ run: |
17
+ docker run --name hkc_image \
18
+ -e SIMPLE_COV_ENABLED=true \
19
+ hkc_image:testing \
20
+ ./run_tests.sh
17
21
 
18
- - name: Run tests
19
- run: docker run hkc_test_image rspec
22
+ - name: "Save coverage report"
23
+ run: docker cp hkc_image:/app/coverage/coverage.xml coverage.xml
24
+
25
+ - name: "Upload coverage report"
26
+ run: pip install --user codecov==2.0.22 && python -m codecov --required --url="http://coverage.dev.latera.ru/api" --branch="${{ github.ref_name }}" --token="17989959" --slug="hydra-billing/hydra-keycloak-client"
27
+
28
+ - name: Clean up container
29
+ if: always()
30
+ run: |
31
+ docker kill hkc_image 2>/dev/null || true
32
+ docker rm hkc_image 2>/dev/null || true
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --require spec_helper
2
+ --color
data/Dockerfile.test CHANGED
@@ -1,6 +1,9 @@
1
1
  FROM ruby:2.7.4
2
2
 
3
3
  COPY . /app
4
+
4
5
  WORKDIR /app
5
6
 
7
+ RUN chmod +x ./run_tests.sh
8
+
6
9
  RUN bundle install
data/Gemfile CHANGED
@@ -10,3 +10,6 @@ gem 'rspec', '~> 3.0'
10
10
  gem 'rubocop', '~> 1.26'
11
11
 
12
12
  gem 'pry'
13
+
14
+ gem 'simplecov', require: false, group: :test
15
+ gem 'simplecov-cobertura', require: false, group: :test
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hydra-keycloak-client (0.1.9)
4
+ hydra-keycloak-client (0.1.12)
5
5
  dry-auto_inject
6
6
  dry-container
7
7
  dry-monads
@@ -14,11 +14,12 @@ GEM
14
14
  specs:
15
15
  ast (2.4.2)
16
16
  coderay (1.1.3)
17
- concurrent-ruby (1.1.9)
17
+ concurrent-ruby (1.1.10)
18
18
  diff-lcs (1.4.4)
19
+ docile (1.4.0)
19
20
  dry-auto_inject (0.9.0)
20
21
  dry-container (>= 0.3.4)
21
- dry-configurable (0.14.0)
22
+ dry-configurable (0.15.0)
22
23
  concurrent-ruby (~> 1.0)
23
24
  dry-core (~> 0.6)
24
25
  dry-container (0.9.0)
@@ -34,7 +35,7 @@ GEM
34
35
  dry-monads (1.4.0)
35
36
  concurrent-ruby (~> 1.0)
36
37
  dry-core (~> 0.7)
37
- dry-schema (1.9.1)
38
+ dry-schema (1.9.3)
38
39
  concurrent-ruby (~> 1.0)
39
40
  dry-configurable (~> 0.13, >= 0.13.0)
40
41
  dry-core (~> 0.5, >= 0.5)
@@ -52,7 +53,7 @@ GEM
52
53
  dry-inflector (~> 0.1, >= 0.1.2)
53
54
  dry-logic (~> 1.0, >= 1.0.2)
54
55
  ice_nine (0.11.2)
55
- jwt (2.3.0)
56
+ jwt (2.4.1)
56
57
  method_source (1.0.0)
57
58
  parallel (1.21.0)
58
59
  parser (3.1.1.0)
@@ -89,6 +90,15 @@ GEM
89
90
  rubocop-ast (1.16.0)
90
91
  parser (>= 3.1.1.0)
91
92
  ruby-progressbar (1.11.0)
93
+ simplecov (0.21.2)
94
+ docile (~> 1.1)
95
+ simplecov-html (~> 0.11)
96
+ simplecov_json_formatter (~> 0.1)
97
+ simplecov-cobertura (2.1.0)
98
+ rexml
99
+ simplecov (~> 0.19)
100
+ simplecov-html (0.12.3)
101
+ simplecov_json_formatter (0.1.4)
92
102
  unicode-display_width (2.1.0)
93
103
 
94
104
  PLATFORMS
@@ -100,6 +110,8 @@ DEPENDENCIES
100
110
  rake (~> 12.0)
101
111
  rspec (~> 3.0)
102
112
  rubocop (~> 1.26)
113
+ simplecov
114
+ simplecov-cobertura
103
115
 
104
116
  BUNDLED WITH
105
117
  2.2.25
data/README.md CHANGED
@@ -32,7 +32,8 @@ keycloack_client = Hydra::Keycloak::ClientCreator.call(
32
32
  secret: keycloak_config.fetch(:secret),
33
33
  logout_redirect: keycloak_config.fetch(:logout_redirect),
34
34
  store_client: 'redis',
35
- store_client_options: {redis_host: ENV['REDIS_HOST'], redis_port: ENV['REDIS_PORT']}
35
+ store_client_options: {redis_host: ENV['REDIS_HOST'], redis_port: ENV['REDIS_PORT']},
36
+ scope: ['hoper_scope', 'homs_scope']
36
37
  })
37
38
  ```
38
39
 
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = 'Keycloak client for SSO'
13
13
  spec.description = 'Keycloak client for SSO'
14
- spec.homepage = 'https://github.com/latera/hydra-keycloak-client'
14
+ spec.homepage = 'https://github.com/hydra-billing/hydra-keycloak-client'
15
15
  spec.required_ruby_version = Gem::Requirement.new('>= 2.5.8')
16
16
 
17
17
  spec.metadata['allowed_push_host'] = 'https://rubygems.org'
@@ -42,13 +42,14 @@ module Hydra
42
42
  required(:logout_redirect).filled(:string)
43
43
  required(:store_client).value(included_in?: %w[redis memcached])
44
44
  required(:store_client_options).hash(memcached_schema | redis_schema)
45
+ optional(:scope).array(:str?)
45
46
  end
46
47
  end
47
48
 
48
49
  def memcached_schema
49
50
  Dry::Schema.JSON do
50
51
  required(:memcached_host).filled(:string)
51
- required(:memcached_port).filled(:string)
52
+ required(:memcached_port).filled(:integer)
52
53
  required(:memcached_namespace).filled(:string)
53
54
  end
54
55
  end
@@ -56,7 +57,7 @@ module Hydra
56
57
  def redis_schema
57
58
  Dry::Schema.JSON do
58
59
  required(:redis_host).filled(:string)
59
- required(:redis_port).filled(:string)
60
+ required(:redis_port).filled(:integer)
60
61
  end
61
62
  end
62
63
 
@@ -3,6 +3,8 @@
3
3
  module Hydra
4
4
  module Keycloak
5
5
  class Urls
6
+ DEFAULT_SCOPE = ['openid'].freeze
7
+
6
8
  def initialize(config)
7
9
  @config = config
8
10
  end
@@ -14,7 +16,7 @@ module Hydra
14
16
  "client_id=#{@config[:client_id]}&" \
15
17
  "redirect_uri=#{@config[:redirect_uri]}&" \
16
18
  "nonce=#{@config[:secret]}&" \
17
- 'scope=openid&' \
19
+ "scope=#{scope}&" \
18
20
  "code_challenge=#{code_challenge}&" \
19
21
  'code_challenge_method=S256'
20
22
  end
@@ -59,9 +61,15 @@ module Hydra
59
61
  client_secret: @config[:secret],
60
62
  grant_type: 'refresh_token',
61
63
  refresh_token: refresh_token,
62
- scope: 'openid'
64
+ scope: scope
63
65
  }
64
66
  end
67
+
68
+ private
69
+
70
+ def scope
71
+ (DEFAULT_SCOPE + @config[:scope]).join('%20')
72
+ end
65
73
  end
66
74
  end
67
75
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Hydra
4
4
  module Keycloak
5
- VERSION = '0.1.10'
5
+ VERSION = '0.1.13'
6
6
  end
7
7
  end
data/run_tests.sh ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+
3
+ bundle exec rubocop --display-only-failed
4
+
5
+ bundle exec rspec
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hydra-keycloak-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fedor Kosolapov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-27 00:00:00.000000000 Z
11
+ date: 2022-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -104,6 +104,8 @@ extensions: []
104
104
  extra_rdoc_files: []
105
105
  files:
106
106
  - ".github/workflows/main.yml"
107
+ - ".gitignore"
108
+ - ".rspec"
107
109
  - ".rubocop.yml"
108
110
  - Dockerfile.test
109
111
  - Gemfile
@@ -126,13 +128,14 @@ files:
126
128
  - lib/hydra/keycloak/token.rb
127
129
  - lib/hydra/keycloak/urls.rb
128
130
  - lib/hydra/keycloak/version.rb
129
- homepage: https://github.com/latera/hydra-keycloak-client
131
+ - run_tests.sh
132
+ homepage: https://github.com/hydra-billing/hydra-keycloak-client
130
133
  licenses: []
131
134
  metadata:
132
135
  allowed_push_host: https://rubygems.org
133
- homepage_uri: https://github.com/latera/hydra-keycloak-client
134
- source_code_uri: https://github.com/latera/hydra-keycloak-client
135
- changelog_uri: https://github.com/latera/hydra-keycloak-client
136
+ homepage_uri: https://github.com/hydra-billing/hydra-keycloak-client
137
+ source_code_uri: https://github.com/hydra-billing/hydra-keycloak-client
138
+ changelog_uri: https://github.com/hydra-billing/hydra-keycloak-client
136
139
  post_install_message:
137
140
  rdoc_options: []
138
141
  require_paths:
@@ -148,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
151
  - !ruby/object:Gem::Version
149
152
  version: '0'
150
153
  requirements: []
151
- rubygems_version: 3.2.3
154
+ rubygems_version: 3.1.6
152
155
  signing_key:
153
156
  specification_version: 4
154
157
  summary: Keycloak client for SSO