-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathidentityIDs.go
More file actions
35 lines (28 loc) · 872 Bytes
/
identityIDs.go
File metadata and controls
35 lines (28 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package manage
import (
"context"
"github.com/fident/go-manage/fidentapi"
"github.com/fident/go-manage/tls"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/metadata"
)
// GetAllIdentityIDsForProject retrieves all identity ids for your fident project
func (i *Instance) GetAllIdentityIDsForProject() ([]string, error) {
meta, err := i.preflightAuth()
if err != nil {
return []string{}, err
}
ctx := metadata.NewOutgoingContext(context.Background(), meta)
conn, err := grpc.Dial(i.fidentEndpoint, grpc.WithTransportCredentials(credentials.NewTLS(tls.FidentTSLConfig)))
if err != nil {
return []string{}, err
}
defer conn.Close()
c := fidentapi.NewAuthClient(conn)
res, err := c.GetAllIdentityIDs(ctx, &fidentapi.IdentityIDsRequest{})
if err != nil {
return []string{}, err
}
return res.IdentityId, nil
}