authproto 0.3.0.beta3 → 0.3.0.beta5

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.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +39 -1
  3. data/README.md +474 -311
  4. data/examples/basic_webapp/Gemfile +14 -0
  5. data/examples/{confidential_client → basic_webapp}/Gemfile.lock +1 -1
  6. data/examples/basic_webapp/README.md +300 -0
  7. data/examples/basic_webapp/app.rb +351 -0
  8. data/examples/basic_webapp/config/oauth-client-metadata.localhost.json +11 -0
  9. data/examples/basic_webapp/public/styles.css +346 -0
  10. data/examples/basic_webapp/scripts/generate_keys.rb +35 -0
  11. data/examples/basic_webapp/views/authorized.erb +48 -0
  12. data/examples/basic_webapp/views/index.erb +48 -0
  13. data/examples/{confidential_client → basic_webapp}/views/layout.erb +2 -2
  14. data/examples/bookmarks/Gemfile +16 -0
  15. data/examples/bookmarks/Gemfile.lock +158 -0
  16. data/examples/bookmarks/README.md +170 -0
  17. data/examples/bookmarks/Rakefile +23 -0
  18. data/examples/bookmarks/app/account.rb +16 -0
  19. data/examples/bookmarks/app/bookmark.rb +89 -0
  20. data/examples/bookmarks/app/init.rb +26 -0
  21. data/examples/bookmarks/app/oauth.rb +43 -0
  22. data/examples/bookmarks/app/server.rb +184 -0
  23. data/examples/bookmarks/config/oauth-client-metadata.localhost.json +11 -0
  24. data/examples/bookmarks/config/oauth-client-metadata.production.json +19 -0
  25. data/examples/bookmarks/config.ru +5 -0
  26. data/examples/bookmarks/db/migrate/20261107004141_create_bookmarks.rb +27 -0
  27. data/examples/bookmarks/db/schema.rb +33 -0
  28. data/examples/bookmarks/public/styles.css +59 -0
  29. data/examples/bookmarks/scripts/generate_keys.rb +35 -0
  30. data/examples/bookmarks/views/bookmarks.erb +86 -0
  31. data/examples/bookmarks/views/index.erb +17 -0
  32. data/examples/bookmarks/views/layout.erb +20 -0
  33. data/examples/minisky_console/Gemfile.lock +2 -2
  34. data/examples/minisky_console/README.md +29 -25
  35. data/examples/minisky_console/app.rb +3 -3
  36. data/examples/minisky_console/localhost.rb +5 -7
  37. data/examples/minisky_console/production.rb +6 -8
  38. data/lib/authproto/client.rb +505 -151
  39. data/lib/authproto/configuration.rb +1 -1
  40. data/lib/authproto/dpop/client.rb +28 -25
  41. data/lib/authproto/dpop/key_set.rb +2 -0
  42. data/lib/authproto/dpop/nonce_manager.rb +24 -25
  43. data/lib/authproto/dpop/proof_generator.rb +9 -5
  44. data/lib/authproto/dpop/stored_nonce.rb +7 -5
  45. data/lib/authproto/dpop.rb +2 -0
  46. data/lib/authproto/encryption.rb +31 -12
  47. data/lib/authproto/http_client.rb +13 -12
  48. data/lib/authproto/http_helpers.rb +6 -0
  49. data/lib/authproto/metadata/authorization_server.rb +15 -3
  50. data/lib/authproto/metadata/client_metadata.rb +34 -3
  51. data/lib/authproto/metadata/resource_server.rb +7 -6
  52. data/lib/authproto/minisky.rb +120 -33
  53. data/lib/authproto/par/client.rb +4 -2
  54. data/lib/authproto/par/client_assertion.rb +4 -1
  55. data/lib/authproto/par/request.rb +2 -0
  56. data/lib/authproto/par/response.rb +2 -0
  57. data/lib/authproto/par.rb +2 -0
  58. data/lib/authproto/pkce.rb +2 -0
  59. data/lib/authproto/serialization/session.rb +4 -2
  60. data/lib/authproto/serialization/stored_nonce.rb +2 -2
  61. data/lib/authproto/serialization/token_set.rb +5 -2
  62. data/lib/authproto/state/session.rb +23 -20
  63. data/lib/authproto/state/session_info.rb +150 -0
  64. data/lib/authproto/state/session_manager.rb +46 -19
  65. data/lib/authproto/state/token_set.rb +6 -3
  66. data/lib/authproto/state.rb +4 -2
  67. data/lib/authproto/storage/interface.rb +10 -0
  68. data/lib/authproto/storage/key_builder.rb +3 -3
  69. data/lib/authproto/storage/memory.rb +24 -18
  70. data/lib/authproto/storage/sqlite.rb +14 -0
  71. data/lib/authproto/token/identity.rb +54 -0
  72. data/lib/authproto/token/refresh.rb +44 -54
  73. data/lib/authproto/token/response.rb +75 -0
  74. data/lib/authproto/token/revocation.rb +94 -0
  75. data/lib/authproto/version.rb +1 -1
  76. data/lib/authproto.rb +6 -3
  77. data/sig/authproto/client.rbs +38 -13
  78. data/sig/authproto/dpop/client.rbs +9 -3
  79. data/sig/authproto/dpop/nonce_manager.rbs +6 -6
  80. data/sig/authproto/dpop/proof_generator.rbs +4 -4
  81. data/sig/authproto/dpop/stored_nonce.rbs +2 -2
  82. data/sig/authproto/encryption.rbs +4 -2
  83. data/sig/authproto/http_client.rbs +23 -7
  84. data/sig/authproto/http_helpers.rbs +1 -0
  85. data/sig/authproto/metadata/authorization_server.rbs +3 -3
  86. data/sig/authproto/metadata/client_metadata.rbs +2 -1
  87. data/sig/authproto/metadata/resource_server.rbs +2 -2
  88. data/sig/authproto/minisky.rbs +57 -0
  89. data/sig/authproto/state/session.rbs +13 -4
  90. data/sig/authproto/state/session_info.rbs +23 -0
  91. data/sig/authproto/state/session_manager.rbs +10 -3
  92. data/sig/authproto/storage/interface.rbs +1 -0
  93. data/sig/authproto/storage/key_builder.rbs +1 -1
  94. data/sig/authproto/storage/memory.rbs +1 -1
  95. data/sig/authproto/storage/sqlite.rbs +1 -0
  96. data/sig/authproto/token/refresh.rbs +2 -1
  97. data/sig/authproto/token/response.rbs +12 -0
  98. data/sig/authproto/token/revocation.rbs +15 -0
  99. data/sig/authproto.rbs +3 -8
  100. metadata +53 -19
  101. data/examples/confidential_client/Gemfile +0 -14
  102. data/examples/confidential_client/README.md +0 -236
  103. data/examples/confidential_client/app.rb +0 -291
  104. data/examples/confidential_client/public/styles.css +0 -70
  105. data/examples/confidential_client/scripts/generate_keys.rb +0 -21
  106. data/examples/confidential_client/views/authorized.erb +0 -46
  107. data/examples/confidential_client/views/index.erb +0 -44
  108. data/sig/authproto/minisky_oauth.rbs +0 -27
  109. /data/examples/{confidential_client/config/oauth-client-metadata.example.json → basic_webapp/config/oauth-client-metadata.production.json} +0 -0
  110. /data/examples/{confidential_client → basic_webapp}/config.ru +0 -0
  111. /data/examples/{confidential_client → basic_webapp}/screenshots/screenshot-1-sign-in.png +0 -0
  112. /data/examples/{confidential_client → basic_webapp}/screenshots/screenshot-2-success.png +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 61754b5e7342299c331cabc76c9585ef1f7b1398d0eae4eed252f5d9a2a019bd
4
- data.tar.gz: 5879610764cb56945d3fc260ed0538f5cdaaabfaec4982af38408290a34a547f
3
+ metadata.gz: 523ee74d9fc689f65676a8d6d854e84d38d45f6f22a5e68698aab47b211c10f6
4
+ data.tar.gz: 2d4bb3f7a69d889273a662634c0e519c958c70d0fbd697428a3ae01006c7b339
5
5
  SHA512:
6
- metadata.gz: fe5452fe5a70e70bb3c100b30656eb63fcca61dec4617ccec1413eff03e952156523f39f479096dc2fa23467ad7fa792639571ce5d46a9985049bbb7c0806e82
7
- data.tar.gz: 2c6fb2275d03bf3b812a731841fe2b7364d41b8799f5e937a4c4191d7da0b843d68bd5d67a941dea4f6d4b0590320cd757041f518a3c1416000888ca165583d5
6
+ metadata.gz: db169d4593069312d81e9d8fb866b41d973a7b2e74ca9ae75adcc829325ff0a2ed316c8ff92412311e9e841a575effafbcea1286a90fe50f4fc2292de0ceae35
7
+ data.tar.gz: 9e0c2752138dbb31ca634d4b3715702cb02405cb3ef12b1d90bed3ef52387c990617be70fd7d88b66980d560fdfce8dd7df9de273fb7ee27ce5ae37c39ece6a1
data/CHANGELOG.md CHANGED
@@ -1,4 +1,42 @@
1
- ## [0.3.0.beta3] - 2026-11-02
1
+ ## [0.3.0.beta5] – 2026-11-10
2
+
3
+ - added `process_dpop`, `has_nonce_error?` and `with_nonce_handling` helpers to `Client`, proxying the calls to `dpop_client` for easier access
4
+ - added `Client#http` which lets you access the global HTTP client
5
+ - added `Client.for_localhost` and `Minisky::OAuthClient.for_localhost` for creating a localhost client with metadata encoded in the `client_id` query params
6
+ - added `Client.localhost_app?` helper for checking a client ID
7
+ - added `Minisky::OAuthClient.with_oauth_client` to reuse an existing `AuthProto::Client` instead of creating a new one
8
+ - added `Minisky::OAuthClient#did`
9
+ - renamed `server_url` params to `url` in `Client`, `DPoP::Client` and `DPoP::NonceManager` and to `origin` in `StoredNonce`
10
+ - `Client` now rejects a `metadata` hash passed in argument for localhost clients (since you need to put the values into the `client_id` query params anyway for the server to read them)
11
+ - `Client#handle_callback` now takes the callback parameters as a single Hash parameter instead of keyword args
12
+ - `Client` methods that returned a session data hash, return the data now as a `SessionInfo` object
13
+ - replaced `Client#get_tokens` with `#get_session`; it now returns a session also if it's pending or has an expired access token
14
+ - removed `Client#dpop_client` from public API
15
+ - removed `#granted_scope`, `#has_limited_scope?` and `#authorized?` from `Session`
16
+ - `uri:` and `url:` arguments across the project now accept also `URI` objects
17
+ - response hashes are now accepted also having status code as a String and header values as array, so you can now pass e.g. a `Net::HTTPResponse` as: `{ status: res.code, headers: res.to_hash, body: res.body }`
18
+ - `Minisky::OAuthClient` doesn't require a PDS hostname anymore to create an instance
19
+ - renamed `Minisky::OAuthClient` to `Minisky::OAuth`
20
+ - added `AuthProto.storage.cleanup_expired_records`
21
+
22
+ ## [0.3.0.beta4] – 2026-11-03
23
+
24
+ - at the end of authentication that started with a PDS URL, verify that the received DID belongs to that PDS
25
+ - revoke received tokens if after authentication the DID or PDS doesn't match the previously known value
26
+ - check if the known PDS matches before doing a token refresh
27
+ - fixed decryption code accepting encrypted data with truncated tags
28
+ - fixed token refresh failing if some originally requested scopes were not granted (e.g. email access)
29
+ - fixed token refresh losing the old refresh token if it wasn't actually replaced
30
+ - improved validation of token exchange & token refresh response, and client & resource/authorization server metadata
31
+ - added `#granted_scope`, `#has_limited_scope?` and `#can_be_revoked?` to `Session`
32
+ - added option to explicitly revoke access/refresh tokens on the server when deleting a session, with `delete_session(id, revoke: true)`
33
+ - require the `ATPROTO_MASTER_KEY` to be exactly 32 bytes long (or 44 Base64 characters)
34
+ - require https:// URLs in DPoP client and nonce manager (since resource servers / PDSes and authorization servers need to be on HTTPS)
35
+ - reject token responses with the OpenID `id_token` field
36
+ - when loading a session, verify that it has been created with the same `client_id`
37
+ - ignore the redirect URI's port when testing if the redirect URI passed for authentication for a localhost client is included on the metadata list (as the spec says)
38
+
39
+ ## [0.3.0.beta3] – 2026-11-02
2
40
 
3
41
  - session's state token is deleted on successfully completed authentication (i.e. `handle_callback`)
4
42
  - pending sessions (that haven't completed authentication) are stored with a TTL of 15 minutes by default, and expire after that; this can be changed through `pending_session_ttl` in the global configuration