Adapted recommendation from Maintainer for PR #1888

Signed-off-by: Maik Brauer <maik.brauer@vodafone.com>
This commit is contained in:
Maik Brauer 2021-01-05 17:10:57 +01:00
parent eb9ef3b0ec
commit c55f17ea64
2 changed files with 4 additions and 6 deletions

View File

@ -52,7 +52,7 @@ type Config struct {
Groups []string `json:"groups"`
GroupNameFormat GroupNameFormat `json:"groupNameFormat"`
UseGroupsAsWhitelist bool `json:"useGroupsAsWhitelist"`
UpnToLowercase bool `json:"upnToLowercase"`
emailToLowercase bool `json:"emailToLowercase"`
}
// Open returns a strategy for logging in through Microsoft.
@ -69,7 +69,7 @@ func (c *Config) Open(id string, logger log.Logger) (connector.Connector, error)
groupNameFormat: c.GroupNameFormat,
useGroupsAsWhitelist: c.UseGroupsAsWhitelist,
logger: logger,
upnToLowercase: c.UpnToLowercase,
emailToLowercase: c.EmailToLowercase,
}
// By default allow logins from both personal and business/school
// accounts.
@ -112,7 +112,7 @@ type microsoftConnector struct {
groups []string
useGroupsAsWhitelist bool
logger log.Logger
upnToLowercase bool
emailToLowercase bool
}
func (c *microsoftConnector) isOrgTenant() bool {
@ -175,7 +175,7 @@ func (c *microsoftConnector) HandleCallback(s connector.Scopes, r *http.Request)
return identity, fmt.Errorf("microsoft: get user: %v", err)
}
if c.upnToLowercase {
if c.emailToLowercase {
user.Email = strings.ToLower(user.Email)
}

2
go.mod
View File

@ -25,7 +25,6 @@ require (
github.com/lib/pq v1.3.0
github.com/mattermost/xml-roundtrip-validator v0.0.0-20201204154048-1a8688af4cf1
github.com/mattn/go-sqlite3 v1.11.0
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/pkg/errors v0.9.1
github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35 // indirect
github.com/prometheus/client_golang v1.4.0
@ -47,7 +46,6 @@ require (
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d // indirect
gopkg.in/ldap.v2 v2.5.1
gopkg.in/square/go-jose.v2 v2.4.1
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc // indirect
sigs.k8s.io/testing_frameworks v0.1.2
)