Skip to content
Snippets Groups Projects
Commit 80a73b95 authored by Kevin Lyda's avatar Kevin Lyda :speech_balloon:
Browse files

Enable new auth provider; set scopes.

parent 3ac8ba07
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ import ( ...@@ -5,7 +5,7 @@ import (
"net/http" "net/http"
"strings" "strings"
"github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac" //"github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac"
"github.com/nsheridan/cashier/server/auth" "github.com/nsheridan/cashier/server/auth"
"github.com/nsheridan/cashier/server/config" "github.com/nsheridan/cashier/server/config"
"github.com/nsheridan/cashier/server/metrics" "github.com/nsheridan/cashier/server/metrics"
...@@ -44,6 +44,7 @@ func New(c *config.Auth) (*Config, error) { ...@@ -44,6 +44,7 @@ func New(c *config.Auth) (*Config, error) {
ClientSecret: c.OauthClientSecret, ClientSecret: c.OauthClientSecret,
RedirectURL: c.OauthCallbackURL, RedirectURL: c.OauthCallbackURL,
Endpoint: microsoft.AzureADEndpoint(c.ProviderOpts["tenant"]), Endpoint: microsoft.AzureADEndpoint(c.ProviderOpts["tenant"]),
Scopes: []string{"openid", "profile", "email"},
}, },
tenant: c.ProviderOpts["tenant"], tenant: c.ProviderOpts["tenant"],
whitelist: uw, whitelist: uw,
......
...@@ -16,6 +16,7 @@ import ( ...@@ -16,6 +16,7 @@ import (
"github.com/nsheridan/cashier/server/auth/github" "github.com/nsheridan/cashier/server/auth/github"
"github.com/nsheridan/cashier/server/auth/gitlab" "github.com/nsheridan/cashier/server/auth/gitlab"
"github.com/nsheridan/cashier/server/auth/google" "github.com/nsheridan/cashier/server/auth/google"
"github.com/nsheridan/cashier/server/auth/microsoft"
"github.com/nsheridan/cashier/server/config" "github.com/nsheridan/cashier/server/config"
"github.com/nsheridan/cashier/server/metrics" "github.com/nsheridan/cashier/server/metrics"
"github.com/nsheridan/cashier/server/signer" "github.com/nsheridan/cashier/server/signer"
...@@ -88,12 +89,14 @@ func Run(conf *config.Config) { ...@@ -88,12 +89,14 @@ func Run(conf *config.Config) {
metrics.Register() metrics.Register()
switch conf.Auth.Provider { switch conf.Auth.Provider {
case "google":
authprovider, err = google.New(conf.Auth)
case "github": case "github":
authprovider, err = github.New(conf.Auth) authprovider, err = github.New(conf.Auth)
case "gitlab": case "gitlab":
authprovider, err = gitlab.New(conf.Auth) authprovider, err = gitlab.New(conf.Auth)
case "google":
authprovider, err = google.New(conf.Auth)
case "microsoft":
authprovider, err = microsoft.New(conf.Auth)
default: default:
log.Fatalf("Unknown provider %s\n", conf.Auth.Provider) log.Fatalf("Unknown provider %s\n", conf.Auth.Provider)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment