-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser.go
More file actions
111 lines (86 loc) · 2.2 KB
/
user.go
File metadata and controls
111 lines (86 loc) · 2.2 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
package oidcsdk
import (
"github.com/identityOrg/oidcsdk/util"
"strings"
)
type RequestProfile map[string]string
func NewRequestProfile() RequestProfile {
return make(map[string]string)
}
func (r RequestProfile) GetUsername() string {
return r["username"]
}
func (r RequestProfile) SetUsername(username string) {
r["username"] = username
}
func (r RequestProfile) GetClientID() string {
return r["client_id"]
}
func (r RequestProfile) SetClientID(username string) {
r["client_id"] = username
}
func (r RequestProfile) GetState() string {
return r["state"]
}
func (r RequestProfile) SetState(state string) {
r["state"] = state
}
func (r RequestProfile) GetNonce() string {
return r["nonce"]
}
func (r RequestProfile) SetNonce(nonce string) {
r["nonce"] = nonce
}
func (r RequestProfile) GetRedirectURI() string {
return r["redirect_uri"]
}
func (r RequestProfile) SetRedirectURI(redirectUri string) {
r["redirect_uri"] = redirectUri
}
func (r RequestProfile) GetScope() Arguments {
s := r["scope"]
if s != "" {
return util.RemoveEmpty(strings.Split(s, " "))
}
return []string{}
}
func (r RequestProfile) SetScope(scopes Arguments) {
r["scope"] = strings.Join(scopes, " ")
}
func (r RequestProfile) GetAudience() Arguments {
s := r["audience"]
if s != "" {
return util.RemoveEmpty(strings.Split(s, " "))
}
return []string{}
}
func (r RequestProfile) SetAudience(aud Arguments) {
r["audience"] = strings.Join(aud, " ")
}
func (r RequestProfile) IsClient() bool {
return r["domain"] == ""
}
func (r RequestProfile) GetDomain() string {
return r["domain"]
}
func (r RequestProfile) SetDomain(domain string) {
r["domain"] = domain
}
func (r RequestProfile) GetCodeChallenge() string {
return r["code_challenge"]
}
func (r RequestProfile) SetCodeChallenge(challenge string) {
r["code_challenge"] = challenge
}
func (r RequestProfile) GetCodeChallengeMethod() string {
return r["code_challenge_method"]
}
func (r RequestProfile) SetCodeChallengeMethod(challengeMethod string) {
r["code_challenge_method"] = challengeMethod
}
func (r RequestProfile) GetGrantType() string {
return r["grant_type"]
}
func (r RequestProfile) SetGrantType(challengeMethod string) {
r["grant_type"] = challengeMethod
}