@ -401,12 +401,12 @@ func (c *Direct) TryLogout(ctx context.Context) error {
return err
return err
}
}
func ( c * Direct ) TryLogin ( ctx context . Context , t * tailcfg . Oauth2Token , flags LoginFlags ) ( url string , err error ) {
func ( c * Direct ) TryLogin ( ctx context . Context , flags LoginFlags ) ( url string , err error ) {
if strings . Contains ( c . serverURL , "controlplane.tailscale.com" ) && envknob . Bool ( "TS_PANIC_IF_HIT_MAIN_CONTROL" ) {
if strings . Contains ( c . serverURL , "controlplane.tailscale.com" ) && envknob . Bool ( "TS_PANIC_IF_HIT_MAIN_CONTROL" ) {
panic ( fmt . Sprintf ( "[unexpected] controlclient: TryLogin called on %s; tainted=%v" , c . serverURL , c . panicOnUse ) )
panic ( fmt . Sprintf ( "[unexpected] controlclient: TryLogin called on %s; tainted=%v" , c . serverURL , c . panicOnUse ) )
}
}
c . logf ( "[v1] direct.TryLogin( token=%v, flags=%v)", t != nil , flags )
c . logf ( "[v1] direct.TryLogin( flags=%v)", flags )
return c . doLoginOrRegen ( ctx , loginOpt { Token: t , Flags: flags } )
return c . doLoginOrRegen ( ctx , loginOpt { Flags: flags } )
}
}
// WaitLoginURL sits in a long poll waiting for the user to authenticate at url.
// WaitLoginURL sits in a long poll waiting for the user to authenticate at url.
@ -441,7 +441,6 @@ func (c *Direct) SetExpirySooner(ctx context.Context, expiry time.Time) error {
}
}
type loginOpt struct {
type loginOpt struct {
Token * tailcfg . Oauth2Token
Flags LoginFlags
Flags LoginFlags
Regen bool // generate a new nodekey, can be overridden in doLogin
Regen bool // generate a new nodekey, can be overridden in doLogin
URL string
URL string
@ -610,9 +609,8 @@ 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 || authKey != "" {
if authKey != "" {
request . Auth = & tailcfg . RegisterResponseAuth {
request . Auth = & tailcfg . RegisterResponseAuth {
Oauth2Token : opt . Token ,
AuthKey : authKey ,
AuthKey : authKey ,
}
}
}
}