tailcfg: remove some unused fields from RegisterResponseAuth

Fixes #19334

Change-Id: Id6463f28af23078a7bc25b9280c99d4491bd9651
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2024-04-21 10:17:51 -07:00 committed by Brad Fitzpatrick
parent 05bfa022f2
commit c39cde79d2
4 changed files with 2 additions and 13 deletions

View File

@ -6,7 +6,6 @@ package controlclient
import ( import (
"bufio" "bufio"
"bytes" "bytes"
"cmp"
"context" "context"
"crypto/ed25519" "crypto/ed25519"
"encoding/base64" "encoding/base64"
@ -587,11 +586,9 @@ func (c *Direct) doLogin(ctx context.Context, opt loginOpt) (mustRegen bool, new
c.logf("RegisterReq: onode=%v node=%v fup=%v nks=%v", c.logf("RegisterReq: onode=%v node=%v fup=%v nks=%v",
request.OldNodeKey.ShortString(), request.OldNodeKey.ShortString(),
request.NodeKey.ShortString(), opt.URL != "", len(nodeKeySignature) > 0) request.NodeKey.ShortString(), opt.URL != "", len(nodeKeySignature) > 0)
if opt.Token != nil || cmp.Or(persist.Provider, persist.UserProfile.LoginName, authKey) != "" { if opt.Token != nil || authKey != "" {
request.Auth = &tailcfg.RegisterResponseAuth{ request.Auth = &tailcfg.RegisterResponseAuth{
Oauth2Token: opt.Token, Oauth2Token: opt.Token,
Provider: persist.Provider,
LoginName: persist.UserProfile.LoginName,
AuthKey: authKey, AuthKey: authKey,
} }
} }

View File

@ -1070,10 +1070,8 @@ func (st SignatureType) String() string {
type RegisterResponseAuth struct { type RegisterResponseAuth struct {
_ structs.Incomparable _ structs.Incomparable
// One of Provider/LoginName, Oauth2Token, or AuthKey is set. // At most one of Oauth2Token or AuthKey is set.
Provider string `json:",omitempty"`
LoginName string `json:",omitempty"`
Oauth2Token *Oauth2Token `json:",omitempty"` Oauth2Token *Oauth2Token `json:",omitempty"`
AuthKey string `json:",omitempty"` AuthKey string `json:",omitempty"`
} }

View File

@ -321,8 +321,6 @@ func (src *RegisterResponseAuth) Clone() *RegisterResponseAuth {
// A compilation failure here means this code must be regenerated, with the command at the top of this file. // A compilation failure here means this code must be regenerated, with the command at the top of this file.
var _RegisterResponseAuthCloneNeedsRegeneration = RegisterResponseAuth(struct { var _RegisterResponseAuthCloneNeedsRegeneration = RegisterResponseAuth(struct {
_ structs.Incomparable _ structs.Incomparable
Provider string
LoginName string
Oauth2Token *Oauth2Token Oauth2Token *Oauth2Token
AuthKey string AuthKey string
}{}) }{})

View File

@ -701,8 +701,6 @@ func (v *RegisterResponseAuthView) UnmarshalJSON(b []byte) error {
return nil return nil
} }
func (v RegisterResponseAuthView) Provider() string { return v.ж.Provider }
func (v RegisterResponseAuthView) LoginName() string { return v.ж.LoginName }
func (v RegisterResponseAuthView) Oauth2Token() *Oauth2Token { func (v RegisterResponseAuthView) Oauth2Token() *Oauth2Token {
if v.ж.Oauth2Token == nil { if v.ж.Oauth2Token == nil {
return nil return nil
@ -716,8 +714,6 @@ func (v RegisterResponseAuthView) AuthKey() string { return v.ж.AuthKey }
// A compilation failure here means this code must be regenerated, with the command at the top of this file. // A compilation failure here means this code must be regenerated, with the command at the top of this file.
var _RegisterResponseAuthViewNeedsRegeneration = RegisterResponseAuth(struct { var _RegisterResponseAuthViewNeedsRegeneration = RegisterResponseAuth(struct {
_ structs.Incomparable _ structs.Incomparable
Provider string
LoginName string
Oauth2Token *Oauth2Token Oauth2Token *Oauth2Token
AuthKey string AuthKey string
}{}) }{})