summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Quigley <tsimonq2@debian.org>2025-11-03 10:06:37 -0600
committergit-ubuntu importer <ubuntu-devel-discuss@lists.ubuntu.com>2025-11-03 22:40:55 +0000
commit9cbb27df74ec397eabf3e18ea4575300808a35c6 (patch)
tree9f79858b449b2bdb75896ed7c077aac3ae163d7e
parent6e0e7aeb96dd462526dc885c25bb677b56b794f5 (diff)
Imported using git-ubuntu import.
Notes
Notes: * Team upload. * New upstream release. * Update Standards-Version to 4.7.2, no changes needed.
-rw-r--r--.github/FUNDING.yml2
-rw-r--r--.github/ISSUE_TEMPLATE.md20
-rw-r--r--.github/dependabot.yml18
-rw-r--r--.github/workflows/jruby.yml28
-rw-r--r--.github/workflows/main.yml64
-rw-r--r--.github/workflows/truffle_ruby.yml24
-rw-r--r--Gemfile8
-rw-r--r--README.md4
-rw-r--r--debian/changelog8
-rw-r--r--debian/control2
-rw-r--r--debian/gbp.conf4
-rw-r--r--debian/patches/0002-spec-helper.rb-skip-all-coverage-check-during-build.patch30
-rw-r--r--debian/patches/0003-spec-helper.rb-drop-rack-freeze-usage.patch5
-rw-r--r--debian/salsa-ci.yml3
-rw-r--r--lib/omniauth.rb15
-rw-r--r--lib/omniauth/builder.rb4
-rw-r--r--lib/omniauth/form.rb3
-rw-r--r--lib/omniauth/strategies/developer.rb2
-rw-r--r--lib/omniauth/strategy.rb16
-rw-r--r--lib/omniauth/version.rb2
-rw-r--r--omniauth.gemspec1
-rw-r--r--spec/helper.rb28
-rw-r--r--spec/omniauth/builder_spec.rb12
-rw-r--r--spec/omniauth/form_spec.rb8
-rw-r--r--spec/omniauth/strategies/developer_spec.rb4
-rw-r--r--spec/omniauth/strategy_spec.rb17
-rw-r--r--spec/omniauth_spec.rb2
27 files changed, 286 insertions, 48 deletions
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000..857f103
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,2 @@
+github: bobbymcwho
+tidelift: rubygems/omniauth
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 0000000..dcafccd
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,20 @@
+Please complete all sections.
+
+### Configuration
+
+- Provider Gem: `omniauth-*`
+- Ruby Version: ``
+- Framework: ``
+- Platform: ``
+
+### Expected Behavior
+
+Tell us what should happen.
+
+### Actual Behavior
+
+Tell us what happens instead.
+
+### Steps to Reproduce
+
+Please list all steps to reproduce the issue.
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..59be49b
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,18 @@
+# To get started with Dependabot version updates, you'll need to specify which
+# package ecosystems to update and where the package manifests are located.
+# Please see the documentation for all configuration options:
+# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
+
+version: 2
+updates:
+ - package-ecosystem: bundler
+ directory: '/'
+ schedule:
+ interval: weekly
+ open-pull-requests-limit: 99
+
+ - package-ecosystem: github-actions
+ directory: '/'
+ schedule:
+ interval: daily
+ open-pull-requests-limit: 99
diff --git a/.github/workflows/jruby.yml b/.github/workflows/jruby.yml
new file mode 100644
index 0000000..8ff2fb1
--- /dev/null
+++ b/.github/workflows/jruby.yml
@@ -0,0 +1,28 @@
+name: JRuby
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+
+jobs:
+ test:
+ runs-on: ${{ matrix.os }}-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu, macos]
+ jruby: [jruby, jruby-head]
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: ${{ matrix.jruby }}
+ bundler-cache: true
+ env:
+ JRUBY_OPTS: --debug
+ - name: Run tests
+ env:
+ JRUBY_OPTS: --debug
+ run: bundle exec rake
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 0000000..045a742
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,64 @@
+# This workflow uses actions that are not certified by GitHub.
+# They are provided by a third-party and are governed by
+# separate terms of service, privacy policy, and support
+# documentation.
+# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
+# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
+
+name: Ruby
+
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+
+jobs:
+ test:
+ runs-on: ${{ matrix.os }}-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu, macos]
+ ruby: [2.5, 2.6, 2.7, '3.0', 3.1, 3.2, 3.3, 3.4, head, debug]
+ exclude:
+ - os: macos
+ ruby: 2.5
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: ${{ matrix.ruby }}
+ bundler-cache: true
+ - name: Run tests
+ run: bundle exec rake
+ frozen-string-compat:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: 2.6
+ bundler-cache: true
+ - name: Run tests
+ env:
+ RUBYOPT: "--enable-frozen-string-literal"
+ run: bundle exec rake
+ coveralls:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: 2.6
+ bundler-cache: true
+ - name: Run tests
+ run: bundle exec rake
+ - name: Coveralls GitHub Action
+ uses: coverallsapp/github-action@v2
+ with:
+ github-token: ${{ secrets.github_token }}
+ path-to-lcov: './coverage/lcov/omniauth.lcov'
diff --git a/.github/workflows/truffle_ruby.yml b/.github/workflows/truffle_ruby.yml
new file mode 100644
index 0000000..87ec979
--- /dev/null
+++ b/.github/workflows/truffle_ruby.yml
@@ -0,0 +1,24 @@
+name: TruffleRuby
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+
+jobs:
+ test:
+ runs-on: ${{ matrix.os }}-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu, macos]
+ ruby: [truffleruby, truffleruby-head]
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: ${{ matrix.ruby }}
+ bundler-cache: true
+ - name: Run tests
+ run: bundle exec rake
diff --git a/Gemfile b/Gemfile
index 4a3feea..5b174ff 100644
--- a/Gemfile
+++ b/Gemfile
@@ -12,17 +12,13 @@ group :development do
end
group :test do
+ gem 'cgi'
gem 'coveralls_reborn', '~> 0.19.0', require: false
- gem 'hashie', '>= 3.4.6', '~> 4.0.0', platforms: [:jruby_18]
- gem 'json', '~> 2.3.0', platforms: %i[jruby_18 jruby_19 ruby_19]
- gem 'mime-types', '~> 3.1', platforms: [:jruby_18]
gem 'rack-test'
- gem 'rest-client', '~> 2.0.0', platforms: [:jruby_18]
gem 'rspec', '~> 3.5'
gem 'rack-freeze'
- gem 'rubocop', '>= 0.58.2', '< 0.69.0', platforms: %i[ruby_20 ruby_21 ruby_22 ruby_23 ruby_24]
+ gem 'rubocop', '>= 0.58.2', '< 0.69.0', platforms: %i[ruby_22 ruby_23 ruby_24]
gem 'simplecov-lcov'
- gem 'tins', '~> 1.13', platforms: %i[jruby_18 jruby_19 ruby_19]
end
gemspec
diff --git a/README.md b/README.md
index 4d47ec8..ec06b34 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@
[coveralls]: https://coveralls.io/r/omniauth/omniauth
This is the documentation for the in-development branch of OmniAuth.
-You can find the documentation for the latest stable release [here](https://github.com/omniauth/omniauth/tree/v2.1.1)
+You can find the documentation for the latest stable release [here](https://github.com/omniauth/omniauth/tree/v2.1.4)
## An Introduction
OmniAuth is a library that standardizes multi-provider authentication for
@@ -252,7 +252,7 @@ improve code health, while paying the maintainers of the exact packages you use.
[Learn more.](https://tidelift.com/subscription/pkg/rubygems-omniauth?utm_source=undefined&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
## Supported Ruby Versions
-OmniAuth is tested under 2.5, 2.6, 2.7, truffleruby, and JRuby.
+OmniAuth is tested under 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, truffleruby, and JRuby.
## Versioning
This library aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations
diff --git a/debian/changelog b/debian/changelog
index ea67064..9ba20ce 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+ruby-omniauth (2.1.4-1) unstable; urgency=medium
+
+ * Team upload.
+ * New upstream release.
+ * Update Standards-Version to 4.7.2, no changes needed.
+
+ -- Simon Quigley <tsimonq2@debian.org> Mon, 03 Nov 2025 10:06:37 -0600
+
ruby-omniauth (2.1.1-4) unstable; urgency=medium
* Team upload
diff --git a/debian/control b/debian/control
index 688b8b6..9ebaba8 100644
--- a/debian/control
+++ b/debian/control
@@ -15,7 +15,7 @@ Build-Depends: debhelper-compat (= 13),
ruby-rack-test,
ruby-rspec,
ruby-simplecov
-Standards-Version: 4.7.0
+Standards-Version: 4.7.2
Vcs-Git: https://salsa.debian.org/ruby-team/ruby-omniauth.git
Vcs-Browser: https://salsa.debian.org/ruby-team/ruby-omniauth
Homepage: https://github.com/omniauth/omniauth
diff --git a/debian/gbp.conf b/debian/gbp.conf
new file mode 100644
index 0000000..6b65fe0
--- /dev/null
+++ b/debian/gbp.conf
@@ -0,0 +1,4 @@
+[DEFAULT]
+debian-branch = debian/latest
+upstream-branch = upstream/latest
+pristine-tar = True
diff --git a/debian/patches/0002-spec-helper.rb-skip-all-coverage-check-during-build.patch b/debian/patches/0002-spec-helper.rb-skip-all-coverage-check-during-build.patch
index 8cbc2c0..618690a 100644
--- a/debian/patches/0002-spec-helper.rb-skip-all-coverage-check-during-build.patch
+++ b/debian/patches/0002-spec-helper.rb-skip-all-coverage-check-during-build.patch
@@ -10,13 +10,27 @@ Forwarded: not-needed
spec/helper.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
-diff --git a/spec/helper.rb b/spec/helper.rb
-index 6583992..2c0c846 100644
--- a/spec/helper.rb
+++ b/spec/helper.rb
-@@ -1,4 +1,4 @@
--if RUBY_VERSION >= '1.9'
-+if false
- require 'simplecov'
- require 'coveralls'
- require 'simplecov-lcov'
+@@ -1,21 +1,3 @@
+-require 'simplecov'
+-require 'coveralls'
+-require 'simplecov-lcov'
+-
+-SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
+-
+-SimpleCov.formatters = [
+- SimpleCov::Formatter::HTMLFormatter,
+- SimpleCov::Formatter::LcovFormatter,
+- Coveralls::SimpleCov::Formatter
+-]
+-
+-SimpleCov.start do
+- add_filter ['/spec/', '/vendor/', 'strategy_macros.rb']
+- minimum_coverage(92.5)
+- maximum_coverage_drop(0.05)
+-end
+-
+ require 'rspec'
+ require 'rack/test'
+ require 'rack/freeze'
diff --git a/debian/patches/0003-spec-helper.rb-drop-rack-freeze-usage.patch b/debian/patches/0003-spec-helper.rb-drop-rack-freeze-usage.patch
index fe68848..a2070bc 100644
--- a/debian/patches/0003-spec-helper.rb-drop-rack-freeze-usage.patch
+++ b/debian/patches/0003-spec-helper.rb-drop-rack-freeze-usage.patch
@@ -10,12 +10,9 @@ Forwarded: not-needed
spec/helper.rb | 1 -
1 file changed, 1 deletion(-)
-diff --git a/spec/helper.rb b/spec/helper.rb
-index 2c0c846..8a162e5 100644
--- a/spec/helper.rb
+++ b/spec/helper.rb
-@@ -20,7 +20,6 @@ end
-
+@@ -1,6 +1,5 @@
require 'rspec'
require 'rack/test'
-require 'rack/freeze'
diff --git a/debian/salsa-ci.yml b/debian/salsa-ci.yml
index 33c3a64..7b5d2f7 100644
--- a/debian/salsa-ci.yml
+++ b/debian/salsa-ci.yml
@@ -1,4 +1,3 @@
---
include:
- - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
- - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml
+ - https://salsa.debian.org/ruby-team/meta/raw/master/salsa-ci.yml
diff --git a/lib/omniauth.rb b/lib/omniauth.rb
index 034e7e8..c697372 100644
--- a/lib/omniauth.rb
+++ b/lib/omniauth.rb
@@ -1,3 +1,7 @@
+# TODO: Fixed in https://github.com/rack/rack/pull/1610 for Rack 3
+if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
+ require 'delegate'
+end
require 'rack'
require 'singleton'
require 'logger'
@@ -38,6 +42,7 @@ module OmniAuth
:failure_raise_out_environments => ['development'],
:request_validation_phase => OmniAuth::AuthenticityTokenProtection,
:before_request_phase => nil,
+ :after_request_phase => nil,
:before_callback_phase => nil,
:before_options_phase => nil,
:form_css => Form::DEFAULT_CSS,
@@ -93,6 +98,14 @@ module OmniAuth
end
end
+ def after_request_phase(&block)
+ if block_given?
+ @after_request_phase = block
+ else
+ @after_request_phase
+ end
+ end
+
def add_mock(provider, original = {})
# Create key-stringified new hash from given auth hash
mock = {}
@@ -122,7 +135,7 @@ module OmniAuth
camelizations[name.to_s] = camelized.to_s
end
- attr_writer :on_failure, :before_callback_phase, :before_options_phase, :before_request_phase, :request_validation_phase
+ attr_writer :on_failure, :before_callback_phase, :before_options_phase, :before_request_phase, :after_request_phase, :request_validation_phase
attr_accessor :failure_raise_out_environments, :path_prefix, :allowed_request_methods, :form_css,
:test_mode, :mock_auth, :full_host, :camelizations, :logger, :silence_get_warning
end
diff --git a/lib/omniauth/builder.rb b/lib/omniauth/builder.rb
index 5843439..a095e8d 100644
--- a/lib/omniauth/builder.rb
+++ b/lib/omniauth/builder.rb
@@ -12,6 +12,10 @@ module OmniAuth
OmniAuth.config.before_request_phase = block
end
+ def after_request_phase(&block)
+ OmniAuth.config.after_request_phase = block
+ end
+
def before_callback_phase(&block)
OmniAuth.config.before_callback_phase = block
end
diff --git a/lib/omniauth/form.rb b/lib/omniauth/form.rb
index def52e3..46f5405 100644
--- a/lib/omniauth/form.rb
+++ b/lib/omniauth/form.rb
@@ -7,6 +7,7 @@ module OmniAuth
def initialize(options = {})
options[:title] ||= 'Authentication Info Required'
options[:header_info] ||= ''
+ options[:method] ||= 'post'
self.options = options
@html = +'' # unary + string allows it to be mutable if strings are frozen
@@ -75,7 +76,7 @@ module OmniAuth
</head>
<body>
<h1>#{title}</h1>
- <form method='post' #{"action='#{options[:url]}' " if options[:url]}noValidate='noValidate'>
+ <form method='#{options[:method]}' #{"action='#{options[:url]}' " if options[:url]}noValidate='noValidate'>
HTML
self
end
diff --git a/lib/omniauth/strategies/developer.rb b/lib/omniauth/strategies/developer.rb
index 8cac832..090dcc7 100644
--- a/lib/omniauth/strategies/developer.rb
+++ b/lib/omniauth/strategies/developer.rb
@@ -35,7 +35,7 @@ module OmniAuth
option :uid_field, :email
def request_phase
- form = OmniAuth::Form.new(:title => 'User Info', :url => callback_path)
+ form = OmniAuth::Form.new(:title => 'User Info', :url => callback_path, :method => 'get')
options.fields.each do |field|
form.text_field field.to_s.capitalize.tr('_', ' '), field.to_s
end
diff --git a/lib/omniauth/strategy.rb b/lib/omniauth/strategy.rb
index 2cfc2a6..118a5a1 100644
--- a/lib/omniauth/strategy.rb
+++ b/lib/omniauth/strategy.rb
@@ -240,7 +240,7 @@ module OmniAuth
OmniAuth.config.request_validation_phase.call(env) if OmniAuth.config.request_validation_phase
OmniAuth.config.before_request_phase.call(env) if OmniAuth.config.before_request_phase
- if options.form.respond_to?(:call)
+ result = if options.form.respond_to?(:call)
log :debug, 'Rendering form from supplied Rack endpoint.'
options.form.call(env)
elsif options.form
@@ -257,6 +257,9 @@ module OmniAuth
request_phase
end
+
+ OmniAuth.config.after_request_phase.call(env) if OmniAuth.config.after_request_phase
+ result
rescue OmniAuth::AuthenticityError => e
fail!(:authenticity_error, e)
end
@@ -330,12 +333,17 @@ module OmniAuth
end
end
- redirect(callback_url)
+ result = redirect(callback_url)
+
+ OmniAuth.config.after_request_phase.call(env) if OmniAuth.config.after_request_phase
+ result
end
def mock_callback_call
setup_phase
- @env['omniauth.origin'] = session.delete('omniauth.origin')
+
+ origin = session.delete('omniauth.origin')
+ @env['omniauth.origin'] ||= origin
@env['omniauth.origin'] = nil if env['omniauth.origin'] == ''
@env['omniauth.params'] = session.delete('omniauth.params') || {}
@@ -481,7 +489,7 @@ module OmniAuth
OmniAuth.config.full_host.call(env)
else
# in Rack 1.3.x, request.url explodes if scheme is nil
- if request.scheme && request.url.match(URI::ABS_URI)
+ if request.scheme && URI.parse(request.url).absolute?
uri = URI.parse(request.url.gsub(/\?.*$/, ''))
uri.path = ''
# sometimes the url is actually showing http inside rails because the
diff --git a/lib/omniauth/version.rb b/lib/omniauth/version.rb
index 653d977..96b50d2 100644
--- a/lib/omniauth/version.rb
+++ b/lib/omniauth/version.rb
@@ -1,3 +1,3 @@
module OmniAuth
- VERSION = '2.1.1'.freeze
+ VERSION = '2.1.4'.freeze
end
diff --git a/omniauth.gemspec b/omniauth.gemspec
index 16e325b..57331b6 100644
--- a/omniauth.gemspec
+++ b/omniauth.gemspec
@@ -9,6 +9,7 @@ Gem::Specification.new do |spec|
spec.add_dependency 'rack', '>= 2.2.3'
spec.add_development_dependency 'bundler', '~> 2.0'
spec.add_dependency 'rack-protection'
+ spec.add_dependency 'logger'
spec.add_development_dependency 'rake', '~> 12.0'
spec.authors = ['Michael Bleigh', 'Erik Michaels-Ober', 'Tom Milewski']
spec.description = 'A generalized Rack framework for multiple-provider authentication.'
diff --git a/spec/helper.rb b/spec/helper.rb
index 6583992..662ea77 100644
--- a/spec/helper.rb
+++ b/spec/helper.rb
@@ -1,21 +1,19 @@
-if RUBY_VERSION >= '1.9'
- require 'simplecov'
- require 'coveralls'
- require 'simplecov-lcov'
+require 'simplecov'
+require 'coveralls'
+require 'simplecov-lcov'
- SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
+SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
- SimpleCov.formatters = [
- SimpleCov::Formatter::HTMLFormatter,
- SimpleCov::Formatter::LcovFormatter,
- Coveralls::SimpleCov::Formatter
- ]
+SimpleCov.formatters = [
+ SimpleCov::Formatter::HTMLFormatter,
+ SimpleCov::Formatter::LcovFormatter,
+ Coveralls::SimpleCov::Formatter
+]
- SimpleCov.start do
- add_filter ['/spec/', '/vendor/', 'strategy_macros.rb']
- minimum_coverage(92.5)
- maximum_coverage_drop(0.05)
- end
+SimpleCov.start do
+ add_filter ['/spec/', '/vendor/', 'strategy_macros.rb']
+ minimum_coverage(92.5)
+ maximum_coverage_drop(0.05)
end
require 'rspec'
diff --git a/spec/omniauth/builder_spec.rb b/spec/omniauth/builder_spec.rb
index da6a2e4..b769984 100644
--- a/spec/omniauth/builder_spec.rb
+++ b/spec/omniauth/builder_spec.rb
@@ -94,6 +94,18 @@ describe OmniAuth::Builder do
end
end
+ describe '#after_request_phase' do
+ it 'passes the block to the config' do
+ prok = proc {}
+
+ with_config_reset(:after_request_phase) do
+ OmniAuth::Builder.new(nil).after_request_phase(&prok)
+
+ expect(OmniAuth.config.after_request_phase).to eq(prok)
+ end
+ end
+ end
+
describe '#before_callback_phase' do
it 'passes the block to the config' do
prok = proc {}
diff --git a/spec/omniauth/form_spec.rb b/spec/omniauth/form_spec.rb
index 1354a16..5196d1c 100644
--- a/spec/omniauth/form_spec.rb
+++ b/spec/omniauth/form_spec.rb
@@ -20,6 +20,14 @@ describe OmniAuth::Form do
it 'sets an H1 tag from the passed :title option' do
expect(OmniAuth::Form.new(:title => 'Something Cool').to_html).to be_include('<h1>Something Cool</h1>')
end
+
+ it 'sets the default form method to post' do
+ expect(OmniAuth::Form.new.to_html).to be_include("method='post'")
+ end
+
+ it 'sets the form method to the passed :method option' do
+ expect(OmniAuth::Form.new(:method => 'get').to_html).to be_include("method='get'")
+ end
end
describe '#password_field' do
diff --git a/spec/omniauth/strategies/developer_spec.rb b/spec/omniauth/strategies/developer_spec.rb
index 309b8f7..022e1c0 100644
--- a/spec/omniauth/strategies/developer_spec.rb
+++ b/spec/omniauth/strategies/developer_spec.rb
@@ -31,7 +31,7 @@ describe OmniAuth::Strategies::Developer do
context 'with default options' do
before do
- post '/auth/developer/callback', :name => 'Example User', :email => 'user@example.com'
+ get '/auth/developer/callback', :name => 'Example User', :email => 'user@example.com'
end
it 'sets the name in the auth hash' do
@@ -58,7 +58,7 @@ describe OmniAuth::Strategies::Developer do
before do
@options = {:uid_field => :last_name, :fields => %i[first_name last_name]}
- post '/auth/developer/callback', :first_name => 'Example', :last_name => 'User'
+ get '/auth/developer/callback', :first_name => 'Example', :last_name => 'User'
end
it 'sets info fields properly' do
diff --git a/spec/omniauth/strategy_spec.rb b/spec/omniauth/strategy_spec.rb
index 7ee82c7..aaf7783 100644
--- a/spec/omniauth/strategy_spec.rb
+++ b/spec/omniauth/strategy_spec.rb
@@ -872,6 +872,14 @@ describe OmniAuth::Strategy do
expect(strategy.env['omniauth.origin']).to eq('http://example.com/origin')
end
+ it 'does not override omniauth.origin if already set on the callback phase' do
+ strategy.call(make_env('/auth/test/callback',
+ 'rack.session' => {'omniauth.origin' => 'http://example.com/origin'},
+ 'omniauth.origin' => '/foo'))
+ expect(strategy.env['omniauth.origin']).to eq('/foo')
+ expect(strategy.env['rack.session']['omniauth.origin']).to be_nil
+ end
+
it 'executes callback hook on the callback phase' do
OmniAuth.config.mock_auth[:test] = {}
OmniAuth.config.before_callback_phase do |env|
@@ -908,6 +916,15 @@ describe OmniAuth::Strategy do
expect(strategy.env['foobar']).to eq('baz')
end
+ it 'executes after request hook on the request phase' do
+ OmniAuth.config.mock_auth[:test] = {}
+ OmniAuth.config.after_request_phase do |env|
+ env['after_request'] = 'executed'
+ end
+ strategy.call(make_env('/auth/test', 'QUERY_STRING' => 'foo=bar'))
+ expect(strategy.env['after_request']).to eq('executed')
+ end
+
it 'turns omniauth.params into an env variable on the callback phase' do
OmniAuth.config.mock_auth[:test] = {}
diff --git a/spec/omniauth_spec.rb b/spec/omniauth_spec.rb
index e8499d8..0d4fdef 100644
--- a/spec/omniauth_spec.rb
+++ b/spec/omniauth_spec.rb
@@ -31,6 +31,7 @@ describe OmniAuth do
@old_before_callback_phase = OmniAuth.config.before_callback_phase
@old_before_options_phase = OmniAuth.config.before_options_phase
@old_before_request_phase = OmniAuth.config.before_request_phase
+ @old_after_request_phase = OmniAuth.config.after_request_phase
@old_request_validation_phase = OmniAuth.config.request_validation_phase
end
@@ -41,6 +42,7 @@ describe OmniAuth do
config.before_callback_phase = @old_before_callback_phase
config.before_options_phase = @old_before_options_phase
config.before_request_phase = @old_before_request_phase
+ config.after_request_phase = @old_after_request_phase
config.request_validation_phase = @old_request_validation_phase
end
end