mirror of
https://github.com/juanfont/headscale.git
synced 2025-01-31 23:01:23 +09:00
Generalise registration for openid
This commit is contained in:
parent
acb945841c
commit
fd1e4a1dcd
1 changed files with 11 additions and 10 deletions
21
oidc.go
21
oidc.go
|
@ -328,27 +328,28 @@ func (h *Headscale) OIDCCallback(ctx *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ips, err := h.getAvailableIPs()
|
_, err = h.RegisterMachine(
|
||||||
|
machineKeyStr,
|
||||||
|
namespace.Name,
|
||||||
|
RegisterMethodOIDC,
|
||||||
|
&requestedTime,
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
|
&now,
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().
|
log.Error().
|
||||||
Caller().
|
Caller().
|
||||||
Err(err).
|
Err(err).
|
||||||
Msg("could not get an IP from the pool")
|
Msg("could not register machine")
|
||||||
ctx.String(
|
ctx.String(
|
||||||
http.StatusInternalServerError,
|
http.StatusInternalServerError,
|
||||||
"could not get an IP from the pool",
|
"could not register machine",
|
||||||
)
|
)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
machine.IPAddresses = ips
|
|
||||||
machine.NamespaceID = namespace.ID
|
|
||||||
machine.Registered = true
|
|
||||||
machine.RegisterMethod = RegisterMethodOIDC
|
|
||||||
machine.LastSuccessfulUpdate = &now
|
|
||||||
machine.Expiry = &requestedTime
|
|
||||||
h.db.Save(&machine)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var content bytes.Buffer
|
var content bytes.Buffer
|
||||||
|
|
Loading…
Reference in a new issue