omniauth-keycloak 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +29 -27
- data/README.md +41 -0
- data/lib/keycloak/version.rb +1 -1
- data/omniauth-keycloak.gemspec +4 -3
- metadata +9 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f523d3b03c2258b9b49ca70dd94a02e9104de24a6148ee2d0018c9d3301ffe0
|
4
|
+
data.tar.gz: 820eaba1eb35fce32c80a82293ab58ba1c154e307b191cce0b6a37b5888412d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de576c60d232f49150b0923ec1496c1e6ffdfafdb0fa3a85e3aa17d08952faacfd955a66d292dff352740965599720e645d3866b9d39f364d141bf686445a115
|
7
|
+
data.tar.gz: cdf8238793033678b6a348b11111d95ea5449b61d50a63fc1b109e302d4a2616fb0e979acbdef33e5709dd0c0eee6481c9225bba57f7dbaae4a9b42688478535
|
data/Gemfile.lock
CHANGED
@@ -1,59 +1,60 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
omniauth-keycloak (1.0
|
5
|
-
json-jwt (~> 1.
|
6
|
-
omniauth (~> 1.
|
7
|
-
omniauth-oauth2 (~> 1.
|
4
|
+
omniauth-keycloak (1.2.0)
|
5
|
+
json-jwt (~> 1.12)
|
6
|
+
omniauth (~> 1.9.0)
|
7
|
+
omniauth-oauth2 (~> 1.6.0)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (
|
12
|
+
activesupport (6.0.3.1)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
14
|
i18n (>= 0.7, < 2)
|
15
15
|
minitest (~> 5.1)
|
16
16
|
tzinfo (~> 1.1)
|
17
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
17
18
|
addressable (2.5.2)
|
18
19
|
public_suffix (>= 2.0.2, < 4.0)
|
19
20
|
aes_key_wrap (1.0.1)
|
20
|
-
bindata (2.4.
|
21
|
-
concurrent-ruby (1.1.
|
21
|
+
bindata (2.4.7)
|
22
|
+
concurrent-ruby (1.1.6)
|
22
23
|
crack (0.4.3)
|
23
24
|
safe_yaml (~> 1.0.0)
|
24
25
|
diff-lcs (1.3)
|
25
26
|
docile (1.3.1)
|
26
|
-
faraday (0.
|
27
|
+
faraday (1.0.1)
|
27
28
|
multipart-post (>= 1.2, < 3)
|
28
29
|
hashdiff (0.3.7)
|
29
|
-
hashie (
|
30
|
-
i18n (1.
|
30
|
+
hashie (4.1.0)
|
31
|
+
i18n (1.8.2)
|
31
32
|
concurrent-ruby (~> 1.0)
|
32
33
|
json (2.1.0)
|
33
|
-
json-jwt (1.
|
34
|
-
activesupport
|
34
|
+
json-jwt (1.12.0)
|
35
|
+
activesupport (>= 4.2)
|
35
36
|
aes_key_wrap
|
36
37
|
bindata
|
37
|
-
jwt (2.1
|
38
|
-
minitest (5.
|
39
|
-
multi_json (1.
|
38
|
+
jwt (2.2.1)
|
39
|
+
minitest (5.14.1)
|
40
|
+
multi_json (1.14.1)
|
40
41
|
multi_xml (0.6.0)
|
41
|
-
multipart-post (2.
|
42
|
-
oauth2 (1.4.
|
43
|
-
faraday (>= 0.8, <
|
42
|
+
multipart-post (2.1.1)
|
43
|
+
oauth2 (1.4.4)
|
44
|
+
faraday (>= 0.8, < 2.0)
|
44
45
|
jwt (>= 1.0, < 3.0)
|
45
46
|
multi_json (~> 1.3)
|
46
47
|
multi_xml (~> 0.5)
|
47
48
|
rack (>= 1.2, < 3)
|
48
|
-
omniauth (1.
|
49
|
-
hashie (>= 3.4.6
|
49
|
+
omniauth (1.9.1)
|
50
|
+
hashie (>= 3.4.6)
|
50
51
|
rack (>= 1.6.2, < 3)
|
51
|
-
omniauth-oauth2 (1.
|
52
|
+
omniauth-oauth2 (1.6.0)
|
52
53
|
oauth2 (~> 1.1)
|
53
|
-
omniauth (~> 1.
|
54
|
+
omniauth (~> 1.9)
|
54
55
|
public_suffix (3.0.3)
|
55
|
-
rack (2.
|
56
|
-
rake (
|
56
|
+
rack (2.2.2)
|
57
|
+
rake (13.0.1)
|
57
58
|
rspec (3.8.0)
|
58
59
|
rspec-core (~> 3.8.0)
|
59
60
|
rspec-expectations (~> 3.8.0)
|
@@ -74,12 +75,13 @@ GEM
|
|
74
75
|
simplecov-html (~> 0.10.0)
|
75
76
|
simplecov-html (0.10.2)
|
76
77
|
thread_safe (0.3.6)
|
77
|
-
tzinfo (1.2.
|
78
|
+
tzinfo (1.2.7)
|
78
79
|
thread_safe (~> 0.1)
|
79
80
|
webmock (3.4.2)
|
80
81
|
addressable (>= 2.3.6)
|
81
82
|
crack (>= 0.3.2)
|
82
83
|
hashdiff
|
84
|
+
zeitwerk (2.3.0)
|
83
85
|
|
84
86
|
PLATFORMS
|
85
87
|
ruby
|
@@ -87,10 +89,10 @@ PLATFORMS
|
|
87
89
|
DEPENDENCIES
|
88
90
|
bundler (~> 1.16)
|
89
91
|
omniauth-keycloak!
|
90
|
-
rake (~>
|
92
|
+
rake (~> 13.0)
|
91
93
|
rspec (~> 3.0)
|
92
94
|
simplecov (~> 0.16.1)
|
93
95
|
webmock (~> 3.4.2)
|
94
96
|
|
95
97
|
BUNDLED WITH
|
96
|
-
1.
|
98
|
+
2.1.4
|
data/README.md
CHANGED
@@ -29,6 +29,47 @@ Rails.application.config.middleware.use OmniAuth::Builder do
|
|
29
29
|
end
|
30
30
|
```
|
31
31
|
|
32
|
+
## Devise Usage
|
33
|
+
Adapted from [Devise OmniAuth Instructions](https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview)
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
# app/models/user.rb
|
37
|
+
class User < ApplicationRecord
|
38
|
+
#...
|
39
|
+
devise :omniauthable, omniauth_providers: %i[keycloakopenid]
|
40
|
+
#...
|
41
|
+
end
|
42
|
+
|
43
|
+
# config/initializers/devise.rb
|
44
|
+
config.omniauth :keycloak_openid, "Example-Client-Name", "example-secret-if-configured", client_options: { site: "https://example.keycloak-url.com", realm: "example-realm" }, :strategy_class => OmniAuth::Strategies::KeycloakOpenId
|
45
|
+
|
46
|
+
# Below controller assumes callback route configuration following
|
47
|
+
# in config/routes.rb
|
48
|
+
Devise.setup do |config|
|
49
|
+
# ...
|
50
|
+
devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }
|
51
|
+
end
|
52
|
+
|
53
|
+
# app/controllers/users/omniauth_callbacks_controller.rb
|
54
|
+
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
55
|
+
def keycloakopenid
|
56
|
+
Rails.logger.debug(request.env["omniauth.auth"])
|
57
|
+
@user = User.from_omniauth(request.env["omniauth.auth"])
|
58
|
+
if @user.persisted?
|
59
|
+
sign_in_and_redirect @user, event: :authentication
|
60
|
+
else
|
61
|
+
session["devise.keycloakopenid_data"] = request.env["omniauth.auth"]
|
62
|
+
redirect_to new_user_registration_url
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def failure
|
67
|
+
redirect_to root_path
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
```
|
72
|
+
|
32
73
|
## Contributing
|
33
74
|
|
34
75
|
Bug reports and pull requests are welcome on GitHub at https://github.com/ccrockett/omniauth-keycloak. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
data/lib/keycloak/version.rb
CHANGED
data/omniauth-keycloak.gemspec
CHANGED
@@ -5,7 +5,7 @@ Gem::Specification.new do |spec|
|
|
5
5
|
spec.authors = ["Cameron Crockett"]
|
6
6
|
spec.email = ["cameron.crockett@ccrockett.com"]
|
7
7
|
|
8
|
-
spec.description = %q{
|
8
|
+
spec.description = %q{Omniauth strategy for Keycloak}
|
9
9
|
spec.summary = spec.description
|
10
10
|
spec.homepage = "https://github.com/ccrockett/omniauth-keycloak"
|
11
11
|
spec.license = "MIT"
|
@@ -25,9 +25,10 @@ Gem::Specification.new do |spec|
|
|
25
25
|
|
26
26
|
spec.add_dependency "omniauth", "~> 1.9.0"
|
27
27
|
spec.add_dependency "omniauth-oauth2", "~> 1.6.0"
|
28
|
-
spec.add_dependency "json-jwt", "~> 1.
|
28
|
+
spec.add_dependency "json-jwt", "~> 1.12"
|
29
|
+
|
29
30
|
spec.add_development_dependency "bundler", "~> 1.16"
|
30
|
-
spec.add_development_dependency "rake", "~>
|
31
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
31
32
|
spec.add_development_dependency "rspec", "~> 3.0"
|
32
33
|
spec.add_development_dependency 'simplecov', '~> 0.16.1'
|
33
34
|
spec.add_development_dependency 'webmock', '~> 3.4.2'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-keycloak
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cameron Crockett
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: '1.12'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: '1.12'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '13.0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '13.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 3.4.2
|
125
|
-
description:
|
125
|
+
description: Omniauth strategy for Keycloak
|
126
126
|
email:
|
127
127
|
- cameron.crockett@ccrockett.com
|
128
128
|
executables: []
|
@@ -166,9 +166,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: 1.3.5
|
168
168
|
requirements: []
|
169
|
-
|
170
|
-
rubygems_version: 2.7.4
|
169
|
+
rubygems_version: 3.0.3
|
171
170
|
signing_key:
|
172
171
|
specification_version: 4
|
173
|
-
summary:
|
172
|
+
summary: Omniauth strategy for Keycloak
|
174
173
|
test_files: []
|