8 "github.com/bitly/oauth2_proxy/api"
11type MyUsaProvider struct {
15func NewMyUsaProvider(p *ProviderData) *MyUsaProvider {
16 const myUsaHost string = "alpha.my.usa.gov"
18 p.ProviderName = "MyUSA"
19 if p.LoginURL.String() == "" {
20 p.LoginURL = &url.URL{Scheme: "https",
22 Path: "/oauth/authorize"}
24 if p.RedeemURL.String() == "" {
25 p.RedeemURL = &url.URL{Scheme: "https",
29 if p.ProfileURL.String() == "" {
30 p.ProfileURL = &url.URL{Scheme: "https",
32 Path: "/api/v1/profile"}
34 if p.ValidateURL.String() == "" {
35 p.ValidateURL = &url.URL{Scheme: "https",
37 Path: "/api/v1/tokeninfo"}
40 p.Scope = "profile.email"
42 return &MyUsaProvider{ProviderData: p}
45func (p *MyUsaProvider) GetEmailAddress(s *SessionState) (string, error) {
46 req, err := http.NewRequest("GET",
47 p.ProfileURL.String()+"?access_token="+s.AccessToken, nil)
49 log.Printf("failed building request %s", err)
52 json, err := api.Request(req)
54 log.Printf("failed making request %s", err)
57 return json.Get("email").String()
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list