fix(oidc): Reset expiry for reauthentication

The previous code resetted the expiry time to be expired.  So the machine was never reauthenticated
This commit is contained in:
Adrien Raffin-Caboisse 2022-03-18 09:32:07 +01:00
parent 1c9b1c0579
commit 61ebb713f2
No known key found for this signature in database
GPG Key ID: 7FB60532DEBEAD6A

View File

@ -10,6 +10,7 @@ import (
"html/template" "html/template"
"net/http" "net/http"
"strings" "strings"
"time"
"github.com/coreos/go-oidc/v3/oidc" "github.com/coreos/go-oidc/v3/oidc"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
@ -229,7 +230,7 @@ func (h *Headscale) OIDCCallback(ctx *gin.Context) {
Str("machine", machine.Name). Str("machine", machine.Name).
Msg("machine already registered, reauthenticating") Msg("machine already registered, reauthenticating")
h.RefreshMachine(machine, *machine.Expiry) h.RefreshMachine(machine, time.Time{})
var content bytes.Buffer var content bytes.Buffer
if err := oidcCallbackTemplate.Execute(&content, oidcCallbackTemplateConfig{ if err := oidcCallbackTemplate.Execute(&content, oidcCallbackTemplateConfig{