Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for omniauth 2.0 series #81

Merged
merged 2 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/omniauth/strategies/apple.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def authorize_params
end

def callback_url
options[:redirect_uri] || (full_host + script_name + callback_path)
options[:redirect_uri] || (full_host + callback_path)
end

private
Expand Down
6 changes: 3 additions & 3 deletions omniauth-apple.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_dependency 'omniauth-oauth2'
spec.add_dependency 'jwt'
spec.add_dependency "omniauth-oauth2", "~> 1.7.1"
spec.add_dependency "jwt"
spec.add_development_dependency "bundler", "~> 2.0"
spec.add_development_dependency "rake", "~> 13.0"
spec.add_development_dependency "rspec", "~> 3.9"
spec.add_development_dependency "webmock", "~> 3.8"
spec.add_development_dependency 'simplecov', "~> 0.18"
spec.add_development_dependency "simplecov", "~> 0.18"
end
16 changes: 16 additions & 0 deletions spec/omniauth/strategies/apple_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,22 @@
end
end

describe '#callback_url' do
let(:base_url) { 'https://example.com' }

it 'has the correct default callback path' do
allow(subject).to receive(:full_host) { base_url }
allow(subject).to receive(:script_name) { '' }
expect(subject.send(:callback_url)).to eq(base_url + '/auth/apple/callback')
end

it 'should set the callback path with script_name if present' do
allow(subject).to receive(:full_host) { base_url }
allow(subject).to receive(:script_name) { '/v1' }
expect(subject.send(:callback_url)).to eq(base_url + '/v1/auth/apple/callback')
end
end

describe '#callback_path' do
it 'has the correct default callback path' do
expect(subject.callback_path).to eq('/auth/apple/callback')
Expand Down