524 lines
14 KiB
Go
524 lines
14 KiB
Go
// Code generated by qtc from "authorize.qtpl". DO NOT EDIT.
|
|
// See https://github.com/valyala/quicktemplate for details.
|
|
|
|
//line web/template/authorize.qtpl:1
|
|
package template
|
|
|
|
//line web/template/authorize.qtpl:3
|
|
import (
|
|
"source.toby3d.me/toby3d/auth/internal/domain"
|
|
"source.toby3d.me/toby3d/auth/web/template/layout"
|
|
)
|
|
|
|
//line web/template/authorize.qtpl:8
|
|
import (
|
|
qtio422016 "io"
|
|
|
|
qt422016 "github.com/valyala/quicktemplate"
|
|
)
|
|
|
|
//line web/template/authorize.qtpl:8
|
|
var (
|
|
_ = qtio422016.Copy
|
|
_ = qt422016.AcquireByteBuffer
|
|
)
|
|
|
|
//line web/template/authorize.qtpl:8
|
|
type Authorize struct {
|
|
layout.BaseOf
|
|
Scope domain.Scopes
|
|
CodeChallengeMethod domain.CodeChallengeMethod
|
|
ResponseType domain.ResponseType
|
|
Client *domain.Client
|
|
Me *domain.Me
|
|
RedirectURI *domain.URL
|
|
Providers []*domain.Provider
|
|
CSRF []byte
|
|
CodeChallenge string
|
|
State string
|
|
}
|
|
|
|
//line web/template/authorize.qtpl:22
|
|
func (p *Authorize) StreamTitle(qw422016 *qt422016.Writer) {
|
|
//line web/template/authorize.qtpl:22
|
|
qw422016.N().S(`
|
|
`)
|
|
//line web/template/authorize.qtpl:23
|
|
if p.Client.Name != "" {
|
|
//line web/template/authorize.qtpl:23
|
|
qw422016.N().S(`
|
|
`)
|
|
//line web/template/authorize.qtpl:24
|
|
p.StreamT(qw422016, "Authorize %s", p.Client.Name)
|
|
//line web/template/authorize.qtpl:24
|
|
qw422016.N().S(`
|
|
`)
|
|
//line web/template/authorize.qtpl:25
|
|
} else {
|
|
//line web/template/authorize.qtpl:25
|
|
qw422016.N().S(`
|
|
`)
|
|
//line web/template/authorize.qtpl:26
|
|
p.StreamT(qw422016, "Authorize application")
|
|
//line web/template/authorize.qtpl:26
|
|
qw422016.N().S(`
|
|
`)
|
|
//line web/template/authorize.qtpl:27
|
|
}
|
|
//line web/template/authorize.qtpl:27
|
|
qw422016.N().S(`
|
|
`)
|
|
//line web/template/authorize.qtpl:28
|
|
}
|
|
|
|
//line web/template/authorize.qtpl:28
|
|
func (p *Authorize) WriteTitle(qq422016 qtio422016.Writer) {
|
|
//line web/template/authorize.qtpl:28
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line web/template/authorize.qtpl:28
|
|
p.StreamTitle(qw422016)
|
|
//line web/template/authorize.qtpl:28
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line web/template/authorize.qtpl:28
|
|
}
|
|
|
|
//line web/template/authorize.qtpl:28
|
|
func (p *Authorize) Title() string {
|
|
//line web/template/authorize.qtpl:28
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line web/template/authorize.qtpl:28
|
|
p.WriteTitle(qb422016)
|
|
//line web/template/authorize.qtpl:28
|
|
qs422016 := string(qb422016.B)
|
|
//line web/template/authorize.qtpl:28
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line web/template/authorize.qtpl:28
|
|
return qs422016
|
|
//line web/template/authorize.qtpl:28
|
|
}
|
|
|
|
//line web/template/authorize.qtpl:30
|
|
func (p *Authorize) StreamBody(qw422016 *qt422016.Writer) {
|
|
//line web/template/authorize.qtpl:30
|
|
qw422016.N().S(`
|
|
<header>
|
|
`)
|
|
//line web/template/authorize.qtpl:32
|
|
if p.Client.Logo != nil {
|
|
//line web/template/authorize.qtpl:32
|
|
qw422016.N().S(`
|
|
<img class=""
|
|
crossorigin="anonymous"
|
|
decoding="async"
|
|
height="140"
|
|
importance="high"
|
|
loading="lazy"
|
|
referrerpolicy="no-referrer-when-downgrade"
|
|
src="`)
|
|
//line web/template/authorize.qtpl:40
|
|
qw422016.E().S(p.Client.Logo.String())
|
|
//line web/template/authorize.qtpl:40
|
|
qw422016.N().S(`"
|
|
alt="`)
|
|
//line web/template/authorize.qtpl:41
|
|
qw422016.E().S(p.Client.Name)
|
|
//line web/template/authorize.qtpl:41
|
|
qw422016.N().S(`"
|
|
width="140">
|
|
`)
|
|
//line web/template/authorize.qtpl:43
|
|
}
|
|
//line web/template/authorize.qtpl:43
|
|
qw422016.N().S(`
|
|
|
|
<h2>
|
|
`)
|
|
//line web/template/authorize.qtpl:46
|
|
if p.Client.URL != nil {
|
|
//line web/template/authorize.qtpl:46
|
|
qw422016.N().S(`
|
|
<a href="`)
|
|
//line web/template/authorize.qtpl:47
|
|
qw422016.E().S(p.Client.URL.String())
|
|
//line web/template/authorize.qtpl:47
|
|
qw422016.N().S(`">
|
|
`)
|
|
//line web/template/authorize.qtpl:48
|
|
}
|
|
//line web/template/authorize.qtpl:48
|
|
qw422016.N().S(`
|
|
`)
|
|
//line web/template/authorize.qtpl:49
|
|
if p.Client.Name != "" {
|
|
//line web/template/authorize.qtpl:49
|
|
qw422016.N().S(`
|
|
`)
|
|
//line web/template/authorize.qtpl:50
|
|
qw422016.E().S(p.Client.Name)
|
|
//line web/template/authorize.qtpl:50
|
|
qw422016.N().S(`
|
|
`)
|
|
//line web/template/authorize.qtpl:51
|
|
} else {
|
|
//line web/template/authorize.qtpl:51
|
|
qw422016.N().S(`
|
|
`)
|
|
//line web/template/authorize.qtpl:52
|
|
qw422016.E().S(p.Client.ID.String())
|
|
//line web/template/authorize.qtpl:52
|
|
qw422016.N().S(`
|
|
`)
|
|
//line web/template/authorize.qtpl:53
|
|
}
|
|
//line web/template/authorize.qtpl:53
|
|
qw422016.N().S(`
|
|
`)
|
|
//line web/template/authorize.qtpl:54
|
|
if p.Client.URL != nil {
|
|
//line web/template/authorize.qtpl:54
|
|
qw422016.N().S(`
|
|
</a>
|
|
`)
|
|
//line web/template/authorize.qtpl:56
|
|
}
|
|
//line web/template/authorize.qtpl:56
|
|
qw422016.N().S(`
|
|
</h2>
|
|
</header>
|
|
|
|
<main>
|
|
<aside>
|
|
`)
|
|
//line web/template/authorize.qtpl:62
|
|
if p.CodeChallengeMethod != domain.CodeChallengeMethodUnd && p.CodeChallenge != "" {
|
|
//line web/template/authorize.qtpl:62
|
|
qw422016.N().S(`
|
|
<p class="with-icon">
|
|
<span class="icon"
|
|
role="img"
|
|
aria-label="closed lock with key">🔐</span>
|
|
|
|
`)
|
|
//line web/template/authorize.qtpl:68
|
|
p.StreamT(qw422016, `This client uses %sPKCE%s with the %s%s%s method.`, `<abbr title="Proof of Key Code Exchange">`,
|
|
`</abbr>`, `<code>`, p.CodeChallengeMethod, `</code>`)
|
|
//line web/template/authorize.qtpl:69
|
|
qw422016.N().S(`
|
|
</p>
|
|
`)
|
|
//line web/template/authorize.qtpl:71
|
|
} else {
|
|
//line web/template/authorize.qtpl:71
|
|
qw422016.N().S(`
|
|
<details>
|
|
<summary class="with-icon">
|
|
<span class="icon"
|
|
role="img"
|
|
aria-label="unlock">🔓</span>
|
|
|
|
`)
|
|
//line web/template/authorize.qtpl:78
|
|
p.StreamT(qw422016, `This client does not use %sPKCE%s!`, `<abbr title="Proof of Key Code Exchange">`, `</abbr>`)
|
|
//line web/template/authorize.qtpl:78
|
|
qw422016.N().S(`
|
|
</summary>
|
|
<p>
|
|
`)
|
|
//line web/template/authorize.qtpl:81
|
|
p.StreamT(qw422016, `%sProof of Key Code Exchange%s is a mechanism that protects against attackers in the middle hijacking `+
|
|
`your application's authentication process. You can still authorize this application without this protection, `+
|
|
`but you must independently verify the security of this connection. If you have any doubts - stop the process `+
|
|
` and contact the developers.`, `<dfn id="PKCE">`, `</dfn>`)
|
|
//line web/template/authorize.qtpl:84
|
|
qw422016.N().S(`
|
|
</p>
|
|
</details>
|
|
`)
|
|
//line web/template/authorize.qtpl:87
|
|
}
|
|
//line web/template/authorize.qtpl:87
|
|
qw422016.N().S(`
|
|
</aside>
|
|
|
|
<form class=""
|
|
accept-charset="utf-8"
|
|
action="/authorize/verify"
|
|
autocomplete="off"
|
|
enctype="application/x-www-form-urlencoded"
|
|
method="post"
|
|
novalidate="true"
|
|
target="_self">
|
|
|
|
`)
|
|
//line web/template/authorize.qtpl:99
|
|
if p.CSRF != nil {
|
|
//line web/template/authorize.qtpl:99
|
|
qw422016.N().S(`
|
|
<input type="hidden"
|
|
name="_csrf"
|
|
value="`)
|
|
//line web/template/authorize.qtpl:102
|
|
qw422016.E().Z(p.CSRF)
|
|
//line web/template/authorize.qtpl:102
|
|
qw422016.N().S(`">
|
|
`)
|
|
//line web/template/authorize.qtpl:103
|
|
}
|
|
//line web/template/authorize.qtpl:103
|
|
qw422016.N().S(`
|
|
|
|
`)
|
|
//line web/template/authorize.qtpl:105
|
|
for key, val := range map[string]string{
|
|
"client_id": p.Client.ID.String(),
|
|
"redirect_uri": p.RedirectURI.String(),
|
|
"response_type": p.ResponseType.String(),
|
|
"state": p.State,
|
|
} {
|
|
//line web/template/authorize.qtpl:110
|
|
qw422016.N().S(`
|
|
<input type="hidden"
|
|
name="`)
|
|
//line web/template/authorize.qtpl:112
|
|
qw422016.E().S(key)
|
|
//line web/template/authorize.qtpl:112
|
|
qw422016.N().S(`"
|
|
value="`)
|
|
//line web/template/authorize.qtpl:113
|
|
qw422016.E().S(val)
|
|
//line web/template/authorize.qtpl:113
|
|
qw422016.N().S(`">
|
|
`)
|
|
//line web/template/authorize.qtpl:114
|
|
}
|
|
//line web/template/authorize.qtpl:114
|
|
qw422016.N().S(`
|
|
|
|
`)
|
|
//line web/template/authorize.qtpl:116
|
|
if len(p.Scope) > 0 {
|
|
//line web/template/authorize.qtpl:116
|
|
qw422016.N().S(`
|
|
<fieldset>
|
|
<legend>`)
|
|
//line web/template/authorize.qtpl:118
|
|
p.StreamT(qw422016, "Scopes")
|
|
//line web/template/authorize.qtpl:118
|
|
qw422016.N().S(`</legend>
|
|
|
|
`)
|
|
//line web/template/authorize.qtpl:120
|
|
for _, scope := range p.Scope {
|
|
//line web/template/authorize.qtpl:120
|
|
qw422016.N().S(`
|
|
<div>
|
|
<label>
|
|
<input type="checkbox"
|
|
name="scope[]"
|
|
value="`)
|
|
//line web/template/authorize.qtpl:125
|
|
qw422016.E().S(scope.String())
|
|
//line web/template/authorize.qtpl:125
|
|
qw422016.N().S(`"
|
|
checked>
|
|
|
|
`)
|
|
//line web/template/authorize.qtpl:128
|
|
qw422016.E().S(scope.String())
|
|
//line web/template/authorize.qtpl:128
|
|
qw422016.N().S(`
|
|
</label>
|
|
</div>
|
|
`)
|
|
//line web/template/authorize.qtpl:131
|
|
}
|
|
//line web/template/authorize.qtpl:131
|
|
qw422016.N().S(`
|
|
</fieldset>
|
|
`)
|
|
//line web/template/authorize.qtpl:133
|
|
} else {
|
|
//line web/template/authorize.qtpl:133
|
|
qw422016.N().S(`
|
|
<aside>
|
|
<p>`)
|
|
//line web/template/authorize.qtpl:135
|
|
p.StreamT(qw422016, `No scopes is requested: the application will only get your profile URL.`)
|
|
//line web/template/authorize.qtpl:135
|
|
qw422016.N().S(`</p>
|
|
</aside>
|
|
`)
|
|
//line web/template/authorize.qtpl:137
|
|
}
|
|
//line web/template/authorize.qtpl:137
|
|
qw422016.N().S(`
|
|
|
|
`)
|
|
//line web/template/authorize.qtpl:139
|
|
if p.CodeChallenge != "" {
|
|
//line web/template/authorize.qtpl:139
|
|
qw422016.N().S(`
|
|
`)
|
|
//line web/template/authorize.qtpl:140
|
|
for key, val := range map[string]string{
|
|
"code_challenge": p.CodeChallenge,
|
|
"code_challenge_method": p.CodeChallengeMethod.String(),
|
|
} {
|
|
//line web/template/authorize.qtpl:143
|
|
qw422016.N().S(`
|
|
<input type="hidden"
|
|
name="`)
|
|
//line web/template/authorize.qtpl:145
|
|
qw422016.E().S(key)
|
|
//line web/template/authorize.qtpl:145
|
|
qw422016.N().S(`"
|
|
value="`)
|
|
//line web/template/authorize.qtpl:146
|
|
qw422016.E().S(val)
|
|
//line web/template/authorize.qtpl:146
|
|
qw422016.N().S(`">
|
|
`)
|
|
//line web/template/authorize.qtpl:147
|
|
}
|
|
//line web/template/authorize.qtpl:147
|
|
qw422016.N().S(`
|
|
`)
|
|
//line web/template/authorize.qtpl:148
|
|
}
|
|
//line web/template/authorize.qtpl:148
|
|
qw422016.N().S(`
|
|
|
|
`)
|
|
//line web/template/authorize.qtpl:150
|
|
if p.Me != nil {
|
|
//line web/template/authorize.qtpl:150
|
|
qw422016.N().S(`
|
|
<input type="hidden"
|
|
name="me"
|
|
value="`)
|
|
//line web/template/authorize.qtpl:153
|
|
qw422016.E().S(p.Me.String())
|
|
//line web/template/authorize.qtpl:153
|
|
qw422016.N().S(`">
|
|
`)
|
|
//line web/template/authorize.qtpl:154
|
|
}
|
|
//line web/template/authorize.qtpl:154
|
|
qw422016.N().S(`
|
|
|
|
`)
|
|
//line web/template/authorize.qtpl:156
|
|
if len(p.Providers) > 0 {
|
|
//line web/template/authorize.qtpl:156
|
|
qw422016.N().S(`
|
|
<select name="provider"
|
|
autocomplete
|
|
required>
|
|
|
|
`)
|
|
//line web/template/authorize.qtpl:161
|
|
for _, provider := range p.Providers {
|
|
//line web/template/authorize.qtpl:161
|
|
qw422016.N().S(`
|
|
<option value="`)
|
|
//line web/template/authorize.qtpl:162
|
|
qw422016.E().S(provider.UID)
|
|
//line web/template/authorize.qtpl:162
|
|
qw422016.N().S(`"
|
|
`)
|
|
//line web/template/authorize.qtpl:163
|
|
if provider.UID == "mastodon" {
|
|
//line web/template/authorize.qtpl:163
|
|
qw422016.N().S(`selected`)
|
|
//line web/template/authorize.qtpl:163
|
|
}
|
|
//line web/template/authorize.qtpl:163
|
|
qw422016.N().S(`>
|
|
|
|
`)
|
|
//line web/template/authorize.qtpl:165
|
|
qw422016.E().S(provider.Name)
|
|
//line web/template/authorize.qtpl:165
|
|
qw422016.N().S(`
|
|
</option>
|
|
`)
|
|
//line web/template/authorize.qtpl:167
|
|
}
|
|
//line web/template/authorize.qtpl:167
|
|
qw422016.N().S(`
|
|
</select>
|
|
`)
|
|
//line web/template/authorize.qtpl:169
|
|
} else {
|
|
//line web/template/authorize.qtpl:169
|
|
qw422016.N().S(`
|
|
<input type="hidden"
|
|
name="provider"
|
|
value="direct">
|
|
`)
|
|
//line web/template/authorize.qtpl:173
|
|
}
|
|
//line web/template/authorize.qtpl:173
|
|
qw422016.N().S(`
|
|
|
|
<button type="submit"
|
|
name="authorize"
|
|
value="deny">
|
|
|
|
`)
|
|
//line web/template/authorize.qtpl:179
|
|
p.StreamT(qw422016, "Deny")
|
|
//line web/template/authorize.qtpl:179
|
|
qw422016.N().S(`
|
|
</button>
|
|
|
|
<button type="submit"
|
|
name="authorize"
|
|
value="allow">
|
|
|
|
`)
|
|
//line web/template/authorize.qtpl:186
|
|
p.StreamT(qw422016, "Allow")
|
|
//line web/template/authorize.qtpl:186
|
|
qw422016.N().S(`
|
|
</button>
|
|
|
|
<aside>
|
|
<p>`)
|
|
//line web/template/authorize.qtpl:190
|
|
p.StreamT(qw422016, `You will be redirected to %s%s%s`, `<code>`, p.RedirectURI, `</code>`)
|
|
//line web/template/authorize.qtpl:190
|
|
qw422016.N().S(`</p>
|
|
</aside>
|
|
</form>
|
|
</main>
|
|
`)
|
|
//line web/template/authorize.qtpl:194
|
|
}
|
|
|
|
//line web/template/authorize.qtpl:194
|
|
func (p *Authorize) WriteBody(qq422016 qtio422016.Writer) {
|
|
//line web/template/authorize.qtpl:194
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line web/template/authorize.qtpl:194
|
|
p.StreamBody(qw422016)
|
|
//line web/template/authorize.qtpl:194
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line web/template/authorize.qtpl:194
|
|
}
|
|
|
|
//line web/template/authorize.qtpl:194
|
|
func (p *Authorize) Body() string {
|
|
//line web/template/authorize.qtpl:194
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line web/template/authorize.qtpl:194
|
|
p.WriteBody(qb422016)
|
|
//line web/template/authorize.qtpl:194
|
|
qs422016 := string(qb422016.B)
|
|
//line web/template/authorize.qtpl:194
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line web/template/authorize.qtpl:194
|
|
return qs422016
|
|
//line web/template/authorize.qtpl:194
|
|
}
|