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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +39 -1
- data/README.md +474 -311
- data/examples/basic_webapp/Gemfile +14 -0
- data/examples/{confidential_client → basic_webapp}/Gemfile.lock +1 -1
- data/examples/basic_webapp/README.md +300 -0
- data/examples/basic_webapp/app.rb +351 -0
- data/examples/basic_webapp/config/oauth-client-metadata.localhost.json +11 -0
- data/examples/basic_webapp/public/styles.css +346 -0
- data/examples/basic_webapp/scripts/generate_keys.rb +35 -0
- data/examples/basic_webapp/views/authorized.erb +48 -0
- data/examples/basic_webapp/views/index.erb +48 -0
- data/examples/{confidential_client → basic_webapp}/views/layout.erb +2 -2
- data/examples/bookmarks/Gemfile +16 -0
- data/examples/bookmarks/Gemfile.lock +158 -0
- data/examples/bookmarks/README.md +170 -0
- data/examples/bookmarks/Rakefile +23 -0
- data/examples/bookmarks/app/account.rb +16 -0
- data/examples/bookmarks/app/bookmark.rb +89 -0
- data/examples/bookmarks/app/init.rb +26 -0
- data/examples/bookmarks/app/oauth.rb +43 -0
- data/examples/bookmarks/app/server.rb +184 -0
- data/examples/bookmarks/config/oauth-client-metadata.localhost.json +11 -0
- data/examples/bookmarks/config/oauth-client-metadata.production.json +19 -0
- data/examples/bookmarks/config.ru +5 -0
- data/examples/bookmarks/db/migrate/20261107004141_create_bookmarks.rb +27 -0
- data/examples/bookmarks/db/schema.rb +33 -0
- data/examples/bookmarks/public/styles.css +59 -0
- data/examples/bookmarks/scripts/generate_keys.rb +35 -0
- data/examples/bookmarks/views/bookmarks.erb +86 -0
- data/examples/bookmarks/views/index.erb +17 -0
- data/examples/bookmarks/views/layout.erb +20 -0
- data/examples/minisky_console/Gemfile.lock +2 -2
- data/examples/minisky_console/README.md +29 -25
- data/examples/minisky_console/app.rb +3 -3
- data/examples/minisky_console/localhost.rb +5 -7
- data/examples/minisky_console/production.rb +6 -8
- data/lib/authproto/client.rb +505 -151
- data/lib/authproto/configuration.rb +1 -1
- data/lib/authproto/dpop/client.rb +28 -25
- data/lib/authproto/dpop/key_set.rb +2 -0
- data/lib/authproto/dpop/nonce_manager.rb +24 -25
- data/lib/authproto/dpop/proof_generator.rb +9 -5
- data/lib/authproto/dpop/stored_nonce.rb +7 -5
- data/lib/authproto/dpop.rb +2 -0
- data/lib/authproto/encryption.rb +31 -12
- data/lib/authproto/http_client.rb +13 -12
- data/lib/authproto/http_helpers.rb +6 -0
- data/lib/authproto/metadata/authorization_server.rb +15 -3
- data/lib/authproto/metadata/client_metadata.rb +34 -3
- data/lib/authproto/metadata/resource_server.rb +7 -6
- data/lib/authproto/minisky.rb +120 -33
- data/lib/authproto/par/client.rb +4 -2
- data/lib/authproto/par/client_assertion.rb +4 -1
- data/lib/authproto/par/request.rb +2 -0
- data/lib/authproto/par/response.rb +2 -0
- data/lib/authproto/par.rb +2 -0
- data/lib/authproto/pkce.rb +2 -0
- data/lib/authproto/serialization/session.rb +4 -2
- data/lib/authproto/serialization/stored_nonce.rb +2 -2
- data/lib/authproto/serialization/token_set.rb +5 -2
- data/lib/authproto/state/session.rb +23 -20
- data/lib/authproto/state/session_info.rb +150 -0
- data/lib/authproto/state/session_manager.rb +46 -19
- data/lib/authproto/state/token_set.rb +6 -3
- data/lib/authproto/state.rb +4 -2
- data/lib/authproto/storage/interface.rb +10 -0
- data/lib/authproto/storage/key_builder.rb +3 -3
- data/lib/authproto/storage/memory.rb +24 -18
- data/lib/authproto/storage/sqlite.rb +14 -0
- data/lib/authproto/token/identity.rb +54 -0
- data/lib/authproto/token/refresh.rb +44 -54
- data/lib/authproto/token/response.rb +75 -0
- data/lib/authproto/token/revocation.rb +94 -0
- data/lib/authproto/version.rb +1 -1
- data/lib/authproto.rb +6 -3
- data/sig/authproto/client.rbs +38 -13
- data/sig/authproto/dpop/client.rbs +9 -3
- data/sig/authproto/dpop/nonce_manager.rbs +6 -6
- data/sig/authproto/dpop/proof_generator.rbs +4 -4
- data/sig/authproto/dpop/stored_nonce.rbs +2 -2
- data/sig/authproto/encryption.rbs +4 -2
- data/sig/authproto/http_client.rbs +23 -7
- data/sig/authproto/http_helpers.rbs +1 -0
- data/sig/authproto/metadata/authorization_server.rbs +3 -3
- data/sig/authproto/metadata/client_metadata.rbs +2 -1
- data/sig/authproto/metadata/resource_server.rbs +2 -2
- data/sig/authproto/minisky.rbs +57 -0
- data/sig/authproto/state/session.rbs +13 -4
- data/sig/authproto/state/session_info.rbs +23 -0
- data/sig/authproto/state/session_manager.rbs +10 -3
- data/sig/authproto/storage/interface.rbs +1 -0
- data/sig/authproto/storage/key_builder.rbs +1 -1
- data/sig/authproto/storage/memory.rbs +1 -1
- data/sig/authproto/storage/sqlite.rbs +1 -0
- data/sig/authproto/token/refresh.rbs +2 -1
- data/sig/authproto/token/response.rbs +12 -0
- data/sig/authproto/token/revocation.rbs +15 -0
- data/sig/authproto.rbs +3 -8
- metadata +53 -19
- data/examples/confidential_client/Gemfile +0 -14
- data/examples/confidential_client/README.md +0 -236
- data/examples/confidential_client/app.rb +0 -291
- data/examples/confidential_client/public/styles.css +0 -70
- data/examples/confidential_client/scripts/generate_keys.rb +0 -21
- data/examples/confidential_client/views/authorized.erb +0 -46
- data/examples/confidential_client/views/index.erb +0 -44
- data/sig/authproto/minisky_oauth.rbs +0 -27
- /data/examples/{confidential_client/config/oauth-client-metadata.example.json → basic_webapp/config/oauth-client-metadata.production.json} +0 -0
- /data/examples/{confidential_client → basic_webapp}/config.ru +0 -0
- /data/examples/{confidential_client → basic_webapp}/screenshots/screenshot-1-sign-in.png +0 -0
- /data/examples/{confidential_client → basic_webapp}/screenshots/screenshot-2-success.png +0 -0
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
*,
|
|
2
|
+
::before,
|
|
3
|
+
::after {
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
border: 0 solid #e5e7eb;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
html {
|
|
9
|
+
line-height: 1.5;
|
|
10
|
+
-webkit-text-size-adjust: 100%;
|
|
11
|
+
tab-size: 4;
|
|
12
|
+
font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
|
|
13
|
+
"Segoe UI Symbol", "Noto Color Emoji";
|
|
14
|
+
-webkit-tap-highlight-color: transparent;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
body,
|
|
18
|
+
h1,
|
|
19
|
+
p,
|
|
20
|
+
pre {
|
|
21
|
+
margin: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
body {
|
|
25
|
+
line-height: inherit;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
h1 {
|
|
29
|
+
font-size: inherit;
|
|
30
|
+
font-weight: inherit;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
a {
|
|
34
|
+
color: inherit;
|
|
35
|
+
text-decoration: inherit;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
button,
|
|
39
|
+
input,
|
|
40
|
+
textarea {
|
|
41
|
+
margin: 0;
|
|
42
|
+
padding: 0;
|
|
43
|
+
font: inherit;
|
|
44
|
+
letter-spacing: inherit;
|
|
45
|
+
color: inherit;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
button {
|
|
49
|
+
appearance: button;
|
|
50
|
+
-webkit-appearance: button;
|
|
51
|
+
text-transform: none;
|
|
52
|
+
background: transparent;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
fieldset {
|
|
56
|
+
min-width: 0;
|
|
57
|
+
margin: 0;
|
|
58
|
+
padding: 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
textarea {
|
|
62
|
+
resize: vertical;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
input::placeholder,
|
|
66
|
+
textarea::placeholder {
|
|
67
|
+
color: #9ca3af;
|
|
68
|
+
opacity: 1;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
svg {
|
|
72
|
+
display: block;
|
|
73
|
+
vertical-align: middle;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
pre,
|
|
77
|
+
code {
|
|
78
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
79
|
+
font-size: 10pt;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.page {
|
|
83
|
+
display: flex;
|
|
84
|
+
min-height: 100vh;
|
|
85
|
+
flex-direction: column;
|
|
86
|
+
align-items: center;
|
|
87
|
+
background-color: #fff;
|
|
88
|
+
color: #111827;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.page-header {
|
|
92
|
+
padding: 1rem 1.5rem 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.page-title {
|
|
96
|
+
margin-bottom: 1rem;
|
|
97
|
+
font-size: 1.25rem;
|
|
98
|
+
line-height: 1.75rem;
|
|
99
|
+
font-weight: 600;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.page-description {
|
|
103
|
+
display: none;
|
|
104
|
+
max-width: 20rem;
|
|
105
|
+
color: #6b7280;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.page-content {
|
|
109
|
+
width: 100%;
|
|
110
|
+
padding: 1rem 1.5rem 1.5rem;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.form {
|
|
114
|
+
display: flex;
|
|
115
|
+
flex-direction: column;
|
|
116
|
+
padding: 1rem 0;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.form > :not([hidden]) ~ :not([hidden]),
|
|
120
|
+
.form-fields > :not([hidden]) ~ :not([hidden]) {
|
|
121
|
+
margin-top: 1rem;
|
|
122
|
+
margin-bottom: 0;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.authorized-content > :not([hidden]) ~ :not([hidden]) {
|
|
126
|
+
margin-top: 2rem;
|
|
127
|
+
margin-bottom: 0;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.message {
|
|
131
|
+
margin-bottom: 2rem;
|
|
132
|
+
padding: 1rem;
|
|
133
|
+
border-radius: 0.375rem;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.message-error {
|
|
137
|
+
border-color: #b91c1c;
|
|
138
|
+
background-color: #fef2f2;
|
|
139
|
+
color: #b91c1c;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.message-notice {
|
|
143
|
+
border-color: #a16207;
|
|
144
|
+
background-color: #fefce8;
|
|
145
|
+
color: #a16207;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.message-success {
|
|
149
|
+
border-color: #15803d;
|
|
150
|
+
background-color: #f0fdf4;
|
|
151
|
+
color: #15803d;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.field-label {
|
|
155
|
+
display: block;
|
|
156
|
+
margin-bottom: 0.25rem;
|
|
157
|
+
color: #4b5563;
|
|
158
|
+
font-size: 0.875rem;
|
|
159
|
+
line-height: 1.25rem;
|
|
160
|
+
font-weight: 500;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.handle-field {
|
|
164
|
+
display: flex;
|
|
165
|
+
flex-direction: column;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.handle-input,
|
|
169
|
+
.post-input {
|
|
170
|
+
border: 2px solid transparent;
|
|
171
|
+
border-radius: 0.5rem;
|
|
172
|
+
outline: 2px solid transparent;
|
|
173
|
+
outline-offset: 2px;
|
|
174
|
+
background-color: #f3f4f6;
|
|
175
|
+
color: #374151;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.handle-input {
|
|
179
|
+
display: flex;
|
|
180
|
+
min-height: 3rem;
|
|
181
|
+
align-items: center;
|
|
182
|
+
justify-content: stretch;
|
|
183
|
+
padding-right: 0.5rem;
|
|
184
|
+
padding-left: 0.25rem;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.handle-input:hover,
|
|
188
|
+
.post-input:hover {
|
|
189
|
+
border-color: #9ca3af;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.handle-input:focus-within {
|
|
193
|
+
background-color: #e5e7eb;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.handle-icon {
|
|
197
|
+
display: flex;
|
|
198
|
+
width: 2rem;
|
|
199
|
+
height: 3rem;
|
|
200
|
+
flex: 0 0 auto;
|
|
201
|
+
align-self: flex-start;
|
|
202
|
+
align-items: center;
|
|
203
|
+
justify-content: center;
|
|
204
|
+
color: #6b7280;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.handle-icon-image {
|
|
208
|
+
width: 1.25rem;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.handle-input-control {
|
|
212
|
+
position: relative;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.text-input {
|
|
216
|
+
width: 100%;
|
|
217
|
+
outline: 2px solid transparent;
|
|
218
|
+
outline-offset: 2px;
|
|
219
|
+
background-color: transparent;
|
|
220
|
+
background-clip: padding-box;
|
|
221
|
+
font-size: 1rem;
|
|
222
|
+
line-height: 1.5rem;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.post-input {
|
|
226
|
+
width: 100%;
|
|
227
|
+
padding: 0.75rem;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.form-actions {
|
|
231
|
+
padding-top: 1rem;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.button {
|
|
235
|
+
padding: 0.5rem 1.5rem;
|
|
236
|
+
border-radius: 0.5rem;
|
|
237
|
+
background-color: #60a5fa;
|
|
238
|
+
color: #fff;
|
|
239
|
+
cursor: pointer;
|
|
240
|
+
touch-action: manipulation;
|
|
241
|
+
letter-spacing: 0.025em;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.button-truncate {
|
|
245
|
+
overflow: hidden;
|
|
246
|
+
text-overflow: ellipsis;
|
|
247
|
+
white-space: nowrap;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.data-output {
|
|
251
|
+
overflow: auto;
|
|
252
|
+
padding: 0.5rem;
|
|
253
|
+
border: 1px solid #9ca3af;
|
|
254
|
+
border-radius: 0.5rem;
|
|
255
|
+
background-color: #f3f4f6;
|
|
256
|
+
color: #374151;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.logout-actions {
|
|
260
|
+
display: flex;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
@media (min-width: 768px) {
|
|
264
|
+
.page {
|
|
265
|
+
flex-direction: row;
|
|
266
|
+
justify-content: stretch;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.page-header {
|
|
270
|
+
display: grid;
|
|
271
|
+
width: 50%;
|
|
272
|
+
max-width: 32rem;
|
|
273
|
+
align-self: stretch;
|
|
274
|
+
align-content: center;
|
|
275
|
+
justify-items: end;
|
|
276
|
+
padding: 1rem;
|
|
277
|
+
background-color: #f3f4f6;
|
|
278
|
+
text-align: right;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.page-title {
|
|
282
|
+
margin-top: 1rem;
|
|
283
|
+
font-size: 1.5rem;
|
|
284
|
+
line-height: 2rem;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.page-description {
|
|
288
|
+
display: block;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.page-content {
|
|
292
|
+
max-width: 48rem;
|
|
293
|
+
padding-right: 3rem;
|
|
294
|
+
padding-left: 3rem;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
@media (min-width: 1024px) {
|
|
299
|
+
.page-title {
|
|
300
|
+
font-size: 3rem;
|
|
301
|
+
line-height: 1;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
@media (prefers-color-scheme: dark) {
|
|
306
|
+
.page {
|
|
307
|
+
background-color: #111827;
|
|
308
|
+
color: #f3f4f6;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.field-label {
|
|
312
|
+
color: #9ca3af;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.handle-input,
|
|
316
|
+
.post-input {
|
|
317
|
+
background-color: #1f2937;
|
|
318
|
+
color: #f3f4f6;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.handle-input:focus-within {
|
|
322
|
+
background-color: #374151;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.handle-input:hover,
|
|
326
|
+
.post-input:hover {
|
|
327
|
+
border-color: #6b7280;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.text-input::placeholder {
|
|
331
|
+
color: #6b7280;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.data-output {
|
|
335
|
+
background-color: #1e293b;
|
|
336
|
+
color: #f3f4f6;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
@media (min-width: 768px) and (prefers-color-scheme: dark) {
|
|
341
|
+
.page-header {
|
|
342
|
+
border-right-width: 1px;
|
|
343
|
+
border-color: #374151;
|
|
344
|
+
background-color: #1f2937;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require 'jose'
|
|
5
|
+
require 'json'
|
|
6
|
+
|
|
7
|
+
key = JOSE::JWK.generate_key([:ec, "P-256"])
|
|
8
|
+
key_id = "key-#{Time.now.to_i}"
|
|
9
|
+
|
|
10
|
+
private_jwk = key.to_map.to_h.merge("kid" => key_id, "use" => "sig")
|
|
11
|
+
public_jwk = key.to_public_map.to_h.merge("kid" => key_id, "use" => "sig")
|
|
12
|
+
|
|
13
|
+
puts "=" * 40
|
|
14
|
+
puts "PRIVATE KEY".center(40)
|
|
15
|
+
puts "=" * 40
|
|
16
|
+
|
|
17
|
+
puts
|
|
18
|
+
puts "Copy this JSON into config/keys.json. The key object should be passed as the `singing_key` to the " +
|
|
19
|
+
"`AuthProto::Client` initializer. It must NOT be accessible publicly."
|
|
20
|
+
puts
|
|
21
|
+
|
|
22
|
+
puts JSON.pretty_generate('keys' => [private_jwk])
|
|
23
|
+
puts
|
|
24
|
+
|
|
25
|
+
puts "=" * 40
|
|
26
|
+
puts "PUBLIC KEY".center(40)
|
|
27
|
+
puts "=" * 40
|
|
28
|
+
|
|
29
|
+
puts
|
|
30
|
+
puts "Copy this JSON into config/oauth-client-metadata.json. This is a public key read by the authorization " +
|
|
31
|
+
"server so that it can validate the client assertions generated by your app."
|
|
32
|
+
puts
|
|
33
|
+
|
|
34
|
+
puts JSON.pretty_generate('jwks' => { 'keys' => [public_jwk] })
|
|
35
|
+
puts
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<div class="page">
|
|
2
|
+
<div class="page-header">
|
|
3
|
+
<h1 class="page-title">Successfully Authenticated!</h1>
|
|
4
|
+
</div>
|
|
5
|
+
|
|
6
|
+
<div class="page-content">
|
|
7
|
+
<div class="authorized-content">
|
|
8
|
+
<% if session[:error] %>
|
|
9
|
+
<div class="message message-error">
|
|
10
|
+
<%= html_escape session[:error] %>
|
|
11
|
+
<% session[:error] = nil %>
|
|
12
|
+
</div>
|
|
13
|
+
<% end %>
|
|
14
|
+
|
|
15
|
+
<% if session[:notice] %>
|
|
16
|
+
<div class="message message-success">
|
|
17
|
+
<%= html_escape session[:notice] %>
|
|
18
|
+
<% session[:notice] = nil %>
|
|
19
|
+
</div>
|
|
20
|
+
<% end %>
|
|
21
|
+
|
|
22
|
+
<form method="post" action="/posts" class="form">
|
|
23
|
+
<fieldset>
|
|
24
|
+
<label for="post-text" class="field-label">New Bluesky post</label>
|
|
25
|
+
<textarea id="post-text" name="text" rows="4" maxlength="300" required
|
|
26
|
+
placeholder="What's up?" class="post-input"></textarea>
|
|
27
|
+
</fieldset>
|
|
28
|
+
<div>
|
|
29
|
+
<button type="submit" class="button">Post to Bluesky</button>
|
|
30
|
+
</div>
|
|
31
|
+
</form>
|
|
32
|
+
|
|
33
|
+
<div class="token-info">
|
|
34
|
+
<p class="field-label">Token Information</p>
|
|
35
|
+
<pre class="data-output"><code><%= @session ? html_escape(JSON.pretty_generate(@session.to_h)) : "\n" %></code></pre>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<div class="api-test">
|
|
39
|
+
<p class="field-label">Test API Call Result</p>
|
|
40
|
+
<pre class="data-output"><code><%= @api_result ? html_escape(JSON.pretty_generate(@api_result)) : "\n" %></code></pre>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div class="logout-actions">
|
|
44
|
+
<a href="/logout" aria-label="Log out" class="button button-truncate">Log out</a>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<div class="page">
|
|
2
|
+
<div class="page-header">
|
|
3
|
+
<h1 class="page-title">Sign in</h1>
|
|
4
|
+
<p class="page-description">Enter your AT Protocol handle</p>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<div class="page-content">
|
|
8
|
+
<form method="post" action="/authenticate" class="form">
|
|
9
|
+
<div class="form-fields">
|
|
10
|
+
<% if session[:error] %>
|
|
11
|
+
<div class="message message-error">
|
|
12
|
+
<%= html_escape session[:error] %>
|
|
13
|
+
<% session[:error] = nil %>
|
|
14
|
+
</div>
|
|
15
|
+
<% end %>
|
|
16
|
+
|
|
17
|
+
<% if session[:notice] %>
|
|
18
|
+
<div class="message message-notice">
|
|
19
|
+
<%= html_escape session[:notice] %>
|
|
20
|
+
<% session[:notice] = nil %>
|
|
21
|
+
</div>
|
|
22
|
+
<% end %>
|
|
23
|
+
|
|
24
|
+
<fieldset>
|
|
25
|
+
<p class="field-label">Handle</p>
|
|
26
|
+
<div class="handle-field">
|
|
27
|
+
<div class="handle-input">
|
|
28
|
+
<div class="handle-icon">
|
|
29
|
+
<div>
|
|
30
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="handle-icon-image">
|
|
31
|
+
<path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M12 4a8 8 0 1 0 4.21 14.804 1 1 0 0 1 1.054 1.7A9.958 9.958 0 0 1 12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10c0 1.104-.27 2.31-.949 3.243-.716.984-1.849 1.6-3.331 1.465a4.207 4.207 0 0 1-2.93-1.585c-.94 1.21-2.388 1.94-3.985 1.715-2.53-.356-4.04-2.91-3.682-5.458.358-2.547 2.514-4.586 5.044-4.23.905.127 1.68.536 2.286 1.126a1 1 0 0 1 1.964.368l-.515 3.545v.002a2.222 2.222 0 0 0 1.999 2.526c.75.068 1.212-.21 1.533-.65.358-.493.566-1.245.566-2.067a8 8 0 0 0-8-8Zm-.112 5.13c-1.195-.168-2.544.819-2.784 2.529-.24 1.71.784 3.03 1.98 3.198 1.195.168 2.543-.819 2.784-2.529.24-1.71-.784-3.03-1.98-3.198Z"></path>
|
|
32
|
+
</svg>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
<div class="handle-input-control">
|
|
36
|
+
<input class="text-input" name="handle" type="text" placeholder="handle.bsky.social" aria-label="Handle" autocapitalize="none" autocorrect="off" autocomplete="username" spellcheck="false" dir="auto" enterkeyhint="next" required title="valid handle">
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</fieldset>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div class="form-actions">
|
|
44
|
+
<button role="Button" type="submit" aria-label="Next" class="button button-truncate">Next</button>
|
|
45
|
+
</div>
|
|
46
|
+
</form>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<title>AT Protocol OAuth Example</title>
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<
|
|
6
|
+
<link rel="stylesheet" href="/styles.css">
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
|
9
|
-
<%= yield %>
|
|
9
|
+
<%= yield %>
|
|
10
10
|
</body>
|
|
11
11
|
</html>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
source 'https://rubygems.org'
|
|
4
|
+
|
|
5
|
+
gem 'activerecord', '~> 8.1'
|
|
6
|
+
gem 'authproto', path: '../..'
|
|
7
|
+
gem 'dotenv'
|
|
8
|
+
gem 'minisky', '~> 0.5.1'
|
|
9
|
+
gem 'puma'
|
|
10
|
+
gem 'rackup'
|
|
11
|
+
gem 'rake'
|
|
12
|
+
gem 'sinatra'
|
|
13
|
+
gem 'sinatra-activerecord', '~> 2.0'
|
|
14
|
+
gem 'sinatra-contrib'
|
|
15
|
+
gem 'sqlite3', '~> 2.10'
|
|
16
|
+
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: ../..
|
|
3
|
+
specs:
|
|
4
|
+
authproto (0.3.0.beta5)
|
|
5
|
+
didkit (~> 0.5.0)
|
|
6
|
+
jose (~> 1.2)
|
|
7
|
+
jwt (~> 3.3)
|
|
8
|
+
|
|
9
|
+
GEM
|
|
10
|
+
remote: https://rubygems.org/
|
|
11
|
+
specs:
|
|
12
|
+
activemodel (8.1.4.1)
|
|
13
|
+
activesupport (= 8.1.4.1)
|
|
14
|
+
activerecord (8.1.4.1)
|
|
15
|
+
activemodel (= 8.1.4.1)
|
|
16
|
+
activesupport (= 8.1.4.1)
|
|
17
|
+
timeout (>= 0.4.0)
|
|
18
|
+
activesupport (8.1.4.1)
|
|
19
|
+
base64
|
|
20
|
+
bigdecimal
|
|
21
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
22
|
+
connection_pool (>= 2.2.5)
|
|
23
|
+
drb
|
|
24
|
+
i18n (>= 1.6, < 2)
|
|
25
|
+
json
|
|
26
|
+
logger (>= 1.4.2)
|
|
27
|
+
minitest (>= 5.1)
|
|
28
|
+
securerandom (>= 0.3)
|
|
29
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
30
|
+
uri (>= 0.13.1)
|
|
31
|
+
base58 (0.2.3)
|
|
32
|
+
base64 (0.3.0)
|
|
33
|
+
bigdecimal (4.1.3)
|
|
34
|
+
concurrent-ruby (1.3.8)
|
|
35
|
+
connection_pool (2.5.5)
|
|
36
|
+
didkit (0.5.0)
|
|
37
|
+
base58 (~> 0.2)
|
|
38
|
+
dotenv (3.2.0)
|
|
39
|
+
drb (2.2.3)
|
|
40
|
+
i18n (1.15.2)
|
|
41
|
+
concurrent-ruby (~> 1.0)
|
|
42
|
+
immutable-ruby (0.2.0)
|
|
43
|
+
concurrent-ruby (~> 1.1)
|
|
44
|
+
sorted_set (~> 1.0)
|
|
45
|
+
jose (1.2.0)
|
|
46
|
+
base64
|
|
47
|
+
immutable-ruby
|
|
48
|
+
json (3.1.0)
|
|
49
|
+
jwt (3.3.0)
|
|
50
|
+
base64
|
|
51
|
+
logger (1.7.0)
|
|
52
|
+
minisky (0.5.1)
|
|
53
|
+
base64 (~> 0.1)
|
|
54
|
+
minitest (5.27.0)
|
|
55
|
+
multi_json (1.21.2)
|
|
56
|
+
mustermann (3.1.1)
|
|
57
|
+
nio4r (2.7.5)
|
|
58
|
+
puma (8.0.2)
|
|
59
|
+
nio4r (~> 2.0)
|
|
60
|
+
rack (3.2.8)
|
|
61
|
+
rack-protection (4.2.1)
|
|
62
|
+
base64 (>= 0.1.0)
|
|
63
|
+
logger (>= 1.6.0)
|
|
64
|
+
rack (>= 3.0.0, < 4)
|
|
65
|
+
rack-session (2.1.2)
|
|
66
|
+
base64 (>= 0.1.0)
|
|
67
|
+
rack (>= 3.0.0)
|
|
68
|
+
rackup (2.3.1)
|
|
69
|
+
rack (>= 3)
|
|
70
|
+
rake (13.4.2)
|
|
71
|
+
rbtree (0.4.7)
|
|
72
|
+
securerandom (0.4.1)
|
|
73
|
+
sinatra (4.2.1)
|
|
74
|
+
logger (>= 1.6.0)
|
|
75
|
+
mustermann (~> 3.0)
|
|
76
|
+
rack (>= 3.0.0, < 4)
|
|
77
|
+
rack-protection (= 4.2.1)
|
|
78
|
+
rack-session (>= 2.0.0, < 3)
|
|
79
|
+
tilt (~> 2.0)
|
|
80
|
+
sinatra-activerecord (2.0.28)
|
|
81
|
+
activerecord (>= 4.1)
|
|
82
|
+
sinatra (>= 1.0)
|
|
83
|
+
sinatra-contrib (4.2.1)
|
|
84
|
+
multi_json (>= 0.0.2)
|
|
85
|
+
mustermann (~> 3.0)
|
|
86
|
+
rack-protection (= 4.2.1)
|
|
87
|
+
sinatra (= 4.2.1)
|
|
88
|
+
tilt (~> 2.0)
|
|
89
|
+
sorted_set (1.1.0)
|
|
90
|
+
rbtree
|
|
91
|
+
sqlite3 (2.10.2-arm64-darwin)
|
|
92
|
+
tilt (2.9.0)
|
|
93
|
+
timeout (0.6.1)
|
|
94
|
+
tzinfo (2.0.6)
|
|
95
|
+
concurrent-ruby (~> 1.0)
|
|
96
|
+
uri (1.1.2)
|
|
97
|
+
|
|
98
|
+
PLATFORMS
|
|
99
|
+
arm64-darwin
|
|
100
|
+
|
|
101
|
+
DEPENDENCIES
|
|
102
|
+
activerecord (~> 8.1)
|
|
103
|
+
authproto!
|
|
104
|
+
dotenv
|
|
105
|
+
minisky (~> 0.5.1)
|
|
106
|
+
puma
|
|
107
|
+
rackup
|
|
108
|
+
rake
|
|
109
|
+
sinatra
|
|
110
|
+
sinatra-activerecord (~> 2.0)
|
|
111
|
+
sinatra-contrib
|
|
112
|
+
sqlite3 (~> 2.10)
|
|
113
|
+
|
|
114
|
+
CHECKSUMS
|
|
115
|
+
activemodel (8.1.4.1) sha256=063caf105372fbc98b2d789e4be23de63ac5c043f7d9330f04e2caddb7012805
|
|
116
|
+
activerecord (8.1.4.1) sha256=bd65599ca0b5d210937f835d42c7aff69d271741c75aab022730be6cbce67e87
|
|
117
|
+
activesupport (8.1.4.1) sha256=16ac4f341ca65c85a1fcdb8ac73f68891aae9e3c4a6f9c3a27daed8b00017ed7
|
|
118
|
+
authproto (0.3.0.beta5)
|
|
119
|
+
base58 (0.2.3) sha256=fda5c5d3bda8b429ad0d1a5309c2d1e488ba46f0a2ab99a639890f26c61bf3be
|
|
120
|
+
base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
|
|
121
|
+
bigdecimal (4.1.3) sha256=61ebe1e5e559bdc3cc6f2c0ee7f427321fc838f59611c294356eb04d6e21cf66
|
|
122
|
+
bundler (4.0.23) sha256=407ba8a1d928f412847f819aa5f8b6aef7c59fb51feb517112af8a165487287b
|
|
123
|
+
concurrent-ruby (1.3.8) sha256=b2f1be836e968ccc78ccfce277ea79c72a88633f22306782c16ff23fb415d1e1
|
|
124
|
+
connection_pool (2.5.5) sha256=e54ff92855753df1fd7c59fa04a398833355f27dd14c074f8c83a05f72a716ad
|
|
125
|
+
didkit (0.5.0) sha256=8b24320fbf137cd4095b7fc7cc8a1dbee9b1aafa49fa80b9aac2902f4c282463
|
|
126
|
+
dotenv (3.2.0) sha256=e375b83121ea7ca4ce20f214740076129ab8514cd81378161f11c03853fe619d
|
|
127
|
+
drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
|
|
128
|
+
i18n (1.15.2) sha256=00f9eb62412fe593b2a65a97daa75300d37abb8f7202ec748e94b6d46a9dd1b5
|
|
129
|
+
immutable-ruby (0.2.0) sha256=1ab896e0d9c8c3fe21ddc3dd29be87511da2f6b0970c5a1c36838a9a4a4605e7
|
|
130
|
+
jose (1.2.0) sha256=c6e7061b71d2efc5aa70875c203f10595c67a0a48a58012527844c045ac2cbee
|
|
131
|
+
json (3.1.0) sha256=3ce7ccf8fde58960177a3a756c31f292a4c1e1dedee884547096a5b0604e3bd8
|
|
132
|
+
jwt (3.3.0) sha256=44cc34fbc341c148233cf66641522b4bce0dfb1ce55e8073f05c56f44f4ee546
|
|
133
|
+
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
|
|
134
|
+
minisky (0.5.1) sha256=47a7d63a1ca16c786e3bd3d4ddb15c5d585165efd1dfbe2be9bf47335fe19d4f
|
|
135
|
+
minitest (5.27.0) sha256=2d3b17f8a36fe7801c1adcffdbc38233b938eb0b4966e97a6739055a45fa77d5
|
|
136
|
+
multi_json (1.21.2) sha256=245531eaf54bdba57aba515ff08b4503505c5e09911daa89c5a561e2f85bea8e
|
|
137
|
+
mustermann (3.1.1) sha256=4c6170c7234d5499c345562ba7c7dfe73e1754286dcc1abb053064d66a127198
|
|
138
|
+
nio4r (2.7.5) sha256=6c90168e48fb5f8e768419c93abb94ba2b892a1d0602cb06eef16d8b7df1dca1
|
|
139
|
+
puma (8.0.2) sha256=c8ed871dfbbe66448ea9ffd46692342d9804d4071522b52b5331b7b6e7b686fb
|
|
140
|
+
rack (3.2.8) sha256=1fecc85e463ebc7a2a945fff829ffcd549babeb1556384796fad946c28dc4ec7
|
|
141
|
+
rack-protection (4.2.1) sha256=cf6e2842df8c55f5e4d1a4be015e603e19e9bc3a7178bae58949ccbb58558bac
|
|
142
|
+
rack-session (2.1.2) sha256=595434f8c0c3473ae7d7ac56ecda6cc6dfd9d37c0b2b5255330aa1576967ffe8
|
|
143
|
+
rackup (2.3.1) sha256=6c79c26753778e90983761d677a48937ee3192b3ffef6bc963c0950f94688868
|
|
144
|
+
rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
|
|
145
|
+
rbtree (0.4.7) sha256=1efabbcb3fd5f12249c9c8a610a765074868164eed0c50c9db2531c00ed161cb
|
|
146
|
+
securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
|
|
147
|
+
sinatra (4.2.1) sha256=b7aeb9b11d046b552972ade834f1f9be98b185fa8444480688e3627625377080
|
|
148
|
+
sinatra-activerecord (2.0.28) sha256=99f352c2dfa244d02b4f877efbe00135360b758390b8bb7bc2d4d91171c93811
|
|
149
|
+
sinatra-contrib (4.2.1) sha256=10d091c944d268aa910c618ea40a3c3ebe0533e6e32990d84af92235a3d26b4a
|
|
150
|
+
sorted_set (1.1.0) sha256=bac01eb16b6bcfcdb7d732a28e87422be8b5c9fdcfeadbe9072682407524ee83
|
|
151
|
+
sqlite3 (2.10.2-arm64-darwin) sha256=5b0d235ea037e6dcd1b8387a19d73be571917db9f93044d35741cf933a21a37d
|
|
152
|
+
tilt (2.9.0) sha256=da5735d0280bba96e9a91041bb14aee435ccad5c17b0fa519249ae543d9aa3a5
|
|
153
|
+
timeout (0.6.1) sha256=78f57368a7e7bbadec56971f78a3f5ecbcfb59b7fcbb0a3ed6ddc08a5094accb
|
|
154
|
+
tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b
|
|
155
|
+
uri (1.1.2) sha256=89292e98eabbef6248b0a0ed5e7e398e152f83f17560023a6d94a7f492b169fb
|
|
156
|
+
|
|
157
|
+
BUNDLED WITH
|
|
158
|
+
4.0.23
|