omniauth-icalia 0.1.4
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/CODE_OF_CONDUCT.md +74 -0
- data/LICENSE.txt +21 -0
- data/README.md +99 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/icalia/stubbed_sso_service.rb +205 -0
- data/lib/omniauth-icalia.rb +2 -0
- data/lib/omniauth-icalia/service_stubs.rb +1 -0
- data/lib/omniauth-icalia/version.rb +5 -0
- data/lib/omniauth/strategies/icalia.rb +81 -0
- data/omniauth-icalia.gemspec +30 -0
- metadata +193 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4dfbfb47218190adfbee66c478cf9787d52b5de4ccea2f9d325c415553ed3ec8
|
4
|
+
data.tar.gz: 775e1514daa1c195234328daf2534a90b773f3ce27f75e390d743e03791b069a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 478333a7b552a4961d892e3088b8a86755743605124d8aed6897bfb366c3aadd6a93b205cf565ddbaf30d1ff4f5dd2f3a0c7ae587e839ab796ec45382fb50dcb
|
7
|
+
data.tar.gz: 2dd160af460ee9a27f54efca2e702ab2b3e3c86d571e8235ef301dfb3c40c938bdab3596b531289e69e15611f04ac48b983dc6114c34267657298335eaa84b36
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at TODO: Write your email address. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 TODO: Write your name
|
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,99 @@
|
|
1
|
+
# Omniauth::Icalia
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/omniauth/icalia`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'omniauth-icalia'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install omniauth-icalia
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## System Testing on your app
|
28
|
+
|
29
|
+
You can use the included service stub in your system tests.
|
30
|
+
|
31
|
+
On your spec_helper, or test setup file:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
require 'omniauth-icalia/service_stubs'
|
35
|
+
```
|
36
|
+
|
37
|
+
Then, in your test setup, call `prepare`:
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
# For example, in RSpec:
|
41
|
+
before { Icalia::StubbedSSOService.prepare }
|
42
|
+
|
43
|
+
# Use a block if you need to set the data returned by the service:
|
44
|
+
before do
|
45
|
+
Icalia::StubbedSSOService.prepare do |config|
|
46
|
+
# Optionally add example data about the expected token owner:
|
47
|
+
config.example_resource_owner_id = SecureRandom.uuid
|
48
|
+
config.example_resource_owner_given_name = 'George'
|
49
|
+
config.example_resource_owner_family_name = 'Harrison'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
```
|
53
|
+
|
54
|
+
If your'e testing a sign-in flow:
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
scenario 'sign-in' do
|
58
|
+
# Simulate that the user will sign-in at the SSO site:
|
59
|
+
Icalia::StubbedSSOService.sign_in_on_authorize
|
60
|
+
visit root_path # or any path in your app that requires authentication
|
61
|
+
|
62
|
+
#...
|
63
|
+
end
|
64
|
+
```
|
65
|
+
|
66
|
+
If your'e testing a sign-out flow:
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
scenario 'sign-out' do
|
70
|
+
# Simulate that the user will sign-in at the SSO site:
|
71
|
+
Icalia::StubbedSSOService.sign_in_on_authorize
|
72
|
+
visit root_path # or any path in your app that requires authentication
|
73
|
+
|
74
|
+
# Simulate that the user won't sign-in at the SSO site:
|
75
|
+
Icalia::StubbedSSOService.do_not_sign_in_on_authorize
|
76
|
+
click_link 'Logout'
|
77
|
+
|
78
|
+
# The message coming from Artanis & the Fake Artanis "StubbedSSOService":
|
79
|
+
expect(page).to have_content 'Signed out successfully.'
|
80
|
+
end
|
81
|
+
```
|
82
|
+
|
83
|
+
## Development
|
84
|
+
|
85
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
86
|
+
|
87
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
88
|
+
|
89
|
+
## Contributing
|
90
|
+
|
91
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/omniauth-icalia. 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.
|
92
|
+
|
93
|
+
## License
|
94
|
+
|
95
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
96
|
+
|
97
|
+
## Code of Conduct
|
98
|
+
|
99
|
+
Everyone interacting in the Omniauth::Icalia project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/omniauth-icalia/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "omniauth/icalia"
|
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
@@ -0,0 +1,205 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
|
3
|
+
require 'capybara'
|
4
|
+
require 'capybara/server'
|
5
|
+
|
6
|
+
require 'socket'
|
7
|
+
|
8
|
+
module Icalia
|
9
|
+
class StubbedSSOService < Sinatra::Base
|
10
|
+
FIND_AVAILABLE_PORT = 0
|
11
|
+
CODE = 'icalia_oauth_authorization_code'.freeze
|
12
|
+
|
13
|
+
@@sign_in_user_on_authorize = false
|
14
|
+
|
15
|
+
post '/oauth/token' do
|
16
|
+
if params[:code] == CODE
|
17
|
+
response.headers['Content-Type'] = 'application/json'
|
18
|
+
flow = oauth_flows.last
|
19
|
+
data = flow.slice('state').merge(
|
20
|
+
access_token: 'ACCESS_TOKEN',
|
21
|
+
token_type: 'Bearer',
|
22
|
+
created_at: DateTime.now.to_i
|
23
|
+
)
|
24
|
+
flow[:granted_access_data] = data
|
25
|
+
data.to_json
|
26
|
+
else
|
27
|
+
status 400
|
28
|
+
{
|
29
|
+
error: 'invalid_grant',
|
30
|
+
error_description: "Authorization code does not exist: #{code}",
|
31
|
+
}.to_json
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
get '/sign-in' do
|
36
|
+
'Signed out successfully.'
|
37
|
+
end
|
38
|
+
|
39
|
+
get '/sign-out' do
|
40
|
+
uri = URI(params[:redirect_uri])
|
41
|
+
redirect uri
|
42
|
+
end
|
43
|
+
|
44
|
+
get '/oauth/authorize' do
|
45
|
+
return redirect '/sign-in' unless @@sign_in_user_on_authorize
|
46
|
+
|
47
|
+
store_oauth_flow_data params
|
48
|
+
uri = URI(params[:redirect_uri])
|
49
|
+
uri.query = URI.encode_www_form(state: params[:state], code: CODE)
|
50
|
+
redirect uri
|
51
|
+
end
|
52
|
+
|
53
|
+
get '/oauth/token/info' do
|
54
|
+
flow = oauth_flows.last
|
55
|
+
data = {
|
56
|
+
data: {
|
57
|
+
id: SecureRandom.uuid,
|
58
|
+
type: 'oauth-access-token',
|
59
|
+
attributes: {
|
60
|
+
scopes: [],
|
61
|
+
'expires-at': nil,
|
62
|
+
'created-at': Time.at(flow.dig(:granted_access_data, :created_at))
|
63
|
+
},
|
64
|
+
relationships: {
|
65
|
+
'resource-owner': {
|
66
|
+
data: { type: 'person', id: example_resource_owner_id }
|
67
|
+
}
|
68
|
+
}
|
69
|
+
},
|
70
|
+
included: [
|
71
|
+
{
|
72
|
+
type: 'person',
|
73
|
+
id: example_resource_owner_id,
|
74
|
+
attributes: {
|
75
|
+
'full-name': example_resource_owner_full_name,
|
76
|
+
'given-name': example_resource_owner_given_name,
|
77
|
+
'family-name': example_resource_owner_family_name,
|
78
|
+
'gender-type': example_resource_owner_gender_type,
|
79
|
+
'custom-gender': example_resource_owner_custom_gender
|
80
|
+
}
|
81
|
+
}
|
82
|
+
]
|
83
|
+
}
|
84
|
+
response.headers['Content-Type'] = 'application/vnd.api+json'
|
85
|
+
data.to_json
|
86
|
+
end
|
87
|
+
|
88
|
+
%i[example_resource_owner_id example_resource_owner_given_name
|
89
|
+
example_resource_owner_family_name example_resource_owner_gender_type
|
90
|
+
example_resource_owner_custom_gender].each do |method_name|
|
91
|
+
define_singleton_method method_name do
|
92
|
+
class_variable_get("@@#{method_name}")
|
93
|
+
end
|
94
|
+
|
95
|
+
define_singleton_method "#{method_name}=".to_sym do |value|
|
96
|
+
class_variable_set("@@#{method_name}", value)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
%i[oauth_flows store_oauth_flow_data example_resource_owner_id
|
101
|
+
example_resource_owner_given_name example_resource_owner_family_name
|
102
|
+
example_resource_owner_gender_type example_resource_owner_full_name
|
103
|
+
example_resource_owner_custom_gender].each do |method_name|
|
104
|
+
define_method method_name do |*args|
|
105
|
+
self.class.public_send method_name, *args
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
class << self
|
110
|
+
def oauth_flows
|
111
|
+
@oauth_flows ||= []
|
112
|
+
end
|
113
|
+
|
114
|
+
def reset
|
115
|
+
oauth_flows.clear
|
116
|
+
|
117
|
+
self.example_resource_owner_id = SecureRandom.uuid
|
118
|
+
self.example_resource_owner_given_name = 'Example Person'
|
119
|
+
self.example_resource_owner_family_name = 'From Artanis'
|
120
|
+
self.example_resource_owner_gender_type = 'male'
|
121
|
+
self.example_resource_owner_custom_gender = nil
|
122
|
+
end
|
123
|
+
|
124
|
+
def example_resource_owner_full_name
|
125
|
+
[example_resource_owner_given_name, example_resource_owner_family_name]
|
126
|
+
.compact.join(' ').strip
|
127
|
+
end
|
128
|
+
|
129
|
+
def store_oauth_flow_data(data)
|
130
|
+
oauth_flows << data
|
131
|
+
end
|
132
|
+
|
133
|
+
def url
|
134
|
+
"http://localhost:#{server_port}"
|
135
|
+
end
|
136
|
+
|
137
|
+
def sign_in_url
|
138
|
+
"#{url}/sign-in"
|
139
|
+
end
|
140
|
+
|
141
|
+
# Taken from FakeStripe.stub_stripe at fake_stripe gem:
|
142
|
+
def prepare
|
143
|
+
reset
|
144
|
+
|
145
|
+
yield self if block_given?
|
146
|
+
|
147
|
+
# Since the OAuth flow is performed by the browser, we'll need to boot
|
148
|
+
# the Sinatra app instead of just stubbing the app with WebMock...
|
149
|
+
boot_once
|
150
|
+
|
151
|
+
OmniAuth::Strategies::Icalia.instances.each do |strategy|
|
152
|
+
strategy.options.client_options.tap do |options|
|
153
|
+
options.site = url
|
154
|
+
options.token_url = "#{oauth_host}/oauth/token"
|
155
|
+
options.authorize_url = "#{oauth_host}/oauth/authorize"
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
def sign_in_on_authorize
|
161
|
+
@@sign_in_user_on_authorize = true
|
162
|
+
end
|
163
|
+
|
164
|
+
def do_not_sign_in_on_authorize
|
165
|
+
@@sign_in_user_on_authorize = false
|
166
|
+
end
|
167
|
+
|
168
|
+
def teardown
|
169
|
+
default_client_options = OmniAuth::Strategies::Icalia
|
170
|
+
.default_options
|
171
|
+
.client_options
|
172
|
+
|
173
|
+
OmniAuth::Strategies::Icalia.instances.each do |strategy|
|
174
|
+
strategy.options.client_options.tap do |options|
|
175
|
+
options.site = default_client_options.site
|
176
|
+
options.token_url = default_client_options.token_url
|
177
|
+
options.authorize_url = default_client_options.authorize_url
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
# Taken from FakeStripe::Utils at fake_stripe gem: =======================
|
183
|
+
def find_available_port
|
184
|
+
server = TCPServer.new(FIND_AVAILABLE_PORT)
|
185
|
+
server.addr[1]
|
186
|
+
ensure
|
187
|
+
server.close if server
|
188
|
+
end
|
189
|
+
|
190
|
+
# Taken from Bootable at fake_stripe gem: ================================
|
191
|
+
def boot(port = find_available_port)
|
192
|
+
instance = new
|
193
|
+
Capybara::Server.new(instance, port: port).tap(&:boot)
|
194
|
+
end
|
195
|
+
|
196
|
+
def boot_once
|
197
|
+
@boot_once ||= boot(server_port)
|
198
|
+
end
|
199
|
+
|
200
|
+
def server_port
|
201
|
+
@server_port ||= find_available_port
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'icalia/stubbed_sso_service'
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
require 'icalia-sdk-event-core'
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
class Icalia < OmniAuth::Strategies::OAuth2
|
7
|
+
INFO_PATH = '/oauth/token/info?include=resource-owner.email-accounts'
|
8
|
+
|
9
|
+
option :client_options, {
|
10
|
+
site: 'https://artanis.icalialabs.com',
|
11
|
+
token_url: 'https://artanis.icalialabs.com/oauth/token',
|
12
|
+
authorize_url: 'https://artanis.icalialabs.com/oauth/authorize'
|
13
|
+
}
|
14
|
+
|
15
|
+
@@instances = []
|
16
|
+
|
17
|
+
def self.instances
|
18
|
+
class_variable_get('@@instances')
|
19
|
+
end
|
20
|
+
|
21
|
+
def initialize(*args)
|
22
|
+
ret = super
|
23
|
+
@@instances << self
|
24
|
+
ret
|
25
|
+
end
|
26
|
+
|
27
|
+
def request_phase
|
28
|
+
super
|
29
|
+
end
|
30
|
+
|
31
|
+
def authorize_params
|
32
|
+
super.tap do |params|
|
33
|
+
%w[scope client_options].each do |v|
|
34
|
+
if request.params[v]
|
35
|
+
params[v.to_sym] = request.params[v]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
uid { raw_info.resource_owner.id.to_s }
|
42
|
+
|
43
|
+
info do
|
44
|
+
personal_info = raw_info.resource_owner
|
45
|
+
{
|
46
|
+
'full_name' => personal_info.full_name,
|
47
|
+
'given_name' => personal_info.given_name,
|
48
|
+
'family_name' => personal_info.family_name,
|
49
|
+
'gender_type' => personal_info.gender_type,
|
50
|
+
'custom_gender' => personal_info.custom_gender,
|
51
|
+
'date_of_birth' => personal_info.date_of_birth
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
extra do
|
56
|
+
{ raw_info: raw_info, scope: scope }
|
57
|
+
end
|
58
|
+
|
59
|
+
def raw_info
|
60
|
+
access_token.options[:mode] = :header
|
61
|
+
@raw_info ||= fetch_user_info
|
62
|
+
end
|
63
|
+
|
64
|
+
def scope
|
65
|
+
access_token['scope']
|
66
|
+
end
|
67
|
+
|
68
|
+
def callback_url
|
69
|
+
full_host + script_name + callback_path
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
def fetch_user_info
|
75
|
+
response_body = access_token.get(INFO_PATH).body
|
76
|
+
raw_data = ActiveSupport::JSON.decode(response_body)
|
77
|
+
::Icalia::Event::Deserializer.new(raw_data).perform
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'omniauth-icalia/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.authors = ['Roberto Quintanilla']
|
8
|
+
spec.email = ['vov@icalialabs.com']
|
9
|
+
spec.description = %q{Official Omniauth Strategy for Icalia.}
|
10
|
+
spec.summary = %q{Official Omniauth Strategy for Icalia.}
|
11
|
+
spec.homepage = 'https://github.com/IcaliaLabs/omniauth-icalia'
|
12
|
+
spec.license = 'MIT'
|
13
|
+
|
14
|
+
spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
15
|
+
spec.files = `git ls-files -- lib/* *.md *.gemspec *.txt Rakefile`.split("\n")
|
16
|
+
spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
spec.name = 'omniauth-icalia'
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
spec.version = Omniauth::Icalia::VERSION
|
20
|
+
|
21
|
+
spec.add_dependency 'omniauth', '~> 1.5'
|
22
|
+
spec.add_dependency 'omniauth-oauth2', '>= 1.4.0', '< 2.0'
|
23
|
+
spec.add_dependency 'icalia-sdk-event-core', '~> 0.3', '>= 0.3.5'
|
24
|
+
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.17'
|
26
|
+
spec.add_development_dependency 'capybara', '~> 3.0', '>= 3.0.0'
|
27
|
+
spec.add_development_dependency 'sinatra', '~> 2.0', '>= 2.0.0'
|
28
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,193 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-icalia
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Roberto Quintanilla
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-02-29 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: '1.5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
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: 1.4.0
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '2.0'
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.4.0
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '2.0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: icalia-sdk-event-core
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0.3'
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 0.3.5
|
57
|
+
type: :runtime
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0.3'
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 0.3.5
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: bundler
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - "~>"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '1.17'
|
74
|
+
type: :development
|
75
|
+
prerelease: false
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - "~>"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '1.17'
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: capybara
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 3.0.0
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '3.0'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: 3.0.0
|
98
|
+
- - "~>"
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '3.0'
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: sinatra
|
103
|
+
requirement: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: 2.0.0
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '2.0'
|
111
|
+
type: :development
|
112
|
+
prerelease: false
|
113
|
+
version_requirements: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 2.0.0
|
118
|
+
- - "~>"
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '2.0'
|
121
|
+
- !ruby/object:Gem::Dependency
|
122
|
+
name: rake
|
123
|
+
requirement: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - "~>"
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '13.0'
|
128
|
+
type: :development
|
129
|
+
prerelease: false
|
130
|
+
version_requirements: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - "~>"
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '13.0'
|
135
|
+
- !ruby/object:Gem::Dependency
|
136
|
+
name: rspec
|
137
|
+
requirement: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - "~>"
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '3.0'
|
142
|
+
type: :development
|
143
|
+
prerelease: false
|
144
|
+
version_requirements: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - "~>"
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '3.0'
|
149
|
+
description: Official Omniauth Strategy for Icalia.
|
150
|
+
email:
|
151
|
+
- vov@icalialabs.com
|
152
|
+
executables:
|
153
|
+
- console
|
154
|
+
- setup
|
155
|
+
extensions: []
|
156
|
+
extra_rdoc_files: []
|
157
|
+
files:
|
158
|
+
- CODE_OF_CONDUCT.md
|
159
|
+
- LICENSE.txt
|
160
|
+
- README.md
|
161
|
+
- Rakefile
|
162
|
+
- bin/console
|
163
|
+
- bin/setup
|
164
|
+
- lib/icalia/stubbed_sso_service.rb
|
165
|
+
- lib/omniauth-icalia.rb
|
166
|
+
- lib/omniauth-icalia/service_stubs.rb
|
167
|
+
- lib/omniauth-icalia/version.rb
|
168
|
+
- lib/omniauth/strategies/icalia.rb
|
169
|
+
- omniauth-icalia.gemspec
|
170
|
+
homepage: https://github.com/IcaliaLabs/omniauth-icalia
|
171
|
+
licenses:
|
172
|
+
- MIT
|
173
|
+
metadata: {}
|
174
|
+
post_install_message:
|
175
|
+
rdoc_options: []
|
176
|
+
require_paths:
|
177
|
+
- lib
|
178
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
179
|
+
requirements:
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '0'
|
183
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
requirements: []
|
189
|
+
rubygems_version: 3.0.3
|
190
|
+
signing_key:
|
191
|
+
specification_version: 4
|
192
|
+
summary: Official Omniauth Strategy for Icalia.
|
193
|
+
test_files: []
|