This commit is contained in:
Jehiah Czebotar 2017-03-29 09:36:38 -04:00
parent c1116ea506
commit c5fc7baa86
4 changed files with 14 additions and 14 deletions

View File

@ -199,7 +199,7 @@ func NewOAuthProxy(opts *Options, validator func(string) bool) *OAuthProxy {
skipAuthRegex: opts.SkipAuthRegex, skipAuthRegex: opts.SkipAuthRegex,
compiledRegex: opts.CompiledRegex, compiledRegex: opts.CompiledRegex,
PassBasicAuth: opts.PassBasicAuth, PassBasicAuth: opts.PassBasicAuth,
PassUserHeaders: opts.PassUserHeaders, PassUserHeaders: opts.PassUserHeaders,
BasicAuthPassword: opts.BasicAuthPassword, BasicAuthPassword: opts.BasicAuthPassword,
PassAccessToken: opts.PassAccessToken, PassAccessToken: opts.PassAccessToken,
SkipProviderButton: opts.SkipProviderButton, SkipProviderButton: opts.SkipProviderButton,

View File

@ -54,7 +54,7 @@ type Options struct {
PassAccessToken bool `flag:"pass-access-token" cfg:"pass_access_token"` PassAccessToken bool `flag:"pass-access-token" cfg:"pass_access_token"`
PassHostHeader bool `flag:"pass-host-header" cfg:"pass_host_header"` PassHostHeader bool `flag:"pass-host-header" cfg:"pass_host_header"`
SkipProviderButton bool `flag:"skip-provider-button" cfg:"skip_provider_button"` SkipProviderButton bool `flag:"skip-provider-button" cfg:"skip_provider_button"`
PassUserHeaders bool `flag:"pass-user-headers" cfg:"pass_user_headers"` PassUserHeaders bool `flag:"pass-user-headers" cfg:"pass_user_headers"`
// These options allow for other providers besides Google, with // These options allow for other providers besides Google, with
// potential overrides. // potential overrides.

View File

@ -3,11 +3,11 @@ package providers
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/bitly/go-simplejson"
"github.com/bitly/oauth2_proxy/api" "github.com/bitly/oauth2_proxy/api"
"log" "log"
"net/http" "net/http"
"net/url" "net/url"
"github.com/bitly/go-simplejson"
) )
type AzureProvider struct { type AzureProvider struct {
@ -67,21 +67,21 @@ func getAzureHeader(access_token string) http.Header {
} }
func getEmailFromJSON(json *simplejson.Json) (string, error) { func getEmailFromJSON(json *simplejson.Json) (string, error) {
var email string var email string
var err error var err error
email, err = json.Get("mail").String() email, err = json.Get("mail").String()
if err != nil || email == "" { if err != nil || email == "" {
otherMails, otherMailsErr := json.Get("otherMails").Array() otherMails, otherMailsErr := json.Get("otherMails").Array()
if len(otherMails) > 0{ if len(otherMails) > 0 {
email = otherMails[0].(string) email = otherMails[0].(string)
} }
err = otherMailsErr err = otherMailsErr
} }
return email, err return email, err
} }
func (p *AzureProvider) GetEmailAddress(s *SessionState) (string, error) { func (p *AzureProvider) GetEmailAddress(s *SessionState) (string, error) {
var email string var email string