Fix up leftovers from kradalby PR
This commit is contained in:
parent
e7424222db
commit
dbe193ad17
2 changed files with 18 additions and 10 deletions
4
oidc.go
4
oidc.go
|
|
@ -212,6 +212,10 @@ func (h *Headscale) OIDCCallback(c *gin.Context) {
|
|||
c.String(http.StatusBadRequest, "email from claim could not be mapped to a namespace")
|
||||
}
|
||||
|
||||
// getNamespaceFromEmail passes the users email through a list of "matchers"
|
||||
// and iterates through them until it matches and returns a namespace.
|
||||
// If no match is found, an empty string will be returned.
|
||||
// TODO(kradalby): golang Maps key order is not stable, so this list is _not_ deterministic. Find a way to make the list of keys stable, preferably in the order presented in a users configuration.
|
||||
func (h *Headscale) getNamespaceFromEmail(email string) (string, bool) {
|
||||
for match, namespace := range h.cfg.OIDC.MatchMap {
|
||||
regex := regexp.MustCompile(match)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue