Merge branch 'master' into grpc-logging

This commit is contained in:
reese 2022-01-20 15:51:21 -06:00 committed by GitHub
commit 647d62c8e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 22 additions and 2 deletions

View file

@ -77,6 +77,8 @@ run go tests:
script:
- echo "Running featurebase unit tests..."
- go test ./...
tags:
- aws
run go tests race:
stage: test
@ -87,6 +89,8 @@ run go tests race:
script:
- echo "Running featurebase race tests..."
- go test -race -timeout=30m ./...
tags:
- aws
run go tests shardwidth22:
stage: test
@ -97,7 +101,9 @@ run go tests shardwidth22:
script:
- echo "Running featurebase race tests..."
- go test -tags=shardwidth22 ./...
tags:
- aws
# we do coverage reporting from the future tests because the json
# output is very difficult to human-read. The alternative would be to
# run the regular tests twice and also run the future tests.
@ -115,6 +121,8 @@ run go tests future:
paths:
- coverage.out
- test-report.out
tags:
- aws
upload to sonarcloud:
stage: test

View file

@ -1491,6 +1491,7 @@ admin: "ac97c9e2-346b-42a2-b6da-18bcb61a32fe"`
AuthorizeURL: "https://login.microsoftonline.com/4a137d66-d161-4ae4-b1e6-07e9920874b8/oauth2/v2.0/authorize",
TokenURL: "https://login.microsoftonline.com/4a137d66-d161-4ae4-b1e6-07e9920874b8/oauth2/v2.0/token",
GroupEndpointURL: "https://graph.microsoft.com/v1.0/me/transitiveMemberOf/microsoft.graph.group?$count=true",
RedirectBaseURL: "https://localhost:10101",
LogoutURL: "https://login.microsoftonline.com/common/oauth2/v2.0/logout",
Scopes: []string{"https://graph.microsoft.com/.default", "offline_access"},
SecretKey: "DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF",

View file

@ -111,6 +111,7 @@ func BuildServerFlags(cmd *cobra.Command, srv *server.Command) {
flags.StringVar(&srv.Config.Auth.ClientId, "auth.client-id", srv.Config.Auth.ClientId, "Identity Provider's Application/Client ID.")
flags.StringVar(&srv.Config.Auth.ClientSecret, "auth.client-secret", srv.Config.Auth.ClientSecret, "Identity Provider's Client Secret.")
flags.StringVar(&srv.Config.Auth.AuthorizeURL, "auth.authorize-url", srv.Config.Auth.AuthorizeURL, "Identity Provider's Authorize URL.")
flags.StringVar(&srv.Config.Auth.RedirectBaseURL, "auth.redirect-base-url", srv.Config.Auth.RedirectBaseURL, "Base URL of the featurebase instance used to redirect IDP.")
flags.StringVar(&srv.Config.Auth.TokenURL, "auth.token-url", srv.Config.Auth.TokenURL, "Identity Provider's Token URL.")
flags.StringVar(&srv.Config.Auth.GroupEndpointURL, "auth.group-endpoint-url", srv.Config.Auth.GroupEndpointURL, "Identity Provider's Group endpoint URL.")
flags.StringVar(&srv.Config.Auth.LogoutURL, "auth.logout-url", srv.Config.Auth.LogoutURL, "Identity Provider's Logout URL.")

View file

@ -381,6 +381,7 @@ log-path = "/var/log/molecula/featurebase.log"
# authorize-url = ""
# token-url = ""
# group-endpoint-url = ""
# redirect-base-url = ""
# logout-url = ""
# scopes = ["", ""]
# secret-key = ""

View file

@ -240,6 +240,7 @@ type Auth struct {
AuthorizeURL string `toml:"authorize-url"`
TokenURL string `toml:"token-url"`
GroupEndpointURL string `toml:"group-endpoint-url"`
RedirectBaseURL string `toml:"redirect-base-url"`
LogoutURL string `toml:"logout-url"`
Scopes []string `toml:"scopes"`
SecretKey string `toml:"secret-key"`
@ -622,6 +623,7 @@ func (c *Config) ValidateAuth() (errors []error) {
{name: "AuthorizeURL", val: c.Auth.AuthorizeURL},
{name: "TokenURL", val: c.Auth.TokenURL},
{name: "GroupEndpointURL", val: c.Auth.GroupEndpointURL},
{name: "RedirectBaseURL", val: c.Auth.RedirectBaseURL},
{name: "LogoutURL", val: c.Auth.LogoutURL},
{name: "SecretKey", val: c.Auth.SecretKey},
{name: "QueryLogPath", val: c.Auth.QueryLogPath},

View file

@ -309,12 +309,14 @@ func TestConfig_validateAuth(t *testing.T) {
errorMesgEmpty,
errorMesgEmpty,
errorMesgEmpty,
errorMesgEmpty,
},
Auth{
Enable: enable,
ClientId: emptyString,
ClientSecret: emptyString,
AuthorizeURL: emptyString,
RedirectBaseURL: emptyString,
TokenURL: emptyString,
GroupEndpointURL: emptyString,
LogoutURL: emptyString,
@ -334,6 +336,7 @@ func TestConfig_validateAuth(t *testing.T) {
ClientSecret: validClientSecret,
AuthorizeURL: validTestURL,
TokenURL: validTestURL,
RedirectBaseURL: validTestURL,
GroupEndpointURL: validTestURL,
LogoutURL: validTestURL,
Scopes: validStringSlice,
@ -354,6 +357,7 @@ func TestConfig_validateAuth(t *testing.T) {
AuthorizeURL: validTestURL,
TokenURL: invalidURL,
GroupEndpointURL: invalidURL,
RedirectBaseURL: validTestURL,
LogoutURL: invalidURL,
Scopes: validStringSlice,
SecretKey: validKey,
@ -372,6 +376,7 @@ func TestConfig_validateAuth(t *testing.T) {
AuthorizeURL: validTestURL,
TokenURL: validTestURL,
GroupEndpointURL: validTestURL,
RedirectBaseURL: validTestURL,
LogoutURL: validTestURL,
Scopes: emptySlice,
SecretKey: validKey,
@ -387,6 +392,7 @@ func TestConfig_validateAuth(t *testing.T) {
ClientSecret: validClientSecret,
AuthorizeURL: validTestURL,
TokenURL: validTestURL,
RedirectBaseURL: validTestURL,
GroupEndpointURL: validTestURL,
LogoutURL: validTestURL,
Scopes: validStringSlice,
@ -402,6 +408,7 @@ func TestConfig_validateAuth(t *testing.T) {
ClientId: emptyString,
ClientSecret: validString,
AuthorizeURL: emptyString,
RedirectBaseURL: validTestURL,
TokenURL: emptyString,
GroupEndpointURL: invalidURL,
LogoutURL: validTestURL,

View file

@ -538,7 +538,7 @@ func (m *Command) SetupServer() error {
}
ac := m.Config.Auth
m.auth, err = authn.NewAuth(m.logger, m.listenURI.String(), ac.Scopes, ac.AuthorizeURL, ac.TokenURL, ac.GroupEndpointURL, ac.LogoutURL, ac.ClientId, ac.ClientSecret, ac.SecretKey)
m.auth, err = authn.NewAuth(m.logger, ac.RedirectBaseURL, ac.Scopes, ac.AuthorizeURL, ac.TokenURL, ac.GroupEndpointURL, ac.LogoutURL, ac.ClientId, ac.ClientSecret, ac.SecretKey)
if err != nil {
return errors.Wrap(err, "instantiating authN object")
}