-
Notifications
You must be signed in to change notification settings - Fork 20
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
Supports Ruby 3.0, Oauth2 2.0 , JWT 2.9.3 #35
Open
regismesquita
wants to merge
9
commits into
rootstrap:master
Choose a base branch
from
regismesquita:update_oauth
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0599058
Ruby 3.0 and oauth2 support
regismesquita c967e4b
Fixes multiple rubocop complaints and disable cop
regismesquita d212bc8
Updates reek and rubocop for fixing requirements
regismesquita 530ddd9
Major version update
regismesquita d8e8854
Adds support for JWT 2.9.3
regismesquita 7a9c8cf
JWT update and fixes
regismesquita 6fae111
Was getting 403s, authscheme must be on the request body
regismesquita 0ed69ca
rubocop fixes
regismesquita 2c4a175
removes dev debug code
regismesquita File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,39 +6,44 @@ Gem::Specification.new do |spec| | |
spec.name = 'apple_auth' | ||
spec.version = AppleAuth::Base::VERSION | ||
spec.authors = ['Timothy Peraza, Antonieta Alvarez, Martín Morón'] | ||
spec.email = ['[email protected], [email protected], [email protected]'] | ||
spec.email = ['[email protected], ' \ | ||
'[email protected] ,' \ | ||
'[email protected]'] | ||
|
||
spec.summary = 'Integration with Apple Sign In and Devise for backend. Validate and Verify user token.' | ||
spec.summary = 'Integration with Apple Sign In and Devise for backend.' \ | ||
'Validate and Verify user token.' | ||
spec.homepage = 'https://github.com/rootstrap/apple_auth' | ||
spec.license = 'MIT' | ||
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0') | ||
spec.required_ruby_version = Gem::Requirement.new('>= 3.0.0') | ||
|
||
spec.metadata['homepage_uri'] = spec.homepage | ||
spec.metadata['source_code_uri'] = 'https://github.com/rootstrap/apple_auth' | ||
spec.metadata['changelog_uri'] = 'https://github.com/rootstrap/apple_auth' | ||
|
||
# Specify which files should be added to the gem when it is released. | ||
# The `git ls-files -z` loads the files in the RubyGem that have been added into git. | ||
spec.files = Dir.chdir(File.expand_path(__dir__)) do | ||
spec.files = Dir.chdir(File.expand_path(__dir__)) do | ||
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } | ||
end | ||
spec.bindir = 'exe' | ||
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } | ||
spec.require_paths = ['lib'] | ||
|
||
# Production dependencies | ||
spec.add_dependency 'jwt', '~> 2.2' | ||
spec.add_dependency 'oauth2', '~> 1.4' | ||
spec.add_dependency 'jwt', '~> 2.9.3' | ||
spec.add_dependency 'oauth2', '~> 2.0' | ||
|
||
# Development dependencies | ||
spec.add_development_dependency 'generator_spec', '~> 0.9.4' | ||
spec.add_development_dependency 'byebug', '~> 11.1' | ||
spec.add_development_dependency 'drb' # Will be removed from the standard library in Ruby 3.4 | ||
spec.add_development_dependency 'generator_spec', '~> 0.9.4' | ||
spec.add_development_dependency 'mutex_m' # Will be removed from the standard library in Ruby 3.4 | ||
spec.add_development_dependency 'parser', '~> 3.0' | ||
spec.add_development_dependency 'railties', '~> 6.0' | ||
spec.add_development_dependency 'rake', '~> 13.0' | ||
spec.add_development_dependency 'reek', '~> 5.6' | ||
spec.add_development_dependency 'reek', '~> 6.1' | ||
spec.add_development_dependency 'rspec', '~> 3.9' | ||
spec.add_development_dependency 'rubocop', '~> 0.80' | ||
spec.add_development_dependency 'parser', '~> 2.7.1.1' | ||
spec.add_development_dependency 'rubocop', '~> 1.3' | ||
spec.add_development_dependency 'simplecov', '~> 0.17.1' | ||
spec.add_development_dependency 'webmock', '~> 3.8' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,7 @@ def request_header | |
|
||
def gen_private_key | ||
key = AppleAuth.config.apple_private_key | ||
key = OpenSSL::PKey::EC.new(key) unless key.class == OpenSSL::PKey::EC | ||
key = OpenSSL::PKey::EC.new(key) unless key.instance_of?(OpenSSL::PKey::EC) | ||
key | ||
end | ||
|
||
|
@@ -75,6 +75,18 @@ def client_urls | |
} | ||
end | ||
|
||
# Apple seems to expect the auth_scheme to be on | ||
# the body, the default is :basic_auth | ||
Comment on lines
+78
to
+79
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can remove this comments and include an explain in the readme file that now we already add the |
||
def auth_scheme | ||
{ | ||
auth_scheme: :request_body | ||
} | ||
end | ||
|
||
def oauth_options | ||
client_urls.merge(auth_scheme) | ||
end | ||
|
||
def reponse_hash(access_token) | ||
token_hash = { access_token: access_token.token } | ||
|
||
|
@@ -91,7 +103,7 @@ def reponse_hash(access_token) | |
def apple_access_token | ||
client = ::OAuth2::Client.new(APPLE_CONFIG.apple_client_id, | ||
client_secret_from_jwt, | ||
client_urls) | ||
oauth_options) | ||
client.auth_code.get_token(code, { redirect_uri: APPLE_CONFIG.redirect_uri }, {}) | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this comment and include it in the release notes