refactor: drop redundant embedded field selectors

Satisfies staticcheck QF1008.
This commit is contained in:
Trong Huu Nguyen
2026-07-28 09:04:42 +02:00
parent 4aef16afa4
commit c6e711cd85
3 changed files with 15 additions and 15 deletions
+3 -3
View File
@@ -29,14 +29,14 @@ type Cookie struct {
}
func (in *Cookie) Encrypt(crypter crypto.Crypter) (*Cookie, error) {
plaintext := []byte(in.Cookie.Value)
plaintext := []byte(in.Value)
ciphertext, err := crypter.Encrypt(plaintext)
if err != nil {
return nil, fmt.Errorf("unable to encrypt cookie '%s': %w", in.Cookie.Name, err)
return nil, fmt.Errorf("unable to encrypt cookie '%s': %w", in.Name, err)
}
value := base64.RawURLEncoding.EncodeToString(ciphertext)
in.Cookie.Value = value
in.Value = value
return in, nil
}
+11 -11
View File
@@ -17,7 +17,7 @@ type TestClientConfiguration struct {
var _ openidconfig.Client = (*TestClientConfiguration)(nil)
func (c *TestClientConfiguration) ACRValues() string {
return c.Config.OpenID.ACRValues
return c.OpenID.ACRValues
}
func (c *TestClientConfiguration) Audiences() map[string]bool {
@@ -29,7 +29,7 @@ func (c *TestClientConfiguration) AuthMethod() openidconfig.AuthMethod {
}
func (c *TestClientConfiguration) ClientID() string {
return c.Config.OpenID.ClientID
return c.OpenID.ClientID
}
func (c *TestClientConfiguration) ClientJWK() jwk.Key {
@@ -37,39 +37,39 @@ func (c *TestClientConfiguration) ClientJWK() jwk.Key {
}
func (c *TestClientConfiguration) ClientSecret() string {
return c.Config.OpenID.ClientSecret
return c.OpenID.ClientSecret
}
func (c *TestClientConfiguration) DomainHint() string {
return c.Config.OpenID.DomainHint
return c.OpenID.DomainHint
}
func (c *TestClientConfiguration) NewClientAuthJWTType() bool {
return c.Config.OpenID.NewClientAuthJWTType
return c.OpenID.NewClientAuthJWTType
}
func (c *TestClientConfiguration) SetPostLogoutRedirectURI(uri string) {
c.Config.OpenID.PostLogoutRedirectURI = uri
c.OpenID.PostLogoutRedirectURI = uri
}
func (c *TestClientConfiguration) PostLogoutRedirectURI() string {
return c.Config.OpenID.PostLogoutRedirectURI
return c.OpenID.PostLogoutRedirectURI
}
func (c *TestClientConfiguration) ResourceIndicator() string {
return c.Config.OpenID.ResourceIndicator
return c.OpenID.ResourceIndicator
}
func (c *TestClientConfiguration) Scopes() scopes.Scopes {
return scopes.DefaultScopes().WithAdditional(c.Config.OpenID.Scopes...)
return scopes.DefaultScopes().WithAdditional(c.OpenID.Scopes...)
}
func (c *TestClientConfiguration) UILocales() string {
return c.Config.OpenID.UILocales
return c.OpenID.UILocales
}
func (c *TestClientConfiguration) WellKnownURL() string {
return c.Config.OpenID.WellKnownURL
return c.OpenID.WellKnownURL
}
func clientConfiguration(cfg *config.Config) *TestClientConfiguration {
+1 -1
View File
@@ -212,7 +212,7 @@ func (in *IDToken) Claim(claim string) (any, error) {
}
var gotClaim any
if err := in.Token.Get(claim, &gotClaim); err != nil {
if err := in.Get(claim, &gotClaim); err != nil {
return nil, fmt.Errorf("missing required '%s' claim in id_token: %w", claim, err)
}