Use oidc if it initialised, not if it is configured
OIDC might be configured, but unable to be initialised, this only runs the oidc cycle if it is actually successfully set up/initialised. Prep for next commit Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
a507a04650
commit
8dcc82ceb3
1 changed files with 2 additions and 2 deletions
|
@ -483,7 +483,7 @@ func (h *Headscale) handleNewMachineCommon(
|
||||||
Bool("noise", machineKey.IsZero()).
|
Bool("noise", machineKey.IsZero()).
|
||||||
Str("machine", registerRequest.Hostinfo.Hostname).
|
Str("machine", registerRequest.Hostinfo.Hostname).
|
||||||
Msg("The node seems to be new, sending auth url")
|
Msg("The node seems to be new, sending auth url")
|
||||||
if h.cfg.OIDC.Issuer != "" {
|
if h.oauth2Config != nil {
|
||||||
resp.AuthURL = fmt.Sprintf(
|
resp.AuthURL = fmt.Sprintf(
|
||||||
"%s/oidc/register/%s",
|
"%s/oidc/register/%s",
|
||||||
strings.TrimSuffix(h.cfg.ServerURL, "/"),
|
strings.TrimSuffix(h.cfg.ServerURL, "/"),
|
||||||
|
@ -716,7 +716,7 @@ func (h *Headscale) handleMachineExpiredCommon(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if h.cfg.OIDC.Issuer != "" {
|
if h.oauth2Config != nil {
|
||||||
resp.AuthURL = fmt.Sprintf("%s/oidc/register/%s",
|
resp.AuthURL = fmt.Sprintf("%s/oidc/register/%s",
|
||||||
strings.TrimSuffix(h.cfg.ServerURL, "/"),
|
strings.TrimSuffix(h.cfg.ServerURL, "/"),
|
||||||
NodePublicKeyStripPrefix(registerRequest.NodeKey))
|
NodePublicKeyStripPrefix(registerRequest.NodeKey))
|
||||||
|
|
Loading…
Reference in a new issue