From cba81b5ac415201bda2eda431333107807015d4e Mon Sep 17 00:00:00 2001 From: Maxim Lebedev Date: Mon, 6 May 2024 20:45:19 +0500 Subject: [PATCH] :recycle: Replaced new domains in used parts --- .../auth/delivery/http/auth_http_schema.go | 20 +- internal/auth/delivery/http/auth_http_test.go | 3 +- .../client/repository/http/http_client.go | 8 +- internal/domain/action_test.go | 1 - .../metadata/repository/http/http_metadata.go | 10 +- .../repository/http/http_metadata_test.go | 6 +- .../token/delivery/http/token_http_schema.go | 13 +- internal/user/repository/http/http_user.go | 6 +- main.go | 12 +- web/template/authorize.qtpl | 3 +- web/template/authorize.qtpl.go | 317 +++++++++--------- web/template/home.qtpl | 3 +- web/template/home.qtpl.go | 129 +++---- 13 files changed, 274 insertions(+), 257 deletions(-) diff --git a/internal/auth/delivery/http/auth_http_schema.go b/internal/auth/delivery/http/auth_http_schema.go index e9fa703..6f91b5b 100644 --- a/internal/auth/delivery/http/auth_http_schema.go +++ b/internal/auth/delivery/http/auth_http_schema.go @@ -6,6 +6,8 @@ import ( "strings" "source.toby3d.me/toby3d/auth/internal/domain" + "source.toby3d.me/toby3d/auth/internal/domain/grant" + "source.toby3d.me/toby3d/auth/internal/domain/response" "source.toby3d.me/toby3d/form" ) @@ -26,7 +28,7 @@ type ( // Indicates to the authorization server that an authorization // code should be returned as the response. - ResponseType domain.ResponseType `form:"response_type"` // code + ResponseType response.Type `form:"response_type"` // code // A parameter set by the client which will be included when the // user is redirected back to the client. This is used to @@ -50,7 +52,7 @@ type ( Me domain.Me `form:"me"` RedirectURI domain.URL `form:"redirect_uri"` CodeChallengeMethod domain.CodeChallengeMethod `form:"code_challenge_method,omitempty"` - ResponseType domain.ResponseType `form:"response_type"` + ResponseType response.Type `form:"response_type"` Authorize string `form:"authorize"` CodeChallenge string `form:"code_challenge,omitempty"` State string `form:"state"` @@ -59,7 +61,7 @@ type ( } AuthExchangeRequest struct { - GrantType domain.GrantType `form:"grant_type"` // authorization_code + GrantType grant.Type `form:"grant_type"` // authorization_code // The client's URL, which MUST match the client_id used in the // authentication request. @@ -98,7 +100,7 @@ func NewAuthAuthorizationRequest() *AuthAuthorizationRequest { CodeChallengeMethod: domain.CodeChallengeMethodUnd, Me: domain.Me{}, RedirectURI: domain.URL{}, - ResponseType: domain.ResponseTypeUnd, + ResponseType: response.Und, Scope: make(domain.Scopes, 0), State: "", } @@ -117,8 +119,8 @@ func (r *AuthAuthorizationRequest) bind(req *http.Request) error { "https://indieauth.net/source/#authorization-request") } - if r.ResponseType == domain.ResponseTypeID { - r.ResponseType = domain.ResponseTypeCode + if r.ResponseType == response.ID { + r.ResponseType = response.Code } return nil @@ -133,7 +135,7 @@ func NewAuthVerifyRequest() *AuthVerifyRequest { Me: domain.Me{}, Provider: "", RedirectURI: domain.URL{}, - ResponseType: domain.ResponseTypeUnd, + ResponseType: response.Und, Scope: make(domain.Scopes, 0), State: "", } @@ -159,8 +161,8 @@ func (r *AuthVerifyRequest) bind(req *http.Request) error { // NOTE(toby3d): backwards-compatible support. // See: https://aaronparecki.com/2020/12/03/1/indieauth-2020#response-type - if r.ResponseType == domain.ResponseTypeID { - r.ResponseType = domain.ResponseTypeCode + if r.ResponseType == response.ID { + r.ResponseType = response.Code } r.Provider = strings.ToLower(r.Provider) diff --git a/internal/auth/delivery/http/auth_http_test.go b/internal/auth/delivery/http/auth_http_test.go index 5503f60..f1f530e 100644 --- a/internal/auth/delivery/http/auth_http_test.go +++ b/internal/auth/delivery/http/auth_http_test.go @@ -19,6 +19,7 @@ import ( clientrepo "source.toby3d.me/toby3d/auth/internal/client/repository/memory" clientucase "source.toby3d.me/toby3d/auth/internal/client/usecase" "source.toby3d.me/toby3d/auth/internal/domain" + "source.toby3d.me/toby3d/auth/internal/domain/response" "source.toby3d.me/toby3d/auth/internal/profile" profilerepo "source.toby3d.me/toby3d/auth/internal/profile/repository/memory" "source.toby3d.me/toby3d/auth/internal/session" @@ -68,7 +69,7 @@ func TestAuthorize(t *testing.T) { "code_challenge_method": domain.CodeChallengeMethodS256.String(), "me": me.String(), "redirect_uri": client.RedirectURI[0].String(), - "response_type": domain.ResponseTypeCode.String(), + "response_type": response.Code.String(), "scope": "profile email", "state": "1234567890", } { diff --git a/internal/client/repository/http/http_client.go b/internal/client/repository/http/http_client.go index fae0762..152b86e 100644 --- a/internal/client/repository/http/http_client.go +++ b/internal/client/repository/http/http_client.go @@ -7,14 +7,16 @@ import ( "io" "net/http" "net/url" + "slices" "github.com/tomnomnom/linkheader" - "golang.org/x/exp/slices" "willnorris.com/go/microformats" "source.toby3d.me/toby3d/auth/internal/client" "source.toby3d.me/toby3d/auth/internal/common" "source.toby3d.me/toby3d/auth/internal/domain" + "source.toby3d.me/toby3d/auth/internal/domain/grant" + "source.toby3d.me/toby3d/auth/internal/domain/response" ) type ( @@ -30,11 +32,11 @@ type ( Microsub domain.URL `json:"microsub"` Issuer domain.URL `json:"issuer"` Micropub domain.URL `json:"micropub"` - GrantTypesSupported []domain.GrantType `json:"grant_types_supported,omitempty"` + GrantTypesSupported []grant.Type `json:"grant_types_supported,omitempty"` IntrospectionEndpointAuthMethodsSupported []string `json:"introspection_endpoint_auth_methods_supported,omitempty"` RevocationEndpointAuthMethodsSupported []string `json:"revocation_endpoint_auth_methods_supported,omitempty"` ScopesSupported []domain.Scope `json:"scopes_supported,omitempty"` - ResponseTypesSupported []domain.ResponseType `json:"response_types_supported,omitempty"` + ResponseTypesSupported []response.Type `json:"response_types_supported,omitempty"` CodeChallengeMethodsSupported []domain.CodeChallengeMethod `json:"code_challenge_methods_supported"` AuthorizationResponseIssParameterSupported bool `json:"authorization_response_iss_parameter_supported,omitempty"` } diff --git a/internal/domain/action_test.go b/internal/domain/action_test.go index 5d3ec07..6875c0b 100644 --- a/internal/domain/action_test.go +++ b/internal/domain/action_test.go @@ -1,4 +1,3 @@ -//nolint:dupl package domain_test import ( diff --git a/internal/metadata/repository/http/http_metadata.go b/internal/metadata/repository/http/http_metadata.go index 146cb02..10632f9 100644 --- a/internal/metadata/repository/http/http_metadata.go +++ b/internal/metadata/repository/http/http_metadata.go @@ -12,6 +12,8 @@ import ( "source.toby3d.me/toby3d/auth/internal/common" "source.toby3d.me/toby3d/auth/internal/domain" + "source.toby3d.me/toby3d/auth/internal/domain/grant" + "source.toby3d.me/toby3d/auth/internal/domain/response" "source.toby3d.me/toby3d/auth/internal/metadata" ) @@ -28,11 +30,11 @@ type ( Microsub domain.URL `json:"microsub"` Issuer domain.URL `json:"issuer"` Micropub domain.URL `json:"micropub"` - GrantTypesSupported []domain.GrantType `json:"grant_types_supported,omitempty"` + GrantTypesSupported []grant.Type `json:"grant_types_supported,omitempty"` IntrospectionEndpointAuthMethodsSupported []string `json:"introspection_endpoint_auth_methods_supported,omitempty"` RevocationEndpointAuthMethodsSupported []string `json:"revocation_endpoint_auth_methods_supported,omitempty"` ScopesSupported []domain.Scope `json:"scopes_supported,omitempty"` - ResponseTypesSupported []domain.ResponseType `json:"response_types_supported,omitempty"` + ResponseTypesSupported []response.Type `json:"response_types_supported,omitempty"` CodeChallengeMethodsSupported []domain.CodeChallengeMethod `json:"code_challenge_methods_supported"` AuthorizationResponseIssParameterSupported bool `json:"authorization_response_iss_parameter_supported,omitempty"` } @@ -118,8 +120,8 @@ func populateBuffer(dst map[string][]string, rel, u string) { func NewResponse() *Response { return &Response{ CodeChallengeMethodsSupported: make([]domain.CodeChallengeMethod, 0), - GrantTypesSupported: make([]domain.GrantType, 0), - ResponseTypesSupported: make([]domain.ResponseType, 0), + GrantTypesSupported: make([]grant.Type, 0), + ResponseTypesSupported: make([]response.Type, 0), ScopesSupported: make([]domain.Scope, 0), IntrospectionEndpointAuthMethodsSupported: make([]string, 0), RevocationEndpointAuthMethodsSupported: make([]string, 0), diff --git a/internal/metadata/repository/http/http_metadata_test.go b/internal/metadata/repository/http/http_metadata_test.go index a147f7e..5dd2964 100644 --- a/internal/metadata/repository/http/http_metadata_test.go +++ b/internal/metadata/repository/http/http_metadata_test.go @@ -14,6 +14,8 @@ import ( "source.toby3d.me/toby3d/auth/internal/common" "source.toby3d.me/toby3d/auth/internal/domain" + "source.toby3d.me/toby3d/auth/internal/domain/grant" + "source.toby3d.me/toby3d/auth/internal/domain/response" repository "source.toby3d.me/toby3d/auth/internal/metadata/repository/http" ) @@ -120,8 +122,8 @@ func TestGet(t *testing.T) { if diff := cmp.Diff(tc.out, out, cmp.AllowUnexported( domain.ClientID{}, domain.CodeChallengeMethod{}, - domain.GrantType{}, - domain.ResponseType{}, + grant.Und, + response.Und, domain.Scope{}, url.URL{}, )); diff != "" { diff --git a/internal/token/delivery/http/token_http_schema.go b/internal/token/delivery/http/token_http_schema.go index 90bac91..76e4d2c 100644 --- a/internal/token/delivery/http/token_http_schema.go +++ b/internal/token/delivery/http/token_http_schema.go @@ -5,23 +5,24 @@ import ( "net/http" "source.toby3d.me/toby3d/auth/internal/domain" + "source.toby3d.me/toby3d/auth/internal/domain/grant" "source.toby3d.me/toby3d/form" ) type ( TokenExchangeRequest struct { - ClientID domain.ClientID `form:"client_id"` - RedirectURI domain.URL `form:"redirect_uri"` - GrantType domain.GrantType `form:"grant_type"` - Code string `form:"code"` - CodeVerifier string `form:"code_verifier"` + ClientID domain.ClientID `form:"client_id"` + RedirectURI domain.URL `form:"redirect_uri"` + GrantType grant.Type `form:"grant_type"` + Code string `form:"code"` + CodeVerifier string `form:"code_verifier"` } TokenRefreshRequest struct { // The client ID that was used when the refresh token was issued. ClientID domain.ClientID `form:"client_id"` - GrantType domain.GrantType `form:"grant_type"` // refresh_token + GrantType grant.Type `form:"grant_type"` // refresh_token // The refresh token previously offered to the client. RefreshToken string `form:"refresh_token"` diff --git a/internal/user/repository/http/http_user.go b/internal/user/repository/http/http_user.go index 6e57d08..ae80562 100644 --- a/internal/user/repository/http/http_user.go +++ b/internal/user/repository/http/http_user.go @@ -15,6 +15,8 @@ import ( "source.toby3d.me/toby3d/auth/internal/common" "source.toby3d.me/toby3d/auth/internal/domain" + "source.toby3d.me/toby3d/auth/internal/domain/grant" + "source.toby3d.me/toby3d/auth/internal/domain/response" "source.toby3d.me/toby3d/auth/internal/user" ) @@ -31,11 +33,11 @@ type ( Microsub domain.URL `json:"microsub"` Issuer domain.URL `json:"issuer"` Micropub domain.URL `json:"micropub"` - GrantTypesSupported []domain.GrantType `json:"grant_types_supported,omitempty"` + GrantTypesSupported []grant.Type `json:"grant_types_supported,omitempty"` IntrospectionEndpointAuthMethodsSupported []string `json:"introspection_endpoint_auth_methods_supported,omitempty"` RevocationEndpointAuthMethodsSupported []string `json:"revocation_endpoint_auth_methods_supported,omitempty"` ScopesSupported []domain.Scope `json:"scopes_supported,omitempty"` - ResponseTypesSupported []domain.ResponseType `json:"response_types_supported,omitempty"` + ResponseTypesSupported []response.Type `json:"response_types_supported,omitempty"` CodeChallengeMethodsSupported []domain.CodeChallengeMethod `json:"code_challenge_methods_supported"` AuthorizationResponseIssParameterSupported bool `json:"authorization_response_iss_parameter_supported,omitempty"` } diff --git a/main.go b/main.go index 7137302..c58aade 100644 --- a/main.go +++ b/main.go @@ -37,6 +37,8 @@ import ( clienthttprepo "source.toby3d.me/toby3d/auth/internal/client/repository/http" clientucase "source.toby3d.me/toby3d/auth/internal/client/usecase" "source.toby3d.me/toby3d/auth/internal/domain" + "source.toby3d.me/toby3d/auth/internal/domain/grant" + "source.toby3d.me/toby3d/auth/internal/domain/response" healthhttpdelivery "source.toby3d.me/toby3d/auth/internal/health/delivery/http" metadatahttpdelivery "source.toby3d.me/toby3d/auth/internal/metadata/delivery/http" "source.toby3d.me/toby3d/auth/internal/middleware" @@ -286,12 +288,12 @@ func (app *App) Handler() http.Handler { domain.ScopeRead, domain.ScopeUpdate, }, - ResponseTypesSupported: []domain.ResponseType{ - domain.ResponseTypeCode, + ResponseTypesSupported: []response.Type{ + response.Code, }, - GrantTypesSupported: []domain.GrantType{ - domain.GrantTypeAuthorizationCode, - domain.GrantTypeTicket, + GrantTypesSupported: []grant.Type{ + grant.AuthorizationCode, + grant.Ticket, }, CodeChallengeMethodsSupported: []domain.CodeChallengeMethod{ domain.CodeChallengeMethodMD5, diff --git a/web/template/authorize.qtpl b/web/template/authorize.qtpl index 3a2533e..acbcf16 100644 --- a/web/template/authorize.qtpl +++ b/web/template/authorize.qtpl @@ -2,6 +2,7 @@ {% import ( "source.toby3d.me/toby3d/auth/internal/domain" + "source.toby3d.me/toby3d/auth/internal/domain/response" "source.toby3d.me/toby3d/auth/web/template/layout" ) %} @@ -9,7 +10,7 @@ layout.BaseOf Scope domain.Scopes CodeChallengeMethod domain.CodeChallengeMethod - ResponseType domain.ResponseType + ResponseType response.Type Client *domain.Client Me *domain.Me RedirectURI *domain.URL diff --git a/web/template/authorize.qtpl.go b/web/template/authorize.qtpl.go index 213c711..ec4e539 100644 --- a/web/template/authorize.qtpl.go +++ b/web/template/authorize.qtpl.go @@ -7,28 +7,29 @@ package template //line web/template/authorize.qtpl:3 import ( "source.toby3d.me/toby3d/auth/internal/domain" + "source.toby3d.me/toby3d/auth/internal/domain/response" "source.toby3d.me/toby3d/auth/web/template/layout" ) -//line web/template/authorize.qtpl:8 +//line web/template/authorize.qtpl:9 import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" ) -//line web/template/authorize.qtpl:8 +//line web/template/authorize.qtpl:9 var ( _ = qtio422016.Copy _ = qt422016.AcquireByteBuffer ) -//line web/template/authorize.qtpl:8 +//line web/template/authorize.qtpl:9 type Authorize struct { layout.BaseOf Scope domain.Scopes CodeChallengeMethod domain.CodeChallengeMethod - ResponseType domain.ResponseType + ResponseType response.Type Client *domain.Client Me *domain.Me RedirectURI *domain.URL @@ -38,74 +39,74 @@ type Authorize struct { State string } -//line web/template/authorize.qtpl:22 +//line web/template/authorize.qtpl:23 func (p *Authorize) StreamTitle(qw422016 *qt422016.Writer) { -//line web/template/authorize.qtpl:22 +//line web/template/authorize.qtpl:23 qw422016.N().S(` `) -//line web/template/authorize.qtpl:23 +//line web/template/authorize.qtpl:24 if p.Client.Name != "" { -//line web/template/authorize.qtpl:23 +//line web/template/authorize.qtpl:24 qw422016.N().S(` `) -//line web/template/authorize.qtpl:24 +//line web/template/authorize.qtpl:25 p.StreamT(qw422016, "Authorize %s", p.Client.Name) -//line web/template/authorize.qtpl:24 +//line web/template/authorize.qtpl:25 qw422016.N().S(` `) -//line web/template/authorize.qtpl:25 +//line web/template/authorize.qtpl:26 } else { -//line web/template/authorize.qtpl:25 +//line web/template/authorize.qtpl:26 qw422016.N().S(` `) -//line web/template/authorize.qtpl:26 +//line web/template/authorize.qtpl:27 p.StreamT(qw422016, "Authorize application") -//line web/template/authorize.qtpl:26 +//line web/template/authorize.qtpl:27 qw422016.N().S(` `) -//line web/template/authorize.qtpl:27 +//line web/template/authorize.qtpl:28 } -//line web/template/authorize.qtpl:27 +//line web/template/authorize.qtpl:28 qw422016.N().S(` `) -//line web/template/authorize.qtpl:28 +//line web/template/authorize.qtpl:29 } -//line web/template/authorize.qtpl:28 +//line web/template/authorize.qtpl:29 func (p *Authorize) WriteTitle(qq422016 qtio422016.Writer) { -//line web/template/authorize.qtpl:28 +//line web/template/authorize.qtpl:29 qw422016 := qt422016.AcquireWriter(qq422016) -//line web/template/authorize.qtpl:28 +//line web/template/authorize.qtpl:29 p.StreamTitle(qw422016) -//line web/template/authorize.qtpl:28 +//line web/template/authorize.qtpl:29 qt422016.ReleaseWriter(qw422016) -//line web/template/authorize.qtpl:28 +//line web/template/authorize.qtpl:29 } -//line web/template/authorize.qtpl:28 +//line web/template/authorize.qtpl:29 func (p *Authorize) Title() string { -//line web/template/authorize.qtpl:28 +//line web/template/authorize.qtpl:29 qb422016 := qt422016.AcquireByteBuffer() -//line web/template/authorize.qtpl:28 +//line web/template/authorize.qtpl:29 p.WriteTitle(qb422016) -//line web/template/authorize.qtpl:28 +//line web/template/authorize.qtpl:29 qs422016 := string(qb422016.B) -//line web/template/authorize.qtpl:28 +//line web/template/authorize.qtpl:29 qt422016.ReleaseByteBuffer(qb422016) -//line web/template/authorize.qtpl:28 +//line web/template/authorize.qtpl:29 return qs422016 -//line web/template/authorize.qtpl:28 +//line web/template/authorize.qtpl:29 } -//line web/template/authorize.qtpl:30 +//line web/template/authorize.qtpl:31 func (p *Authorize) StreamBody(qw422016 *qt422016.Writer) { -//line web/template/authorize.qtpl:30 +//line web/template/authorize.qtpl:31 qw422016.N().S(`
`) -//line web/template/authorize.qtpl:32 +//line web/template/authorize.qtpl:33 if p.Client.Logo != nil { -//line web/template/authorize.qtpl:32 +//line web/template/authorize.qtpl:33 qw422016.N().S(` `)
-//line web/template/authorize.qtpl:41
+//line web/template/authorize.qtpl:42
 		qw422016.E().S(p.Client.Name)
-//line web/template/authorize.qtpl:41
+//line web/template/authorize.qtpl:42
 		qw422016.N().S(` `) -//line web/template/authorize.qtpl:43 +//line web/template/authorize.qtpl:44 } -//line web/template/authorize.qtpl:43 +//line web/template/authorize.qtpl:44 qw422016.N().S(`

`) -//line web/template/authorize.qtpl:46 +//line web/template/authorize.qtpl:47 if p.Client.URL != nil { -//line web/template/authorize.qtpl:46 +//line web/template/authorize.qtpl:47 qw422016.N().S(` `) -//line web/template/authorize.qtpl:48 +//line web/template/authorize.qtpl:49 } -//line web/template/authorize.qtpl:48 +//line web/template/authorize.qtpl:49 qw422016.N().S(` `) -//line web/template/authorize.qtpl:49 +//line web/template/authorize.qtpl:50 if p.Client.Name != "" { -//line web/template/authorize.qtpl:49 +//line web/template/authorize.qtpl:50 qw422016.N().S(` `) -//line web/template/authorize.qtpl:50 +//line web/template/authorize.qtpl:51 qw422016.E().S(p.Client.Name) -//line web/template/authorize.qtpl:50 +//line web/template/authorize.qtpl:51 qw422016.N().S(` `) -//line web/template/authorize.qtpl:51 +//line web/template/authorize.qtpl:52 } else { -//line web/template/authorize.qtpl:51 +//line web/template/authorize.qtpl:52 qw422016.N().S(` `) -//line web/template/authorize.qtpl:52 +//line web/template/authorize.qtpl:53 qw422016.E().S(p.Client.ID.String()) -//line web/template/authorize.qtpl:52 +//line web/template/authorize.qtpl:53 qw422016.N().S(` `) -//line web/template/authorize.qtpl:53 +//line web/template/authorize.qtpl:54 } -//line web/template/authorize.qtpl:53 +//line web/template/authorize.qtpl:54 qw422016.N().S(` `) -//line web/template/authorize.qtpl:54 +//line web/template/authorize.qtpl:55 if p.Client.URL != nil { -//line web/template/authorize.qtpl:54 +//line web/template/authorize.qtpl:55 qw422016.N().S(` `) -//line web/template/authorize.qtpl:56 +//line web/template/authorize.qtpl:57 } -//line web/template/authorize.qtpl:56 +//line web/template/authorize.qtpl:57 qw422016.N().S(`

@@ -189,9 +190,9 @@ func (p *Authorize) StreamBody(qw422016 *qt422016.Writer) {
@@ -250,215 +251,215 @@ func (p *Authorize) StreamBody(qw422016 *qt422016.Writer) { target="_self"> `) -//line web/template/authorize.qtpl:99 +//line web/template/authorize.qtpl:100 if p.CSRF != nil { -//line web/template/authorize.qtpl:99 +//line web/template/authorize.qtpl:100 qw422016.N().S(` `) -//line web/template/authorize.qtpl:103 +//line web/template/authorize.qtpl:104 } -//line web/template/authorize.qtpl:103 +//line web/template/authorize.qtpl:104 qw422016.N().S(` `) -//line web/template/authorize.qtpl:105 +//line web/template/authorize.qtpl:106 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 +//line web/template/authorize.qtpl:111 qw422016.N().S(` `) -//line web/template/authorize.qtpl:114 +//line web/template/authorize.qtpl:115 } -//line web/template/authorize.qtpl:114 +//line web/template/authorize.qtpl:115 qw422016.N().S(` `) -//line web/template/authorize.qtpl:116 +//line web/template/authorize.qtpl:117 if len(p.Scope) > 0 { -//line web/template/authorize.qtpl:116 +//line web/template/authorize.qtpl:117 qw422016.N().S(`
`) -//line web/template/authorize.qtpl:118 +//line web/template/authorize.qtpl:119 p.StreamT(qw422016, "Scopes") -//line web/template/authorize.qtpl:118 +//line web/template/authorize.qtpl:119 qw422016.N().S(` `) -//line web/template/authorize.qtpl:120 +//line web/template/authorize.qtpl:121 for _, scope := range p.Scope { -//line web/template/authorize.qtpl:120 +//line web/template/authorize.qtpl:121 qw422016.N().S(`
`) -//line web/template/authorize.qtpl:131 +//line web/template/authorize.qtpl:132 } -//line web/template/authorize.qtpl:131 +//line web/template/authorize.qtpl:132 qw422016.N().S(`
`) -//line web/template/authorize.qtpl:133 +//line web/template/authorize.qtpl:134 } else { -//line web/template/authorize.qtpl:133 +//line web/template/authorize.qtpl:134 qw422016.N().S(` `) -//line web/template/authorize.qtpl:137 +//line web/template/authorize.qtpl:138 } -//line web/template/authorize.qtpl:137 +//line web/template/authorize.qtpl:138 qw422016.N().S(` `) -//line web/template/authorize.qtpl:139 +//line web/template/authorize.qtpl:140 if p.CodeChallenge != "" { -//line web/template/authorize.qtpl:139 +//line web/template/authorize.qtpl:140 qw422016.N().S(` `) -//line web/template/authorize.qtpl:140 +//line web/template/authorize.qtpl:141 for key, val := range map[string]string{ "code_challenge": p.CodeChallenge, "code_challenge_method": p.CodeChallengeMethod.String(), } { -//line web/template/authorize.qtpl:143 +//line web/template/authorize.qtpl:144 qw422016.N().S(` `) -//line web/template/authorize.qtpl:147 +//line web/template/authorize.qtpl:148 } -//line web/template/authorize.qtpl:147 +//line web/template/authorize.qtpl:148 qw422016.N().S(` `) -//line web/template/authorize.qtpl:148 +//line web/template/authorize.qtpl:149 } -//line web/template/authorize.qtpl:148 +//line web/template/authorize.qtpl:149 qw422016.N().S(` `) -//line web/template/authorize.qtpl:150 +//line web/template/authorize.qtpl:151 if p.Me != nil { -//line web/template/authorize.qtpl:150 +//line web/template/authorize.qtpl:151 qw422016.N().S(` `) -//line web/template/authorize.qtpl:154 +//line web/template/authorize.qtpl:155 } -//line web/template/authorize.qtpl:154 +//line web/template/authorize.qtpl:155 qw422016.N().S(` `) -//line web/template/authorize.qtpl:156 +//line web/template/authorize.qtpl:157 if len(p.Providers) > 0 { -//line web/template/authorize.qtpl:156 +//line web/template/authorize.qtpl:157 qw422016.N().S(` `) -//line web/template/authorize.qtpl:169 +//line web/template/authorize.qtpl:170 } else { -//line web/template/authorize.qtpl:169 +//line web/template/authorize.qtpl:170 qw422016.N().S(` `) -//line web/template/authorize.qtpl:173 +//line web/template/authorize.qtpl:174 } -//line web/template/authorize.qtpl:173 +//line web/template/authorize.qtpl:174 qw422016.N().S(` @@ -477,47 +478,47 @@ func (p *Authorize) StreamBody(qw422016 *qt422016.Writer) { value="allow"> `) -//line web/template/authorize.qtpl:186 +//line web/template/authorize.qtpl:187 p.StreamT(qw422016, "Allow") -//line web/template/authorize.qtpl:186 +//line web/template/authorize.qtpl:187 qw422016.N().S(`
`) -//line web/template/authorize.qtpl:194 +//line web/template/authorize.qtpl:195 } -//line web/template/authorize.qtpl:194 +//line web/template/authorize.qtpl:195 func (p *Authorize) WriteBody(qq422016 qtio422016.Writer) { -//line web/template/authorize.qtpl:194 +//line web/template/authorize.qtpl:195 qw422016 := qt422016.AcquireWriter(qq422016) -//line web/template/authorize.qtpl:194 +//line web/template/authorize.qtpl:195 p.StreamBody(qw422016) -//line web/template/authorize.qtpl:194 +//line web/template/authorize.qtpl:195 qt422016.ReleaseWriter(qw422016) -//line web/template/authorize.qtpl:194 +//line web/template/authorize.qtpl:195 } -//line web/template/authorize.qtpl:194 +//line web/template/authorize.qtpl:195 func (p *Authorize) Body() string { -//line web/template/authorize.qtpl:194 +//line web/template/authorize.qtpl:195 qb422016 := qt422016.AcquireByteBuffer() -//line web/template/authorize.qtpl:194 +//line web/template/authorize.qtpl:195 p.WriteBody(qb422016) -//line web/template/authorize.qtpl:194 +//line web/template/authorize.qtpl:195 qs422016 := string(qb422016.B) -//line web/template/authorize.qtpl:194 +//line web/template/authorize.qtpl:195 qt422016.ReleaseByteBuffer(qb422016) -//line web/template/authorize.qtpl:194 +//line web/template/authorize.qtpl:195 return qs422016 -//line web/template/authorize.qtpl:194 +//line web/template/authorize.qtpl:195 } diff --git a/web/template/home.qtpl b/web/template/home.qtpl index 9755408..854c01d 100644 --- a/web/template/home.qtpl +++ b/web/template/home.qtpl @@ -2,6 +2,7 @@ {% import ( "source.toby3d.me/toby3d/auth/internal/domain" + "source.toby3d.me/toby3d/auth/internal/domain/response" "source.toby3d.me/toby3d/auth/web/template/layout" ) %} @@ -54,7 +55,7 @@ {% for name, value := range map[string]string{ "client_id": p.Client.ID.String(), "redirect_uri": p.Client.RedirectURI[0].String(), - "response_type": domain.ResponseTypeCode.String(), + "response_type": response.Code.String(), "scope": domain.Scopes{domain.ScopeEmail, domain.ScopeProfile}.String(), "state": p.State, } %} diff --git a/web/template/home.qtpl.go b/web/template/home.qtpl.go index 6f92b13..0a6a3a7 100644 --- a/web/template/home.qtpl.go +++ b/web/template/home.qtpl.go @@ -7,157 +7,158 @@ package template //line web/template/home.qtpl:3 import ( "source.toby3d.me/toby3d/auth/internal/domain" + "source.toby3d.me/toby3d/auth/internal/domain/response" "source.toby3d.me/toby3d/auth/web/template/layout" ) -//line web/template/home.qtpl:8 +//line web/template/home.qtpl:9 import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" ) -//line web/template/home.qtpl:8 +//line web/template/home.qtpl:9 var ( _ = qtio422016.Copy _ = qt422016.AcquireByteBuffer ) -//line web/template/home.qtpl:8 +//line web/template/home.qtpl:9 type Home struct { layout.BaseOf Client *domain.Client State string } -//line web/template/home.qtpl:15 +//line web/template/home.qtpl:16 func (p *Home) StreamHead(qw422016 *qt422016.Writer) { -//line web/template/home.qtpl:15 - qw422016.N().S(` `) //line web/template/home.qtpl:16 + qw422016.N().S(` `) +//line web/template/home.qtpl:17 p.BaseOf.StreamHead(qw422016) -//line web/template/home.qtpl:16 - qw422016.N().S(` `) //line web/template/home.qtpl:17 + qw422016.N().S(` `) +//line web/template/home.qtpl:18 for i := range p.Client.RedirectURI { -//line web/template/home.qtpl:17 +//line web/template/home.qtpl:18 qw422016.N().S(` `) -//line web/template/home.qtpl:20 +//line web/template/home.qtpl:21 } -//line web/template/home.qtpl:20 +//line web/template/home.qtpl:21 qw422016.N().S(` `) -//line web/template/home.qtpl:21 +//line web/template/home.qtpl:22 } -//line web/template/home.qtpl:21 +//line web/template/home.qtpl:22 func (p *Home) WriteHead(qq422016 qtio422016.Writer) { -//line web/template/home.qtpl:21 +//line web/template/home.qtpl:22 qw422016 := qt422016.AcquireWriter(qq422016) -//line web/template/home.qtpl:21 +//line web/template/home.qtpl:22 p.StreamHead(qw422016) -//line web/template/home.qtpl:21 +//line web/template/home.qtpl:22 qt422016.ReleaseWriter(qw422016) -//line web/template/home.qtpl:21 +//line web/template/home.qtpl:22 } -//line web/template/home.qtpl:21 +//line web/template/home.qtpl:22 func (p *Home) Head() string { -//line web/template/home.qtpl:21 +//line web/template/home.qtpl:22 qb422016 := qt422016.AcquireByteBuffer() -//line web/template/home.qtpl:21 +//line web/template/home.qtpl:22 p.WriteHead(qb422016) -//line web/template/home.qtpl:21 +//line web/template/home.qtpl:22 qs422016 := string(qb422016.B) -//line web/template/home.qtpl:21 +//line web/template/home.qtpl:22 qt422016.ReleaseByteBuffer(qb422016) -//line web/template/home.qtpl:21 +//line web/template/home.qtpl:22 return qs422016 -//line web/template/home.qtpl:21 +//line web/template/home.qtpl:22 } -//line web/template/home.qtpl:23 +//line web/template/home.qtpl:24 func (p *Home) StreamBody(qw422016 *qt422016.Writer) { -//line web/template/home.qtpl:23 +//line web/template/home.qtpl:24 qw422016.N().S(`
`) -//line web/template/home.qtpl:25 +//line web/template/home.qtpl:26 if p.Client.Logo != nil { -//line web/template/home.qtpl:25 +//line web/template/home.qtpl:26 qw422016.N().S(` `) -//line web/template/home.qtpl:35 +//line web/template/home.qtpl:36 } -//line web/template/home.qtpl:35 +//line web/template/home.qtpl:36 qw422016.N().S(`

`) -//line web/template/home.qtpl:41 +//line web/template/home.qtpl:42 qw422016.E().S(p.Client.Name) -//line web/template/home.qtpl:41 +//line web/template/home.qtpl:42 qw422016.N().S(`

`) -//line web/template/home.qtpl:54 +//line web/template/home.qtpl:55 for name, value := range map[string]string{ "client_id": p.Client.ID.String(), "redirect_uri": p.Client.RedirectURI[0].String(), - "response_type": domain.ResponseTypeCode.String(), + "response_type": response.Code.String(), "scope": domain.Scopes{domain.ScopeEmail, domain.ScopeProfile}.String(), "state": p.State, } { -//line web/template/home.qtpl:60 +//line web/template/home.qtpl:61 qw422016.N().S(` `) -//line web/template/home.qtpl:64 +//line web/template/home.qtpl:65 } -//line web/template/home.qtpl:64 +//line web/template/home.qtpl:65 qw422016.N().S(`
`) -//line web/template/home.qtpl:76 +//line web/template/home.qtpl:77 } -//line web/template/home.qtpl:76 +//line web/template/home.qtpl:77 func (p *Home) WriteBody(qq422016 qtio422016.Writer) { -//line web/template/home.qtpl:76 +//line web/template/home.qtpl:77 qw422016 := qt422016.AcquireWriter(qq422016) -//line web/template/home.qtpl:76 +//line web/template/home.qtpl:77 p.StreamBody(qw422016) -//line web/template/home.qtpl:76 +//line web/template/home.qtpl:77 qt422016.ReleaseWriter(qw422016) -//line web/template/home.qtpl:76 +//line web/template/home.qtpl:77 } -//line web/template/home.qtpl:76 +//line web/template/home.qtpl:77 func (p *Home) Body() string { -//line web/template/home.qtpl:76 +//line web/template/home.qtpl:77 qb422016 := qt422016.AcquireByteBuffer() -//line web/template/home.qtpl:76 +//line web/template/home.qtpl:77 p.WriteBody(qb422016) -//line web/template/home.qtpl:76 +//line web/template/home.qtpl:77 qs422016 := string(qb422016.B) -//line web/template/home.qtpl:76 +//line web/template/home.qtpl:77 qt422016.ReleaseByteBuffer(qb422016) -//line web/template/home.qtpl:76 +//line web/template/home.qtpl:77 return qs422016 -//line web/template/home.qtpl:76 +//line web/template/home.qtpl:77 }