-
Notifications
You must be signed in to change notification settings - Fork 11
/
types.go
69 lines (61 loc) · 2.12 KB
/
types.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package main
import (
"encoding/xml"
"html/template"
)
type OAuthAttributes struct {
LastName string `json:"lastName"`
FirstName string `json:"firstName"`
}
type OAuthResponse struct {
Id string `json:"id"`
Attributes OAuthAttributes `json:"attributes"`
Scope []string `json:"scope"`
}
type User struct {
Id string `bson:"_id"`
Username string `bson:"username"`
Fullname string `bson:"fullname"`
GivenName string `bson:"given_name"`
FamilyName string `bson:"family_name"`
IsRegistered bool `bson:"is_registered"`
VerificationKey string `bson:"verification_key"`
}
type ServiceResponse struct {
Xmlns string `xml:"xmlns:cas,attr"`
XMLName xml.Name `xml:"cas:serviceResponse"`
User string `xml:"cas:authenticationSuccess>cas:user"`
NewLogin bool `xml:"cas:authenticationSuccess>cas:attributes>cas:isFromNewLogin"`
Date string `xml:"cas:authenticationSuccess>cas:attributes>cas:authenticationDate"`
GivenName string `xml:"cas:authenticationSuccess>cas:attributes>cas:givenName"`
FamilyName string `xml:"cas:authenticationSuccess>cas:attributes>cas:familyName"`
LongTermAuth bool `xml:"cas:authenticationSuccess>cas:attributes>cas:longTermAuthenticationRequestTokenUsed"`
AccessToken string `xml:"cas:authenticationSuccess>cas:attributes>accessToken"`
AccessTokenScope string `xml:"cas:authenticationSuccess>cas:attributes>accessTokenScope"`
UserName string `xml:"cas:authenticationSuccess>cas:attributes>username"`
}
type AccessToken struct {
Id string `bson:"_id"`
Owner string `bson:"owner"`
TokenId string `bson:"token_id"`
Scopes string `bson:"scopes"`
}
type Template struct {
templates *template.Template
}
type TemplateGlobal struct {
// login flow
LoginForm bool
NotExist bool
NotValid bool
NotAuthorized bool
NotRegistered bool
// cas url
CASLogin string
// osf url
OSFCreateAccount string
OSFDomain string
OSFForgotPassword string
OSFInstitutionLogin string
OSFResendConfirmation string
}