Skip to content

Commit

Permalink
Support omniauth 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BobbyMcWho committed Jan 13, 2021
1 parent c620a75 commit 8d29931
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
3 changes: 1 addition & 2 deletions lib/omniauth/rails_csrf_protection/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ module OmniAuth
module RailsCsrfProtection
class Railtie < Rails::Railtie
initializer "omniauth-rails_csrf_protection.initialize" do
OmniAuth.config.allowed_request_methods = [:post]
OmniAuth.config.before_request_phase = TokenVerifier.new
OmniAuth.config.request_validation_phase = TokenVerifier.new
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/omniauth/rails_csrf_protection/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module OmniAuth
module RailsCsrfProtection
VERSION = "0.1.2".freeze
VERSION = "1.0.0".freeze
end
end
2 changes: 1 addition & 1 deletion omniauth-rails_csrf_protection.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]

spec.add_dependency "actionpack", ">= 4.2"
spec.add_dependency "omniauth", ">= 1.3.1"
spec.add_dependency "omniauth", "~> 2.0"

spec.add_development_dependency "bundler"
spec.add_development_dependency "minitest"
Expand Down
6 changes: 4 additions & 2 deletions test/application_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ def test_request_phrase_not_accessible_via_get

def test_request_phrase_without_token_via_post
post "/auth/developer"
follow_redirect!

assert last_response.unprocessable?
assert last_response.not_found?
end

def test_request_phrase_with_bad_token_via_post
post "/auth/developer", authenticity_token: "BAD_TOKEN"
follow_redirect!

assert last_response.unprocessable?
assert last_response.not_found?
end

def test_request_phrase_with_correct_token_via_post
Expand Down

0 comments on commit 8d29931

Please sign in to comment.