omniauth 2.4.1 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +16 -3
- data/lib/omniauth/strategy/sign_ins.rb +4 -3
- data/lib/omniauth/version.rb +1 -1
- data/lib/omniauth.rb +16 -1
- data/sig/omniauth.rbs +7 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 490120f013b74e57324066e119c6e364b399437fc66868fe1bbc4f73266d28a0
|
|
4
|
+
data.tar.gz: 4f03b86f521437026926e39bdbbfba5679b4b68d998c469fde0594a951faee93
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6856120ee652c7c34dbce29b2095150191d180c4f74ecad72dfe8f6525516ca4bb689b6d871427c4280ec7b846138dc060e4c31c2f6c0b4882759df70202af23
|
|
7
|
+
data.tar.gz: c9d92661579ecf0c2a740fb27659924835cdbfbfaf1318c40ad0da7a20deb541fe6a230bba95d003d4ce41a38ed82c52ccae233d026826aa51f63f3683a7778f
|
data/README.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
[coveralls]: https://coveralls.io/r/omniauth/omniauth
|
|
17
17
|
|
|
18
18
|
This is the documentation for the in-development branch of OmniAuth.
|
|
19
|
-
You can find the documentation for the latest stable release [here](https://github.com/omniauth/omniauth/tree/v2.4.
|
|
19
|
+
You can find the documentation for the latest stable release [here](https://github.com/omniauth/omniauth/tree/v2.4.2)
|
|
20
20
|
|
|
21
21
|
## An Introduction
|
|
22
22
|
OmniAuth is a library that standardizes multi-provider authentication for
|
|
@@ -89,7 +89,7 @@ environment of a request to `/auth/:provider/callback`. This hash
|
|
|
89
89
|
contains as much information about the user as OmniAuth was able to
|
|
90
90
|
glean from the utilized strategy. You should set up an endpoint in your
|
|
91
91
|
application that matches to the callback URL and then performs whatever
|
|
92
|
-
steps are necessary for your application.
|
|
92
|
+
steps are necessary for your application.
|
|
93
93
|
|
|
94
94
|
The `omniauth.auth` key in the environment hash provides an
|
|
95
95
|
Authentication Hash which will contain information about the just
|
|
@@ -287,7 +287,7 @@ POST /auth/twitter/?return_to=[URL]
|
|
|
287
287
|
```ruby
|
|
288
288
|
provider :twitter, ENV['KEY'], ENV['SECRET'], origin_param: false
|
|
289
289
|
POST /auth/twitter
|
|
290
|
-
# This means the origin should be handled by your own application.
|
|
290
|
+
# This means the origin should be handled by your own application.
|
|
291
291
|
# Note that `omniauth.origin` will always be blank.
|
|
292
292
|
```
|
|
293
293
|
|
|
@@ -392,6 +392,19 @@ no params with more than 512 bytes in their keys and values. A callback
|
|
|
392
392
|
whose params were too large to keep gets empty `omniauth.params`, and
|
|
393
393
|
OmniAuth logs a warning.
|
|
394
394
|
|
|
395
|
+
`OmniAuth.config.max_remembered_sign_ins` and
|
|
396
|
+
`OmniAuth.config.max_remembered_params_bytesize` change these limits. If
|
|
397
|
+
your app keeps its session in a cookie, raising them can push it past
|
|
398
|
+
4 KB and make sign-ins fail, so raise them only if your session store has
|
|
399
|
+
room.
|
|
400
|
+
|
|
401
|
+
```ruby
|
|
402
|
+
OmniAuth.configure do |config|
|
|
403
|
+
config.max_remembered_sign_ins = 5
|
|
404
|
+
config.max_remembered_params_bytesize = 1024
|
|
405
|
+
end
|
|
406
|
+
```
|
|
407
|
+
|
|
395
408
|
A strategy that needs its own values in the callback, such as an OAuth 2.0
|
|
396
409
|
PKCE verifier, can store them in the same sign-in instead of under another
|
|
397
410
|
session key, so the key isn't stored twice. It passes them to
|
|
@@ -42,7 +42,7 @@ module OmniAuth
|
|
|
42
42
|
sign_ins = remembered_sign_ins
|
|
43
43
|
sign_ins.delete(key)
|
|
44
44
|
sign_ins[key] = sign_in
|
|
45
|
-
session['omniauth.sign_ins'] = sign_ins.to_a.last(
|
|
45
|
+
session['omniauth.sign_ins'] = sign_ins.to_a.last(OmniAuth.config.max_remembered_sign_ins).to_h
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
# The key the callback sends back, which a strategy that calls
|
|
@@ -100,9 +100,10 @@ module OmniAuth
|
|
|
100
100
|
end
|
|
101
101
|
|
|
102
102
|
def params_small_enough?(params)
|
|
103
|
+
max = OmniAuth.config.max_remembered_params_bytesize
|
|
103
104
|
bytesize = params_bytesize(params)
|
|
104
|
-
small_enough = bytesize <=
|
|
105
|
-
log :warn, "Not remembering #{bytesize} bytes of params for this sign-in, more than #{
|
|
105
|
+
small_enough = bytesize <= max
|
|
106
|
+
log :warn, "Not remembering #{bytesize} bytes of params for this sign-in, more than #{max}. The callback gets empty omniauth.params." unless small_enough
|
|
106
107
|
small_enough
|
|
107
108
|
end
|
|
108
109
|
|
data/lib/omniauth/version.rb
CHANGED
data/lib/omniauth.rb
CHANGED
|
@@ -47,7 +47,9 @@ module OmniAuth
|
|
|
47
47
|
:allowed_request_methods => %i[post],
|
|
48
48
|
:mock_auth => {:default => AuthHash.new('provider' => 'default', 'uid' => '1234', 'info' => {'name' => 'Example User'})},
|
|
49
49
|
:silence_get_warning => false,
|
|
50
|
-
:allowed_hosts => nil
|
|
50
|
+
:allowed_hosts => nil,
|
|
51
|
+
:max_remembered_sign_ins => Strategy::SignIns::MAX_REMEMBERED_SIGN_INS,
|
|
52
|
+
:max_remembered_params_bytesize => Strategy::SignIns::MAX_REMEMBERED_PARAMS_BYTESIZE
|
|
51
53
|
}
|
|
52
54
|
end
|
|
53
55
|
|
|
@@ -133,6 +135,19 @@ module OmniAuth
|
|
|
133
135
|
camelizations[name.to_s] = camelized.to_s
|
|
134
136
|
end
|
|
135
137
|
|
|
138
|
+
def max_remembered_sign_ins=(value)
|
|
139
|
+
raise ArgumentError.new('max_remembered_sign_ins must be an Integer of at least 1') unless value.instance_of?(Integer) && value >= 1
|
|
140
|
+
|
|
141
|
+
@max_remembered_sign_ins = value
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def max_remembered_params_bytesize=(value)
|
|
145
|
+
raise ArgumentError.new('max_remembered_params_bytesize must be an Integer of at least 0') unless value.instance_of?(Integer) && value >= 0
|
|
146
|
+
|
|
147
|
+
@max_remembered_params_bytesize = value
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
attr_reader :max_remembered_sign_ins, :max_remembered_params_bytesize
|
|
136
151
|
attr_writer :on_failure, :before_callback_phase, :before_options_phase, :before_request_phase, :after_request_phase, :request_validation_phase
|
|
137
152
|
attr_accessor :failure_raise_out_environments, :path_prefix, :allowed_request_methods, :form_css,
|
|
138
153
|
:test_mode, :mock_auth, :full_host, :camelizations, :logger, :silence_get_warning,
|
data/sig/omniauth.rbs
CHANGED
|
@@ -74,6 +74,13 @@ module OmniAuth
|
|
|
74
74
|
|
|
75
75
|
def add_camelization: (String | Symbol name, String | Symbol camelized) -> String
|
|
76
76
|
|
|
77
|
+
def max_remembered_sign_ins=: (Integer) -> Integer
|
|
78
|
+
|
|
79
|
+
def max_remembered_params_bytesize=: (Integer) -> Integer
|
|
80
|
+
|
|
81
|
+
attr_reader max_remembered_sign_ins: Integer
|
|
82
|
+
attr_reader max_remembered_params_bytesize: Integer
|
|
83
|
+
|
|
77
84
|
attr_writer on_failure: _EnvCallable
|
|
78
85
|
attr_writer before_callback_phase: hook
|
|
79
86
|
attr_writer before_options_phase: hook
|