File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change 1
1
module OmniAuth
2
2
module OAuth2
3
- VERSION = "1.1.0 "
3
+ VERSION = "1.1.1 "
4
4
end
5
5
end
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ class OAuth2
25
25
option :token_params , { }
26
26
option :token_options , [ ]
27
27
option :auth_token_params , { }
28
+ option :provider_ignores_state , false
28
29
29
30
attr_accessor :access_token
30
31
@@ -49,9 +50,7 @@ def request_phase
49
50
end
50
51
51
52
def authorize_params
52
- if options . authorize_params [ :state ] . to_s . empty?
53
- options . authorize_params [ :state ] = SecureRandom . hex ( 24 )
54
- end
53
+ options . authorize_params [ :state ] = SecureRandom . hex ( 24 )
55
54
params = options . authorize_params . merge ( options . authorize_options . inject ( { } ) { |h , k | h [ k . to_sym ] = options [ k ] if options [ k ] ; h } )
56
55
if OmniAuth . config . test_mode
57
56
@env ||= { }
@@ -69,7 +68,7 @@ def callback_phase
69
68
if request . params [ 'error' ] || request . params [ 'error_reason' ]
70
69
raise CallbackError . new ( request . params [ 'error' ] , request . params [ 'error_description' ] || request . params [ 'error_reason' ] , request . params [ 'error_uri' ] )
71
70
end
72
- if request . params [ 'state' ] . to_s . empty? || request . params [ 'state' ] != session . delete ( 'omniauth.state' )
71
+ if ! options . provider_ignores_state && ( request . params [ 'state' ] . to_s . empty? || request . params [ 'state' ] != session . delete ( 'omniauth.state' ) )
73
72
raise CallbackError . new ( nil , :csrf_detected )
74
73
end
75
74
You can’t perform that action at this time.
0 commit comments