An experimental IndieWeb site built in Go.
1package pages
2
3import "strings"
4
5import "go.hacdias.com/indielib/indieauth"
6
7templ Auth( req *indieauth.AuthenticationRequest, app *indieauth.ApplicationMetadata ) {
8<!DOCTYPE html>
9<html>
10 <head>
11 <title>Authorization | Micropub and IndieAuth Server Demo</title>
12 </head>
13 <body>
14 <h1>IndieAuth Server Demo: Authorization</h1>
15
16 <p>
17 You received an authorization request from
18
19 if app != nil {
20 if len(app.Logo) > 0 {
21 <img style="width: 1em; vertical-align: middle" src={ app.Logo } />
22 }
23
24 <strong>{ app.Name }</strong> by { app.Author }:
25 } else {
26 the following client:
27 }
28 </p>
29
30 <ul>
31 <li><strong>Redirect:</strong> <code>{ req.ClientID }</code></li>
32 <li><strong>Client:</strong> <code>{ req.RedirectURI }</code></li>
33 </ul>
34
35 <p>For the following scopes:
36 for _, scope := range req.Scopes {
37 <code>{ scope }</code>
38 }
39 .</p>
40
41 <form method='post' action='/authorization/accept'>
42 <input type="hidden" name="response_type" value="code">
43 <input type="hidden" name="scope" value={ strings.Join(req.Scopes, " ") }>
44 <input type="hidden" name="redirect_uri" value={ req.RedirectURI }>
45 <input type="hidden" name="client_id" value={ req.ClientID }>
46 <input type="hidden" name="state" value={ req.State }>
47 <input type="hidden" name="code_challenge" value={ req.CodeChallenge }>
48 <input type="hidden" name="code_challenge_method" value={ req.CodeChallengeMethod }>
49
50 <p>In a production server, this page could be behind some sort of authentication mechanism, such as username and password, PassKey, etc.</p>
51
52 <button id="submit">Authorize</button>
53 </form>
54 </body>
55</html>
56}