omniauth-osso 0.1.0 → 0.1.5

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: 1d06f1431dfda1ada1148f0bab1f236e31c80ed15e3e3050f1938f30dd508e9e
4
- data.tar.gz: c12528d4977371f2d235cb4abcf7630655fb87efd64a4e940cf189d02adb2c5d
3
+ metadata.gz: b0103d6e8c37362ce1b7280de5ebfd9ee2c7fcb38fb27b7625990cbc880707d8
4
+ data.tar.gz: 166b30efdda9703dbe1b9d9b1162d076404eb3235972219e7eb793a06f0c12f2
5
5
  SHA512:
6
- metadata.gz: fca2e07d268d7d06f4146ec7cc1ddef34cf13480853e6900d5da33fa445e8512cdb222fc32d30636e9ec682df52a5802d7b8509040a4008102f41179198b153c
7
- data.tar.gz: 75b3acc3b3c4af7d898e4f974295ef7d6884fd2b3d661fd3de3352d28af9524d02a250630898bd88f949c2f23d4cfbe372a80227eb08b108de07a2d4c5c2311c
6
+ metadata.gz: 7fee3a7e97f1d37c9e3b5ae94ce82939dcd71c9b9e1c39d2bb9b08516e9e37cb040a96e432ce3845126fa8f3a1e02ec049a616b519a7905ef39aa1d70c4339e8
7
+ data.tar.gz: dc3e14fbc609efac8ea657fcfecffd9454eb88b60eb244de699bc40097e3eb1785fbabbc4dfdb1d40ff6e97cba8362fe7539510bd1e04ab63ee755c53f8f148e
@@ -0,0 +1,9 @@
1
+ #!/bin/bash
2
+
3
+ set -eu
4
+
5
+ echo '--- RBENV'
6
+
7
+ export PATH="$HOME/.rbenv/bin:$PATH"
8
+
9
+ eval "$(rbenv init -)"
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+
3
+ set -eu
4
+
5
+ export PATH="$HOME/.rbenv/bin:$PATH"
6
+
7
+ eval "$(rbenv init -)"
@@ -0,0 +1,17 @@
1
+ steps:
2
+ - name: ":rspec:"
3
+ commands:
4
+ - bundle install
5
+ - bundle exec rspec
6
+
7
+ - name: "rubocop :male-police-officer:"
8
+ commands:
9
+ - bundle install
10
+ - bundle exec rubocop
11
+
12
+ - block: ":rubygems: Publish :red_button:"
13
+ branches: "main"
14
+
15
+ - name: "Push :rubygems:"
16
+ commands: "./bin/publish"
17
+ branches: "main"
data/.gitignore CHANGED
@@ -6,3 +6,4 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ *.gem
@@ -5,6 +5,10 @@ Metrics/BlockLength:
5
5
  Exclude:
6
6
  - 'spec/**/*'
7
7
 
8
+ Naming/FileName:
9
+ Exclude:
10
+ - 'lib/omniauth-osso.rb'
11
+
8
12
  Style/Documentation:
9
13
  Exclude:
10
14
  - 'spec/**/*'
@@ -0,0 +1,130 @@
1
+
2
+ # Contributor Covenant Code of Conduct
3
+
4
+ ## Our Pledge
5
+
6
+ We as members, contributors, and leaders pledge to make participation in our
7
+ community a harassment-free experience for everyone, regardless of age, body
8
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
9
+ identity and expression, level of experience, education, socio-economic status,
10
+ nationality, personal appearance, race, religion, or sexual identity
11
+ and orientation.
12
+
13
+ We pledge to act and interact in ways that contribute to an open, welcoming,
14
+ diverse, inclusive, and healthy community.
15
+
16
+ ## Our Standards
17
+
18
+ Examples of behavior that contributes to a positive environment for our
19
+ community include:
20
+
21
+ * Demonstrating empathy and kindness toward other people
22
+ * Being respectful of differing opinions, viewpoints, and experiences
23
+ * Giving and gracefully accepting constructive feedback
24
+ * Accepting responsibility and apologizing to those affected by our mistakes,
25
+ and learning from the experience
26
+ * Focusing on what is best not just for us as individuals, but for the
27
+ overall community
28
+
29
+ Examples of unacceptable behavior include:
30
+
31
+ * The use of sexualized language or imagery, and sexual attention or
32
+ advances of any kind
33
+ * Trolling, insulting or derogatory comments, and personal or political attacks
34
+ * Public or private harassment
35
+ * Publishing others' private information, such as a physical or email
36
+ address, without their explicit permission
37
+ * Other conduct which could reasonably be considered inappropriate in a
38
+ professional setting
39
+
40
+ ## Enforcement Responsibilities
41
+
42
+ Community leaders are responsible for clarifying and enforcing our standards of
43
+ acceptable behavior and will take appropriate and fair corrective action in
44
+ response to any behavior that they deem inappropriate, threatening, offensive,
45
+ or harmful.
46
+
47
+ Community leaders have the right and responsibility to remove, edit, or reject
48
+ comments, commits, code, wiki edits, issues, and other contributions that are
49
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
50
+ decisions when appropriate.
51
+
52
+ ## Scope
53
+
54
+ This Code of Conduct applies within all community spaces, and also applies when
55
+ an individual is officially representing the community in public spaces.
56
+ Examples of representing our community include using an official e-mail address,
57
+ posting via an official social media account, or acting as an appointed
58
+ representative at an online or offline event.
59
+
60
+ ## Enforcement
61
+
62
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
63
+ reported to the community leaders responsible for enforcement at
64
+ sbauch@gmail.com.
65
+ All complaints will be reviewed and investigated promptly and fairly.
66
+
67
+ All community leaders are obligated to respect the privacy and security of the
68
+ reporter of any incident.
69
+
70
+ ## Enforcement Guidelines
71
+
72
+ Community leaders will follow these Community Impact Guidelines in determining
73
+ the consequences for any action they deem in violation of this Code of Conduct:
74
+
75
+ ### 1. Correction
76
+
77
+ **Community Impact**: Use of inappropriate language or other behavior deemed
78
+ unprofessional or unwelcome in the community.
79
+
80
+ **Consequence**: A private, written warning from community leaders, providing
81
+ clarity around the nature of the violation and an explanation of why the
82
+ behavior was inappropriate. A public apology may be requested.
83
+
84
+ ### 2. Warning
85
+
86
+ **Community Impact**: A violation through a single incident or series
87
+ of actions.
88
+
89
+ **Consequence**: A warning with consequences for continued behavior. No
90
+ interaction with the people involved, including unsolicited interaction with
91
+ those enforcing the Code of Conduct, for a specified period of time. This
92
+ includes avoiding interactions in community spaces as well as external channels
93
+ like social media. Violating these terms may lead to a temporary or
94
+ permanent ban.
95
+
96
+ ### 3. Temporary Ban
97
+
98
+ **Community Impact**: A serious violation of community standards, including
99
+ sustained inappropriate behavior.
100
+
101
+ **Consequence**: A temporary ban from any sort of interaction or public
102
+ communication with the community for a specified period of time. No public or
103
+ private interaction with the people involved, including unsolicited interaction
104
+ with those enforcing the Code of Conduct, is allowed during this period.
105
+ Violating these terms may lead to a permanent ban.
106
+
107
+ ### 4. Permanent Ban
108
+
109
+ **Community Impact**: Demonstrating a pattern of violation of community
110
+ standards, including sustained inappropriate behavior, harassment of an
111
+ individual, or aggression toward or disparagement of classes of individuals.
112
+
113
+ **Consequence**: A permanent ban from any sort of public interaction within
114
+ the community.
115
+
116
+ ## Attribution
117
+
118
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119
+ version 2.0, available at
120
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
121
+
122
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
123
+ enforcement ladder](https://github.com/mozilla/diversity).
124
+
125
+ [homepage]: https://www.contributor-covenant.org
126
+
127
+ For answers to common questions about this code of conduct, see the FAQ at
128
+ https://www.contributor-covenant.org/faq. Translations are available at
129
+ https://www.contributor-covenant.org/translations.
130
+
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omniauth-osso (0.1.0)
4
+ omniauth-osso (0.1.5)
5
5
  omniauth-oauth2 (~> 1.6.0)
6
6
 
7
7
  GEM
@@ -21,7 +21,7 @@ GEM
21
21
  jaro_winkler (1.5.4)
22
22
  jwt (2.2.1)
23
23
  method_source (1.0.0)
24
- multi_json (1.14.1)
24
+ multi_json (1.15.0)
25
25
  multi_xml (0.6.0)
26
26
  multipart-post (2.1.1)
27
27
  oauth2 (1.4.4)
data/LICENSE ADDED
@@ -0,0 +1,111 @@
1
+ Business Source License 1.1
2
+
3
+ Parameters
4
+
5
+ Licensor: Samuel Bauch
6
+ Licensed Work: omniauth-osso
7
+ The Licensed Work is (c) 2020 Samuel Bauch.
8
+ Additional Use Grant: You may make use of the Licensed Work, provided that you do
9
+ not use the Licensed Work in a Single Sign On Management
10
+ Service.
11
+
12
+ A "Single Sign On Management Service" is an offering
13
+ (be it free or commercial) that uses the Licensed Work
14
+ to allow third parties (other than your employees and
15
+ contractors) to access the functionality of the
16
+ Licensed Work such that any fourth parties directly
17
+ benefit from the authentication, configuration, or
18
+ documentation features of the Licensed Work.
19
+
20
+ You thus may only use the Licensed Work in a manner
21
+ whereby parties who directly benefit from the
22
+ authentication, configuration, or documentation features
23
+ of the Licensed Work are yourself, your employees or
24
+ contractors, and your customers or partners.
25
+
26
+ Change Date: 2023-05-01
27
+
28
+ Change License: Apache License, Version 2.0
29
+
30
+ For information about alternative licensing arrangements for the Software,
31
+ contact: hello@enterprise-oss.dev
32
+
33
+ Notice
34
+
35
+ The Business Source License (this document, or the "License") is not an Open
36
+ Source license. However, the Licensed Work will eventually be made available
37
+ under an Open Source License, as stated in this License.
38
+
39
+ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
40
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
41
+
42
+ -----------------------------------------------------------------------------
43
+
44
+ Business Source License 1.1
45
+
46
+ Terms
47
+
48
+ The Licensor hereby grants you the right to copy, modify, create derivative
49
+ works, redistribute, and make non-production use of the Licensed Work. The
50
+ Licensor may make an Additional Use Grant, above, permitting limited
51
+ production use.
52
+
53
+ Effective on the Change Date, or the fourth anniversary of the first publicly
54
+ available distribution of a specific version of the Licensed Work under this
55
+ License, whichever comes first, the Licensor hereby grants you rights under
56
+ the terms of the Change License, and the rights granted in the paragraph
57
+ above terminate.
58
+
59
+ If your use of the Licensed Work does not comply with the requirements
60
+ currently in effect as described in this License, you must purchase a
61
+ commercial license from the Licensor, its affiliated entities, or authorized
62
+ resellers, or you must refrain from using the Licensed Work.
63
+
64
+ All copies of the original and modified Licensed Work, and derivative works
65
+ of the Licensed Work, are subject to this License. This License applies
66
+ separately for each version of the Licensed Work and the Change Date may vary
67
+ for each version of the Licensed Work released by Licensor.
68
+
69
+ You must conspicuously display this License on each original or modified copy
70
+ of the Licensed Work. If you receive the Licensed Work in original or
71
+ modified form from a third party, the terms and conditions set forth in this
72
+ License apply to your use of that work.
73
+
74
+ Any use of the Licensed Work in violation of this License will automatically
75
+ terminate your rights under this License for the current and all other
76
+ versions of the Licensed Work.
77
+
78
+ This License does not grant you any right in any trademark or logo of
79
+ Licensor or its affiliates (provided that you may use a trademark or logo of
80
+ Licensor as expressly required by this License).
81
+
82
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
83
+ AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
84
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
85
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
86
+ TITLE.
87
+
88
+ MariaDB hereby grants you permission to use this License’s text to license
89
+ your works, and to refer to it using the trademark "Business Source License",
90
+ as long as you comply with the Covenants of Licensor below.
91
+
92
+ Covenants of Licensor
93
+
94
+ In consideration of the right to use this License’s text and the "Business
95
+ Source License" name and trademark, Licensor covenants to MariaDB, and to all
96
+ other recipients of the licensed work to be provided by Licensor:
97
+
98
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
99
+ or a license that is compatible with GPL Version 2.0 or a later version,
100
+ where "compatible" means that software provided under the Change License can
101
+ be included in a program with software provided under GPL Version 2.0 or a
102
+ later version. Licensor may specify additional Change Licenses without
103
+ limitation.
104
+
105
+ 2. To either: (a) specify an additional grant of rights to use that does not
106
+ impose any additional restriction on the right granted in this License, as
107
+ the Additional Use Grant; or (b) insert the text "None".
108
+
109
+ 3. To specify a Change Date.
110
+
111
+ 4. Not to modify this License in any other way.
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'bundler/setup'
5
- require 'omniauth_osso'
5
+ require 'omniauth-osso'
6
6
 
7
7
  require 'irb'
8
8
  IRB.start(__FILE__)
@@ -0,0 +1,18 @@
1
+ #!/bin/sh
2
+ # Scriptacular - gemify.sh
3
+ # Create a Ruby gem and push it to rubygems.org
4
+ # Copyright 2013 Christopher Simpkins
5
+ # MIT License
6
+
7
+ GEM_NAME="omniauth-osso"
8
+ GEMSPEC_SUFFIX=".gemspec"
9
+
10
+ # run the gem build and parse for the gem release filename
11
+ GEM_BUILD_NAME=$(gem build "$GEM_NAME$GEMSPEC_SUFFIX" | awk '/File/ {print $2}' -)
12
+
13
+ if [ -z "$GEM_BUILD_NAME" ]; then
14
+ echo "The gem build failed." >&2
15
+ exit 1
16
+ fi
17
+
18
+ gem push $GEM_BUILD_NAME
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module Osso
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.5'
6
6
  end
7
7
  end
@@ -1,38 +1,35 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'omniauth-oauth2'
4
- require 'pry'
5
4
 
6
5
  module OmniAuth
7
6
  module Strategies
8
7
  # The main source for the Osso Omniauth Strategy
9
8
  class Osso < OmniAuth::Strategies::OAuth2
10
- include OmniAuth::Strategy
9
+ attr_accessor :env
11
10
 
12
11
  option :name, 'osso'
13
12
  option :client_id, nil
14
13
  option :client_secret, nil
15
- option :client_options, { site: ENV['OSSO_BASE_URL'] }
16
- option :authorize_params, { state: SecureRandom.hex(24) }
17
- option :authorize_options, %i[state domain]
18
- option :token_params, {}
19
- option :token_options, []
20
- option :auth_token_params, {}
14
+ option :authorize_options, %i[state]
21
15
  option :provider_ignores_state, false
22
16
 
23
- def authorize_params
24
- params = options.authorize_params.merge(options_for('authorize')) || {}
25
-
26
- raise StandardError if params[:domain].nil?
27
-
28
- if OmniAuth.config.test_mode
29
- @env ||= {}
30
- @env['rack.session'] ||= {}
31
- end
32
-
33
- session['omniauth.state'] = params[:state]
17
+ def request_phase
18
+ redirect(
19
+ client
20
+ .auth_code
21
+ .authorize_url(
22
+ request_params
23
+ .merge(authorize_params)
24
+ )
25
+ )
26
+ end
34
27
 
35
- params
28
+ def request_params
29
+ {
30
+ redirect_uri: callback_url,
31
+ domain: request_domain
32
+ }
36
33
  end
37
34
 
38
35
  uid { raw_info['id'] }
@@ -53,16 +50,49 @@ module OmniAuth
53
50
  @raw_info ||= access_token.get("/oauth/me?access_token=#{access_token.token}").parsed
54
51
  end
55
52
 
56
- protected
53
+ def callback_phase # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
54
+ error = request.params['error_reason'] || request.params['error']
57
55
 
58
- def options_for(option)
59
- options_for = options.send(:"#{option}_options")
60
- params_for = options.send(:"#{option}_params")
56
+ if error
57
+ fail!(
58
+ error,
59
+ CallbackError.new(
60
+ request.params['error'], request.params['error_description'] ||
61
+ request.params['error_reason'], request.params['error_uri']
62
+ )
63
+ )
64
+ elsif request.params['state'] != 'IDP_INITIATED' &&
65
+ request.params['state'] != session.delete('omniauth.state')
61
66
 
62
- options_for.each_with_object({}) do |key, hash|
63
- value = params_for[key] || options[key]
64
- hash[key.to_sym] = value.respond_to?(:call) ? value.call : value
67
+ fail!(:csrf_detected, CallbackError.new(:csrf_detected, 'CSRF detected'))
68
+ else
69
+ self.access_token = build_access_token
70
+ self.access_token = access_token.refresh! if access_token.expired?
71
+ env['omniauth.auth'] = auth_hash
72
+ call_app!
65
73
  end
74
+ rescue ::OAuth2::Error, CallbackError => e
75
+ fail!(:invalid_credentials, e)
76
+ rescue ::Timeout::Error, ::Errno::ETIMEDOUT => e
77
+ fail!(:timeout, e)
78
+ rescue ::SocketError => e
79
+ fail!(:failed_to_connect, e)
80
+ end
81
+
82
+ protected
83
+
84
+ def callback_url
85
+ ENV['OSSO_REDIRECT_URI'] || super
86
+ end
87
+
88
+ def request_domain
89
+ return @request_domain if defined?(@request_domain)
90
+
91
+ @request_domain = request.params['domain'] || request.params['email'].split('@')[1]
92
+
93
+ raise StandardError if @request_domain.nil?
94
+
95
+ @request_domain
66
96
  end
67
97
  end
68
98
  end
@@ -8,7 +8,7 @@ Gem::Specification.new do |gem|
8
8
  gem.description = 'An OAuth 2.0 OmniAuth provider for Osso SSO.'
9
9
  gem.summary = gem.description
10
10
  gem.homepage = 'https://github.com/enterprise-oss/omniauth-osso'
11
- gem.license = 'MIT'
11
+ gem.license = 'BSL'
12
12
 
13
13
  gem.add_dependency 'omniauth-oauth2', '~> 1.6.0'
14
14
  gem.add_development_dependency 'bundler', '~> 2.1'
@@ -39,51 +39,97 @@ describe OmniAuth::Strategies::Osso do
39
39
  describe '#authorize_params' do
40
40
  subject { fresh_strategy }
41
41
 
42
- it 'includes the domain authorize param passed in the :authorize_params option' do
43
- instance = subject.new('abc', 'def', authorize_params: { domain: 'bar.com' })
44
- expect(instance.authorize_params['domain']).to eq('bar.com')
45
- end
46
-
47
- it 'includes top-level domain' do
48
- instance = subject.new('abc', 'def', domain: 'bar.com')
49
- expect(instance.authorize_params['domain']).to eq('bar.com')
50
- expect(instance.authorize_params['state']).not_to be_empty
51
- end
52
-
53
42
  it 'includes random state in the authorize params' do
54
- instance = subject.new('abc', 'def', authorize_params: { domain: 'bar.com' })
43
+ instance = subject.new('abc', 'def')
55
44
  expect(instance.authorize_params.keys).to include('state')
56
45
  expect(instance.session['omniauth.state']).not_to be_empty
57
46
  end
58
47
 
59
48
  it 'includes custom state in the authorize params' do
60
- instance = subject.new('abc', 'def', authorize_params: { state: proc { 'qux' }, domain: 'foo.com' })
49
+ instance = subject.new('abc', 'def', state: 'qux')
61
50
  expect(instance.authorize_params.keys).to include('state')
62
51
  expect(instance.session['omniauth.state']).to eq('qux')
63
52
  end
64
-
65
- it 'includes state and domain as authorize options' do
66
- instance = subject.new('abc', 'def', domain: 'foo.com')
67
- expect(instance.authorize_params.keys).to eq(%w[state domain])
68
- end
69
53
  end
70
54
 
71
- describe '#token_params' do
55
+ describe '#request_params' do
56
+ let(:url) { 'https://example.com/auth/osso' }
72
57
  subject { fresh_strategy }
73
58
 
74
- it 'includes any authorize params passed in the :authorize_params option' do
75
- instance = subject.new('abc', 'def', token_params: { foo: 'bar', baz: 'zip' })
76
- expect(instance.token_params).to eq('foo' => 'bar', 'baz' => 'zip')
59
+ before do
60
+ ENV['OSSO_REDIRECT_URI'] = url
61
+ ENV['OSSO_BASE_URL'] = 'https://osso-base.com'
77
62
  end
78
63
 
79
- it 'includes top-level options that are marked as :authorize_options' do
80
- instance = subject.new('abc', 'def', token_options: %i[scope foo], scope: 'bar', foo: 'baz')
81
- expect(instance.token_params).to eq('scope' => 'bar', 'foo' => 'baz')
64
+ it 'includes domain passed as a request param' do
65
+ instance = subject.new('abc', 'def')
66
+ allow(instance).to receive(:request) do
67
+ double('Request', params: { 'domain' => 'example.com' }, scheme: 'https', url: url)
68
+ end
69
+
70
+ expect(instance.request_params[:domain]).to eq('example.com')
71
+ end
72
+
73
+ it 'includes domain when an email address is passed as an authorize option' do
74
+ instance = subject.new('abc', 'def')
75
+
76
+ allow(instance).to receive(:request) do
77
+ double('Request', params: { 'email' => 'user@example.com' }, scheme: 'https', url: url)
78
+ end
79
+
80
+ expect(instance.request_params[:domain]).to eq('example.com')
82
81
  end
83
82
  end
84
83
 
84
+ # We need to get a little hacky with testing the callback phase
85
+ # in order to cover IDP initiated flows. When a user opens
86
+ # an SP app by clicking a tile on their IDP, then the OAuth flow
87
+ # skips the first leg, and we have to ignore CSRF protection.
88
+ # Osso will send `state=IDP_INITIATED_FLOW` when this is the case,
89
+ # and here we ensure that our strategy completes the callback phase
90
+ # with this state param.
91
+
85
92
  describe '#callback_phase' do
86
93
  subject { fresh_strategy }
94
+ let(:url) { 'https://example.com/auth/osso/callback' }
95
+ let(:instance) { subject.new(app, 'abc', 'def') }
96
+
97
+ before do
98
+ OmniAuth.config.test_mode = true
99
+ ENV['OSSO_REDIRECT_URI'] = url
100
+ ENV['OSSO_BASE_URL'] = 'https://osso-base.com'
101
+ allow(instance).to receive(:auth_hash) { auth_hash }
102
+ instance.env = {}
103
+ end
104
+
105
+ let :auth_hash do
106
+ {
107
+ provider: 'osso',
108
+ uid: 'uuid',
109
+ info: {
110
+ email: 'user@enterprise.com',
111
+ name: 'user@enterprise.com'
112
+ },
113
+ credentials: {
114
+ },
115
+ extra: {
116
+ }
117
+ }
118
+ end
119
+
120
+ it 'allows callbacks with IDP_INITIATED state param' do
121
+ allow(instance).to receive(:request) do
122
+ double('Request', params: { 'state' => 'IDP_INITIATED' }, scheme: 'https', url: url)
123
+ end
124
+
125
+ allow(instance).to receive(:build_access_token) do
126
+ double('AccessToken', expired?: false, token: 'token')
127
+ end
128
+
129
+ expect(instance).to_not receive(:fail!)
130
+ instance.callback_phase
131
+ end
132
+
87
133
  it 'calls fail with the client error received' do
88
134
  instance = subject.new('abc', 'def')
89
135
  allow(instance).to receive(:request) do
@@ -3,7 +3,7 @@
3
3
  $LOAD_PATH.unshift File.expand_path(__dir__)
4
4
  $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
5
5
 
6
- require 'omniauth_osso'
6
+ require 'omniauth-osso'
7
7
 
8
8
  require 'omniauth'
9
9
  require 'omniauth-oauth2'
@@ -38,8 +38,5 @@ end
38
38
 
39
39
  RSpec.configure do |config|
40
40
  config.include RSpecMixin
41
-
42
- # OmniAuth.config.test_mode = true
43
- # OmniAuth.config.logger = Logger.new('/dev/null')
44
41
  WebMock.disable_net_connect!(allow_localhost: true)
45
42
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-osso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Bauch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-01 00:00:00.000000000 Z
11
+ date: 2020-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2
@@ -43,28 +43,35 @@ email:
43
43
  - sbauch@gmail.com
44
44
  executables:
45
45
  - console
46
+ - publish
46
47
  - setup
47
48
  extensions: []
48
49
  extra_rdoc_files: []
49
50
  files:
51
+ - ".buildkite/hooks/environment"
52
+ - ".buildkite/hooks/pre-command"
53
+ - ".buildkite/pipeline.yml"
50
54
  - ".gitignore"
51
55
  - ".rspec"
52
56
  - ".rubocop.yml"
57
+ - CODE_OF_CONDUCT.md
53
58
  - Gemfile
54
59
  - Gemfile.lock
60
+ - LICENSE
55
61
  - README.md
56
62
  - Rakefile
57
63
  - bin/console
64
+ - bin/publish
58
65
  - bin/setup
66
+ - lib/omniauth-osso.rb
59
67
  - lib/omniauth-osso/version.rb
60
68
  - lib/omniauth/strategies/osso.rb
61
- - lib/omniauth_osso.rb
62
69
  - omniauth-osso.gemspec
63
70
  - spec/omniauth/strategies/osso_spec.rb
64
71
  - spec/spec_helper.rb
65
72
  homepage: https://github.com/enterprise-oss/omniauth-osso
66
73
  licenses:
67
- - MIT
74
+ - BSL
68
75
  metadata: {}
69
76
  post_install_message:
70
77
  rdoc_options: []
@@ -81,11 +88,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
88
  - !ruby/object:Gem::Version
82
89
  version: '0'
83
90
  requirements: []
84
- rubyforge_project:
85
- rubygems_version: 2.7.6.2
91
+ rubygems_version: 3.0.3
86
92
  signing_key:
87
93
  specification_version: 4
88
94
  summary: An OAuth 2.0 OmniAuth provider for Osso SSO.
89
- test_files:
90
- - spec/omniauth/strategies/osso_spec.rb
91
- - spec/spec_helper.rb
95
+ test_files: []