forked from zitadel/zitadel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
idp.go
34 lines (30 loc) · 1.07 KB
/
idp.go
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
package auth
import (
"context"
idp_grpc "github.com/dennigogo/zitadel/internal/api/grpc/idp"
"github.com/dennigogo/zitadel/internal/api/grpc/object"
auth_pb "github.com/dennigogo/zitadel/pkg/grpc/auth"
)
func (s *Server) ListMyLinkedIDPs(ctx context.Context, req *auth_pb.ListMyLinkedIDPsRequest) (*auth_pb.ListMyLinkedIDPsResponse, error) {
q, err := ListMyLinkedIDPsRequestToQuery(ctx, req)
if err != nil {
return nil, err
}
links, err := s.query.IDPUserLinks(ctx, q)
if err != nil {
return nil, err
}
return &auth_pb.ListMyLinkedIDPsResponse{
Result: idp_grpc.IDPUserLinksToPb(links.Links),
Details: object.ToListDetails(links.Count, links.Sequence, links.Timestamp),
}, nil
}
func (s *Server) RemoveMyLinkedIDP(ctx context.Context, req *auth_pb.RemoveMyLinkedIDPRequest) (*auth_pb.RemoveMyLinkedIDPResponse, error) {
objectDetails, err := s.command.RemoveUserIDPLink(ctx, RemoveMyLinkedIDPRequestToDomain(ctx, req))
if err != nil {
return nil, err
}
return &auth_pb.RemoveMyLinkedIDPResponse{
Details: object.DomainToChangeDetailsPb(objectDetails),
}, nil
}