mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-11 07:12:59 +02:00
directory: generate user/directory.User ID in a consistent way (#944)
This commit is contained in:
parent
84dde097c7
commit
f7760c413e
13 changed files with 59 additions and 26 deletions
|
@ -15,10 +15,14 @@ import (
|
|||
|
||||
"golang.org/x/oauth2"
|
||||
|
||||
"github.com/pomerium/pomerium/internal/grpc/databroker"
|
||||
"github.com/pomerium/pomerium/internal/grpc/directory"
|
||||
)
|
||||
|
||||
var (
|
||||
// Name is the provider name.
|
||||
const Name = "azure"
|
||||
|
||||
const (
|
||||
defaultGraphHost = "graph.microsoft.com"
|
||||
|
||||
defaultLoginHost = "login.microsoftonline.com"
|
||||
|
@ -122,7 +126,10 @@ func (p *Provider) UserGroups(ctx context.Context) ([]*directory.User, error) {
|
|||
var users []*directory.User
|
||||
for userID, groupIDs := range userIDToGroupIDs {
|
||||
sort.Strings(groupIDs)
|
||||
users = append(users, &directory.User{Id: userID, Groups: groupIDs})
|
||||
users = append(users, &directory.User{
|
||||
Id: databroker.GetUserID(Name, userID),
|
||||
Groups: groupIDs,
|
||||
})
|
||||
}
|
||||
sort.Slice(users, func(i, j int) bool {
|
||||
return users[i].GetId() < users[j].GetId()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue