ask-auth 0.3.2 → 0.3.3
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/CHANGELOG.md +16 -0
- data/lib/ask/auth/providers/oauth.rb +11 -3
- data/lib/ask/auth/version.rb +1 -1
- 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: 62fd78e86d9cb1014d3c1edc874b037073fc8fda38247c10441401b88c96cb43
|
|
4
|
+
data.tar.gz: c836b2db286075e95d081aa483762bf17f4332d4c306bb4a58cfd5d1323272ac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9ade8a91063788a2e247c72b189f850debaad6144c5f2270cbf900354aa2d366a127ac1f6d862b3197d944cc201dc582ca7d86fb2f8a6ba7c9e6acc8ccac1775
|
|
7
|
+
data.tar.gz: c924696e695d30d1d35367ae00e96293add344374e316d7deccca93ad2b5afad85103537c64cac90783f18866ef41c43d5deb5db9ddaf1adf62a1a460d2fd25b
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## [0.3.3] — 2026-08-18
|
|
2
|
+
|
|
3
|
+
### Fixed
|
|
4
|
+
|
|
5
|
+
- **`OAuth#fetch_oauth_state` tolerates string keys.** Cookie session stores
|
|
6
|
+
serialize to JSON, converting symbol keys to strings. The verifier lookup
|
|
7
|
+
now falls back to `value[key.to_s]` when the symbol lookup returns nil.
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **`OAuth` accepts `client_secret:` for token exchange.** Providers that
|
|
12
|
+
require a client secret (e.g. GitHub OAuth) can now pass it at
|
|
13
|
+
construction. The secret is included in `token_exchange` and `refresh`
|
|
14
|
+
requests when present, and omitted when nil — preserving backwards
|
|
15
|
+
compatibility with PKCE-only flows.
|
|
16
|
+
|
|
1
17
|
## [0.3.2] — 2026-08-13
|
|
2
18
|
|
|
3
19
|
### Added
|
|
@@ -29,12 +29,14 @@ module Ask
|
|
|
29
29
|
# Subclasses override #parse_token_response to add provider-specific
|
|
30
30
|
# fields (e.g. an account id from the id_token).
|
|
31
31
|
class OAuth
|
|
32
|
-
attr_reader :client_id, :redirect_uri
|
|
32
|
+
attr_reader :client_id, :client_secret, :redirect_uri
|
|
33
33
|
|
|
34
|
-
def initialize(storage: nil, client_id: nil,
|
|
34
|
+
def initialize(storage: nil, client_id: nil, client_secret: nil,
|
|
35
|
+
authorize_url: nil, token_url: nil,
|
|
35
36
|
redirect_uri: nil, scope: nil, http: Ask::Auth::OAuth::HTTP)
|
|
36
37
|
@storage = storage
|
|
37
38
|
@client_id = client_id
|
|
39
|
+
@client_secret = client_secret
|
|
38
40
|
@authorize_url = authorize_url
|
|
39
41
|
@token_url = token_url
|
|
40
42
|
@redirect_uri = redirect_uri
|
|
@@ -121,6 +123,7 @@ module Ask
|
|
|
121
123
|
def token_exchange(**params)
|
|
122
124
|
raise OAuthError, "token_url not configured" if @token_url.to_s.empty?
|
|
123
125
|
|
|
126
|
+
params[:client_secret] = client_secret if client_secret
|
|
124
127
|
status, body = @http.post_form(@token_url, params)
|
|
125
128
|
raise OAuthError, "token exchange failed (#{status}): #{body.to_s[0, 200]}" unless status == 200
|
|
126
129
|
|
|
@@ -153,7 +156,12 @@ module Ask
|
|
|
153
156
|
return nil unless @storage.respond_to?(:fetch) && user
|
|
154
157
|
|
|
155
158
|
value = @storage.fetch(:oauth_state, user: user)
|
|
156
|
-
value.is_a?(Hash)
|
|
159
|
+
return nil unless value.is_a?(Hash)
|
|
160
|
+
|
|
161
|
+
# Symbol keys survive Ruby→JSON→Ruby round-trips, but cookie
|
|
162
|
+
# session stores serialize to JSON (converting symbols to strings).
|
|
163
|
+
# Support both by falling back to the string representation.
|
|
164
|
+
value[key] || value[key.to_s]
|
|
157
165
|
end
|
|
158
166
|
end
|
|
159
167
|
end
|
data/lib/ask/auth/version.rb
CHANGED