-
Notifications
You must be signed in to change notification settings - Fork 27
/
session.go
46 lines (35 loc) · 1.13 KB
/
session.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
41
42
43
44
45
46
package session
import (
"time"
"github.com/authgear/authgear-server/pkg/api/model"
"github.com/authgear/authgear-server/pkg/lib/authn/authenticationinfo"
"github.com/authgear/authgear-server/pkg/lib/session/access"
)
type Type string
const (
TypeIdentityProvider Type = "idp"
TypeOfflineGrant Type = "offline_grant"
)
type Session interface {
SessionID() string
SessionType() Type
GetClientID() string
GetCreatedAt() time.Time
GetAccessInfo() *access.Info
GetDeviceInfo() (map[string]interface{}, bool)
GetAuthenticationInfo() authenticationinfo.T
ToAPIModel() *model.Session
// SSOGroupIDPSessionID returns the IDP session id of the SSO group
// if the session is not SSO enabled, SSOGroupIDPSessionID will be empty
SSOGroupIDPSessionID() string
// IsSameSSOGroup indicates whether the session is in the same SSO group
IsSameSSOGroup(s Session) bool
Equal(s Session) bool
}
type CreateReason string
const (
CreateReasonSignup CreateReason = "signup"
CreateReasonLogin CreateReason = "login"
CreateReasonPromote CreateReason = "promote"
CreateReasonReauthenticate CreateReason = "reauthenticate"
)