forked from ory/hydra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
connection.go
40 lines (31 loc) · 1.12 KB
/
connection.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
35
36
37
38
39
40
package connection
// Connection connects an subject S with a token T issued by provider P
type Connection interface {
// GetID returns the connection's unique identifier.
GetID() string
// GetProvider returns the connection's provider, for example "Google".
GetProvider() string
// GetLocalSubject returns the connection's local subject, for example "peter".
GetLocalSubject() string
// GetRemoteSubject returns the connection's remote subject, for example "peter@gmail.com".
GetRemoteSubject() string
}
// DefaultConnection is a default implementation of the Connection interface
type DefaultConnection struct {
ID string `json:"id,omitempty"`
Provider string `json:"provider" valid:"required"`
LocalSubject string `json:"localSubject" valid:"required"`
RemoteSubject string `json:"remoteSubject" valid:"required"`
}
func (c *DefaultConnection) GetID() string {
return c.ID
}
func (c *DefaultConnection) GetProvider() string {
return c.Provider
}
func (c *DefaultConnection) GetLocalSubject() string {
return c.LocalSubject
}
func (c *DefaultConnection) GetRemoteSubject() string {
return c.RemoteSubject
}