omniauth-ssl 0.1.0
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 +7 -0
- data/.gitignore +8 -0
- data/.travis.yml +7 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +92 -0
- data/LICENSE.txt +21 -0
- data/README.md +50 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/omniauth/ssl.rb +2 -0
- data/lib/omniauth/ssl/version.rb +5 -0
- data/lib/omniauth/strategies/ssl.rb +41 -0
- data/omniauth-ssl.gemspec +26 -0
- metadata +142 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 93365c80b524ab52899ca9affffaf65bc2785bda90949d60bc9fa2658efcef3e
|
4
|
+
data.tar.gz: e4cfd3d362544b798e5616fe3d1aac32f1d596c080c7e4a8b164599792e0a1a9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 520fb1c4c98d7963f5624416c5365bab43ab34c74aa90fe4a3c49800ecbe93050aed105dd158d63d57cea5dc9f3d5cbd1e933cb9dc129b98ec374b6c55b141be
|
7
|
+
data.tar.gz: 521486e3e47d1f20045f864f23eae8fa0d75a66f7aae7b336f37e17a8a333116064c22e55e24ae58046d1cdd86d0a54ac43131764898a07dc536f5d3b4f25606
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
omniauth-ssl (0.1.0)
|
5
|
+
omniauth
|
6
|
+
omniauth-oauth2
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
addressable (2.7.0)
|
12
|
+
public_suffix (>= 2.0.2, < 5.0)
|
13
|
+
crack (0.4.5)
|
14
|
+
rexml
|
15
|
+
diff-lcs (1.4.4)
|
16
|
+
docile (1.4.0)
|
17
|
+
faraday (1.4.2)
|
18
|
+
faraday-em_http (~> 1.0)
|
19
|
+
faraday-em_synchrony (~> 1.0)
|
20
|
+
faraday-excon (~> 1.1)
|
21
|
+
faraday-net_http (~> 1.0)
|
22
|
+
faraday-net_http_persistent (~> 1.1)
|
23
|
+
multipart-post (>= 1.2, < 3)
|
24
|
+
ruby2_keywords (>= 0.0.4)
|
25
|
+
faraday-em_http (1.0.0)
|
26
|
+
faraday-em_synchrony (1.0.0)
|
27
|
+
faraday-excon (1.1.0)
|
28
|
+
faraday-net_http (1.0.1)
|
29
|
+
faraday-net_http_persistent (1.1.0)
|
30
|
+
hashdiff (1.0.1)
|
31
|
+
hashie (4.1.0)
|
32
|
+
jwt (2.2.3)
|
33
|
+
multi_json (1.15.0)
|
34
|
+
multi_xml (0.6.0)
|
35
|
+
multipart-post (2.1.1)
|
36
|
+
oauth2 (1.4.7)
|
37
|
+
faraday (>= 0.8, < 2.0)
|
38
|
+
jwt (>= 1.0, < 3.0)
|
39
|
+
multi_json (~> 1.3)
|
40
|
+
multi_xml (~> 0.5)
|
41
|
+
rack (>= 1.2, < 3)
|
42
|
+
omniauth (2.0.4)
|
43
|
+
hashie (>= 3.4.6)
|
44
|
+
rack (>= 1.6.2, < 3)
|
45
|
+
rack-protection
|
46
|
+
omniauth-oauth2 (1.7.1)
|
47
|
+
oauth2 (~> 1.4)
|
48
|
+
omniauth (>= 1.9, < 3)
|
49
|
+
public_suffix (4.0.6)
|
50
|
+
rack (2.2.3)
|
51
|
+
rack-protection (2.1.0)
|
52
|
+
rack
|
53
|
+
rack-test (1.1.0)
|
54
|
+
rack (>= 1.0, < 3)
|
55
|
+
rexml (3.2.5)
|
56
|
+
rspec (3.10.0)
|
57
|
+
rspec-core (~> 3.10.0)
|
58
|
+
rspec-expectations (~> 3.10.0)
|
59
|
+
rspec-mocks (~> 3.10.0)
|
60
|
+
rspec-core (3.10.1)
|
61
|
+
rspec-support (~> 3.10.0)
|
62
|
+
rspec-expectations (3.10.1)
|
63
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
64
|
+
rspec-support (~> 3.10.0)
|
65
|
+
rspec-mocks (3.10.2)
|
66
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
67
|
+
rspec-support (~> 3.10.0)
|
68
|
+
rspec-support (3.10.2)
|
69
|
+
ruby2_keywords (0.0.4)
|
70
|
+
simplecov (0.21.2)
|
71
|
+
docile (~> 1.1)
|
72
|
+
simplecov-html (~> 0.11)
|
73
|
+
simplecov_json_formatter (~> 0.1)
|
74
|
+
simplecov-html (0.12.3)
|
75
|
+
simplecov_json_formatter (0.1.3)
|
76
|
+
webmock (3.13.0)
|
77
|
+
addressable (>= 2.3.6)
|
78
|
+
crack (>= 0.3.2)
|
79
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
80
|
+
|
81
|
+
PLATFORMS
|
82
|
+
ruby
|
83
|
+
|
84
|
+
DEPENDENCIES
|
85
|
+
omniauth-ssl!
|
86
|
+
rack-test
|
87
|
+
rspec (~> 3.5)
|
88
|
+
simplecov
|
89
|
+
webmock
|
90
|
+
|
91
|
+
BUNDLED WITH
|
92
|
+
1.17.3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 Dustin Ward
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# Omniauth::SSL
|
2
|
+
|
3
|
+
1. Add gem to Gemfile and bundle `gem "omniauth-ssl"`
|
4
|
+
2. Add the following ENV variables
|
5
|
+
|
6
|
+
```
|
7
|
+
OMNIAUTH_SSL_CLIENT_ID = ""
|
8
|
+
OMNIAUTH_SSL_CLIENT_SECRET = ""
|
9
|
+
OMNIAUTH_SSL_CLIENT_SCOPE = ""
|
10
|
+
OMNIAUTH_SSL_SITE = "http://127.0.0.1:3001"
|
11
|
+
OMNIAUTH_SSL_AUTHORIZE_URL = "http://127.0.0.1:3001/oauth2/authorize"
|
12
|
+
OMNIAUTH_SSL_TOKEN_URL = "http://127.0.0.1:3001/oauth2/token"
|
13
|
+
```
|
14
|
+
|
15
|
+
3. Add configuration to `config/initializers/omniauth.rb`
|
16
|
+
|
17
|
+
```
|
18
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
19
|
+
provider :ssl,
|
20
|
+
ENV["OMNIAUTH_SSL_CLIENT_ID"],
|
21
|
+
ENV["OMNIAUTH_SSL_CLIENT_SECRET"],
|
22
|
+
scope: ENV["OMNIAUTH_SSL_CLIENT_SCOPE"],
|
23
|
+
client_options: {
|
24
|
+
site: ENV["OMNIAUTH_SSL_SITE"],
|
25
|
+
authorize_url: ENV["OMNIAUTH_SSL_AUTHORIZE_URL"]
|
26
|
+
token_url: ENV["OMNIAUTH_SSL_TOKEN_URL"]
|
27
|
+
}
|
28
|
+
end
|
29
|
+
```
|
30
|
+
|
31
|
+
4. Add routes to your user sessions callback controller (will be unique depending on how your app is configured. you will need to change the to: paramaeters to match your app)
|
32
|
+
|
33
|
+
```
|
34
|
+
match "/auth/:provider/callback", to: "sessions#create", via:[:post, :get]
|
35
|
+
```
|
36
|
+
|
37
|
+
5. Redirect User to oauth server
|
38
|
+
|
39
|
+
```
|
40
|
+
= link_to "log in with SSL", "/auth/ssl", method: :post
|
41
|
+
```
|
42
|
+
|
43
|
+
6. Access the OmniAuth return and process login (You will need to create your custom logic here in rails to handle the token etc)
|
44
|
+
|
45
|
+
```
|
46
|
+
request.env['omniauth.auth']
|
47
|
+
request.env['omniauth.auth'].credentials.access_token
|
48
|
+
request.env['omniauth.auth'].credentials.refresh_token
|
49
|
+
request.env['omniauth.auth'].info
|
50
|
+
```
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "omniauth/ssl"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/omniauth/ssl.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require "omniauth-oauth2"
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class SSL < OmniAuth::Strategies::OAuth2
|
6
|
+
option :client_options, {
|
7
|
+
site: "http://login.ssl.com",
|
8
|
+
authorize_url: "https://login.ssl.com/oauth2/authorize",
|
9
|
+
token_url: "https://login.ssl.com/oauth2/token"
|
10
|
+
}
|
11
|
+
|
12
|
+
uid do
|
13
|
+
raw_info[0]["user"]["user_id"]
|
14
|
+
end
|
15
|
+
|
16
|
+
info do
|
17
|
+
{
|
18
|
+
user: {
|
19
|
+
user_id: raw_info[0]["user"]["user_id"],
|
20
|
+
user_email: raw_info[0]["user"]["user_email"],
|
21
|
+
username: raw_info[0]["user"]["username"],
|
22
|
+
ssl_account_id: raw_info[0]["user"]["ssl_account_id"],
|
23
|
+
},
|
24
|
+
client: {
|
25
|
+
id: raw_info[0]["client"]["id"],
|
26
|
+
}
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
extra do
|
31
|
+
{ raw_info: raw_info }
|
32
|
+
end
|
33
|
+
|
34
|
+
def raw_info
|
35
|
+
@raw_info ||= JWT.decode(access_token.token, nil, false, { algorithms: ['RS256']})
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
OmniAuth.config.add_camelization 'ssl', 'SSL'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "omniauth/ssl/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "omniauth-ssl"
|
8
|
+
spec.authors = ["Dustin Ward"]
|
9
|
+
spec.email = ["dustin.n.ward@gmail.com"]
|
10
|
+
spec.description = %q{Official OmniAuth strategy for SSL.com}
|
11
|
+
spec.summary = %q{Official OmniAuth strategy for SSL.com}
|
12
|
+
spec.homepage = "https://github.com/sslcom/omniauth-ssl"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
16
|
+
spec.files = `git ls-files`.split("\n")
|
17
|
+
spec.require_paths = ["lib"]
|
18
|
+
spec.version = OmniAuth::SSL::VERSION
|
19
|
+
|
20
|
+
spec.add_dependency 'omniauth'
|
21
|
+
spec.add_dependency 'omniauth-oauth2'
|
22
|
+
spec.add_development_dependency 'rspec', '~> 3.5'
|
23
|
+
spec.add_development_dependency 'rack-test'
|
24
|
+
spec.add_development_dependency 'simplecov'
|
25
|
+
spec.add_development_dependency 'webmock'
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-ssl
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dustin Ward
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-05-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: omniauth
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: omniauth-oauth2
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.5'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rack-test
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webmock
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Official OmniAuth strategy for SSL.com
|
98
|
+
email:
|
99
|
+
- dustin.n.ward@gmail.com
|
100
|
+
executables:
|
101
|
+
- console
|
102
|
+
- setup
|
103
|
+
extensions: []
|
104
|
+
extra_rdoc_files: []
|
105
|
+
files:
|
106
|
+
- ".gitignore"
|
107
|
+
- ".travis.yml"
|
108
|
+
- Gemfile
|
109
|
+
- Gemfile.lock
|
110
|
+
- LICENSE.txt
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- bin/console
|
114
|
+
- bin/setup
|
115
|
+
- lib/omniauth/ssl.rb
|
116
|
+
- lib/omniauth/ssl/version.rb
|
117
|
+
- lib/omniauth/strategies/ssl.rb
|
118
|
+
- omniauth-ssl.gemspec
|
119
|
+
homepage: https://github.com/sslcom/omniauth-ssl
|
120
|
+
licenses:
|
121
|
+
- MIT
|
122
|
+
metadata: {}
|
123
|
+
post_install_message:
|
124
|
+
rdoc_options: []
|
125
|
+
require_paths:
|
126
|
+
- lib
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
requirements: []
|
138
|
+
rubygems_version: 3.0.9
|
139
|
+
signing_key:
|
140
|
+
specification_version: 4
|
141
|
+
summary: Official OmniAuth strategy for SSL.com
|
142
|
+
test_files: []
|