Skip to content

Commit

Permalink
Merge pull request #737 from juanfont/fix-machinekey-oidc
Browse files Browse the repository at this point in the history
Fixed another recurrence of MachineKey
  • Loading branch information
juanfont authored Aug 14, 2022
2 parents c19e1a4 + 7fb2f83 commit e29ac8a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -603,10 +603,12 @@ func (h *Headscale) handleMachineExpired(

if h.cfg.OIDC.Issuer != "" {
resp.AuthURL = fmt.Sprintf("%s/oidc/register/%s",
strings.TrimSuffix(h.cfg.ServerURL, "/"), NodePublicKeyStripPrefix(registerRequest.NodeKey))
strings.TrimSuffix(h.cfg.ServerURL, "/"),
NodePublicKeyStripPrefix(registerRequest.NodeKey))
} else {
resp.AuthURL = fmt.Sprintf("%s/register/%s",
strings.TrimSuffix(h.cfg.ServerURL, "/"), NodePublicKeyStripPrefix(registerRequest.NodeKey))
strings.TrimSuffix(h.cfg.ServerURL, "/"),
NodePublicKeyStripPrefix(registerRequest.NodeKey))
}

respBody, err := encode(resp, &machineKey, h.privateKey)
Expand Down Expand Up @@ -699,11 +701,12 @@ func (h *Headscale) handleMachineRegistrationNew(
resp.AuthURL = fmt.Sprintf(
"%s/oidc/register/%s",
strings.TrimSuffix(h.cfg.ServerURL, "/"),
machineKey.String(),
NodePublicKeyStripPrefix(registerRequest.NodeKey),
)
} else {
resp.AuthURL = fmt.Sprintf("%s/register/%s",
strings.TrimSuffix(h.cfg.ServerURL, "/"), NodePublicKeyStripPrefix(registerRequest.NodeKey))
strings.TrimSuffix(h.cfg.ServerURL, "/"),
NodePublicKeyStripPrefix(registerRequest.NodeKey))
}

respBody, err := encode(resp, &machineKey, h.privateKey)
Expand Down

0 comments on commit e29ac8a

Please sign in to comment.