-
Notifications
You must be signed in to change notification settings - Fork 29
/
model.go
38 lines (33 loc) · 1.4 KB
/
model.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
package authenticationinfo
import (
"time"
"github.com/authgear/authgear-server/pkg/util/base32"
"github.com/authgear/authgear-server/pkg/util/rand"
)
type T struct {
UserID string `json:"user_id,omitempty"`
// AMR is authentication means used in the authentication.
// On Android, we cannot tell the exact biometric means used in the authentication.
// Therefore, we cannot reliably populate AMR.
//
// From RFC8176, the AMR values "swk" and "user" may apply.
// See https://developer.android.com/reference/androidx/biometric/BiometricPrompt#AUTHENTICATION_RESULT_TYPE_BIOMETRIC
AMR []string `json:"amr,omitempty"`
AuthenticatedAt time.Time `json:"authenticated_at,omitempty"`
// ShouldFireAuthenticatedEventWhenIssueOfflineGrant indicates we should fire authenticated event during code exchange
// This value will be filled in during interaction / workflow / authentication flow
ShouldFireAuthenticatedEventWhenIssueOfflineGrant bool `json:"should_fire_authenticated_event_when_issue_offline_grant,omitempty"`
}
type Entry struct {
ID string `json:"id,omitempty"`
T T `json:"t,omitempty"`
OAuthSessionID string `json:"oauth_session_id,omitempty"`
}
func NewEntry(t T, oauthSessionID string) *Entry {
id := rand.StringWithAlphabet(32, base32.Alphabet, rand.SecureRand)
return &Entry{
ID: id,
T: t,
OAuthSessionID: oauthSessionID,
}
}