-
Notifications
You must be signed in to change notification settings - Fork 1
/
users.go
78 lines (58 loc) · 2.15 KB
/
users.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
70
71
72
73
74
75
76
77
78
package gobs
type userData struct {
data
}
type usersRegister struct {
Username string
Password string
DataItem interface{}
}
type socialIdentity struct {
Provider string
Token string
TokenSecret string
}
func (u userData) LoginWithFacebook(accessToken string) error {
fbLogin := socialIdentity{Provider: "Facebook", Token: accessToken}
return u.loginWithProvider(fbLogin)
}
func (u userData) LinkWithFacebook(accessToken string, userId string) error {
fbLink := socialIdentity{Provider: "Facebook", Token: accessToken}
return u.linkWithProvider(fbLink, userId)
}
func (u userData) UnlinkFromFacebook(userId string) error {
return u.unlinkFromProvider(userId, "Facebook")
}
func (u userData) LoginWithGoogle(accessToken string) error {
googleLogin := socialIdentity{Provider: "Google", Token: accessToken}
return u.loginWithProvider(googleLogin)
}
func (u userData) LinkWithGoogle(accessToken string, userId string) error {
googleLink := socialIdentity{Provider: "Google", Token: accessToken}
return u.linkWithProvider(googleLink, userId)
}
func (u userData) UnlinkFromGoogle(userId string) error {
return u.unlinkFromProvider(userId, "Google")
}
func (u userData) LoginWithLiveID(accessToken string) error {
liveIdLogin := socialIdentity{Provider: "LiveID", Token: accessToken}
return u.loginWithProvider(liveIdLogin)
}
func (u userData) LinkWithLiveID(accessToken string, userId string) error {
liveIdLink := socialIdentity{Provider: "LiveID", Token: accessToken}
return u.linkWithProvider(liveIdLink, userId)
}
func (u userData) UnlinkFromLiveID(userId string) error {
return u.unlinkFromProvider(userId, "LiveID")
}
func (u userData) LoginWithADFS(accessToken string) error {
adfsLogin := socialIdentity{Provider: "ADFS", Token: accessToken}
return u.loginWithProvider(adfsLogin)
}
func (u userData) LinkWithADFS(accessToken string, userId string) error {
adfsLink := socialIdentity{Provider: "ADFS", Token: accessToken}
return u.linkWithProvider(adfsLink, userId)
}
func (u userData) UnlinkFromADFS(userId string) error {
return u.unlinkFromProvider(userId, "ADFS")
}