show requested scope

This commit is contained in:
Niko Abeler 2022-11-07 20:24:21 +01:00
parent 3495822ec3
commit 0dc200e0b0
2 changed files with 10 additions and 0 deletions

View File

@ -1,5 +1,12 @@
<h2>Authorization for {{.ClientId}}</h2> <h2>Authorization for {{.ClientId}}</h2>
Requesting scope:
<ul>
{{range .Scopes}}
<li>{{.}}</li>
{{end}}
</ul>
<form action="verify/" method="post"> <form action="verify/" method="post">
<label for="password">Password</label> <label for="password">Password</label>
<input type="password" name="password" placeholder="Password"> <input type="password" name="password" placeholder="Password">

View File

@ -4,6 +4,7 @@ import (
"bytes" "bytes"
_ "embed" _ "embed"
"html/template" "html/template"
"strings"
) )
type PageContent struct { type PageContent struct {
@ -26,6 +27,7 @@ type AuthRequestData struct {
RedirectUri string RedirectUri string
State string State string
Scope string Scope string
Scopes []string // Split version of scope. filled by rendering function.
ResponseType string ResponseType string
CodeChallenge string CodeChallenge string
CodeChallengeMethod string CodeChallengeMethod string
@ -128,6 +130,7 @@ func RenderUserAuthPage(reqData AuthRequestData) (string, error) {
return "", err return "", err
} }
reqData.Scopes = strings.Split(reqData.Scope, " ")
return renderIntoBaseTemplate(reqData.User, PageContent{ return renderIntoBaseTemplate(reqData.User, PageContent{
Title: "Auth", Title: "Auth",
Content: template.HTML(authHtml), Content: template.HTML(authHtml),