-
Notifications
You must be signed in to change notification settings - Fork 0
/
New.go
37 lines (31 loc) · 1.05 KB
/
New.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
package sloauth2
import (
"golang.org/x/oauth2"
)
func New(cliId, cliSec, authURL, tokURL string, opt ...OptionsT) (*Oauth2T, error) {
var oa Oauth2T
// var e error
var secure bool
var o OptionsT
if len(opt) == 0 {
secure = true
} else {
secure = o.Secure
}
oa = Oauth2T{
Config: &oauth2.Config{
ClientID: cliId,
ClientSecret: cliSec,
// Scopes: []string{"profile"},
Scopes: []string{"profile","website","birthdate","gender","preferred_username","given_name","middle_name","locale","picture","zone_info","updated_at","nickname","name","family_name","address","phone_number_verified","phone_number"},
// Scopes: []string{"urn:netiq.com:nam:scope:oauth:registration:full","profile","address","phone","urn:netiq.com:nam:scope:oauth:registration:read","openid"},
Endpoint: oauth2.Endpoint{
AuthURL: authURL,
TokenURL: tokURL,
},
},
Session: map[string]map[string]interface{}{},
Secure: secure,
}
return &oa, nil
}