forked from linuxfoundation/lfx-v2-auth-service
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmessage_handler.go
More file actions
56 lines (46 loc) · 1.94 KB
/
message_handler.go
File metadata and controls
56 lines (46 loc) · 1.94 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright The Linux Foundation and each contributor to LFX.
// SPDX-License-Identifier: MIT
package port
import "context"
// MessageHandler defines the behavior of the all domain handlers
type MessageHandler interface {
UserHandler
}
// UserHandler defines the behavior of the user domain handlers
type UserHandler interface {
UserWriteHandler
UserReaderHandler
UserLookupHandler
UserLinkHandler
}
// UserReadHandler defines the behavior of the user read/lookup domain handlers
type UserReaderHandler interface {
GetUserMetadata(ctx context.Context, msg TransportMessenger) ([]byte, error)
GetUserEmails(ctx context.Context, msg TransportMessenger) ([]byte, error)
ListIdentities(ctx context.Context, msg TransportMessenger) ([]byte, error)
}
// UserLookupHandler defines the behavior of the user lookup domain handlers
type UserLookupHandler interface {
EmailToUsername(ctx context.Context, msg TransportMessenger) ([]byte, error)
EmailToSub(ctx context.Context, msg TransportMessenger) ([]byte, error)
}
// UserWriteHandler defines the behavior of the user write domain handlers
type UserWriteHandler interface {
UpdateUser(ctx context.Context, msg TransportMessenger) ([]byte, error)
}
// UserLinkHandler defines the behavior of the user link/alternate email domain handlers
type UserLinkHandler interface {
EmailLinkingHandler
IdentityLinkingHandler
// it will handle social account linking, etc
}
// IdentityLinkingHandler defines the behavior of the identity linking domain handlers
type IdentityLinkingHandler interface {
LinkIdentity(ctx context.Context, msg TransportMessenger) ([]byte, error)
UnlinkIdentity(ctx context.Context, msg TransportMessenger) ([]byte, error)
}
// EmailLinkingHandler defines the behavior of the email linking domain handlers
type EmailLinkingHandler interface {
StartEmailLinking(ctx context.Context, msg TransportMessenger) ([]byte, error)
VerifyEmailLinking(ctx context.Context, msg TransportMessenger) ([]byte, error)
}