mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-31 09:57:17 +02:00
config: multiple endpoints for authorize and databroker (#1957)
* wip * update docs * remove dead code
This commit is contained in:
parent
0f0a50be40
commit
664358dfad
24 changed files with 440 additions and 405 deletions
|
@ -1,7 +1,6 @@
|
|||
package authorize
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -21,40 +20,40 @@ func TestNew(t *testing.T) {
|
|||
{
|
||||
"good",
|
||||
config.Options{
|
||||
AuthenticateURL: mustParseURL("https://authN.example.com"),
|
||||
DataBrokerURL: mustParseURL("https://databroker.example.com"),
|
||||
SharedKey: "2p/Wi2Q6bYDfzmoSEbKqYKtg+DUoLWTEHHs7vOhvL7w=",
|
||||
Policies: policies,
|
||||
AuthenticateURL: mustParseURL("https://authN.example.com"),
|
||||
DataBrokerURLString: "https://databroker.example.com",
|
||||
SharedKey: "2p/Wi2Q6bYDfzmoSEbKqYKtg+DUoLWTEHHs7vOhvL7w=",
|
||||
Policies: policies,
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"bad shared secret",
|
||||
config.Options{
|
||||
AuthenticateURL: mustParseURL("https://authN.example.com"),
|
||||
DataBrokerURL: mustParseURL("https://databroker.example.com"),
|
||||
SharedKey: "AZA85podM73CjLCjViDNz1EUvvejKpWp7Hysr0knXA==",
|
||||
Policies: policies,
|
||||
AuthenticateURL: mustParseURL("https://authN.example.com"),
|
||||
DataBrokerURLString: "https://databroker.example.com",
|
||||
SharedKey: "AZA85podM73CjLCjViDNz1EUvvejKpWp7Hysr0knXA==",
|
||||
Policies: policies,
|
||||
},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"really bad shared secret",
|
||||
config.Options{
|
||||
AuthenticateURL: mustParseURL("https://authN.example.com"),
|
||||
DataBrokerURL: mustParseURL("https://databroker.example.com"),
|
||||
SharedKey: "sup",
|
||||
Policies: policies,
|
||||
AuthenticateURL: mustParseURL("https://authN.example.com"),
|
||||
DataBrokerURLString: "https://databroker.example.com",
|
||||
SharedKey: "sup",
|
||||
Policies: policies,
|
||||
},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"validation error, short secret",
|
||||
config.Options{
|
||||
AuthenticateURL: mustParseURL("https://authN.example.com"),
|
||||
DataBrokerURL: mustParseURL("https://databroker.example.com"),
|
||||
SharedKey: "AZA85podM73CjLCjViDNz1EUvvejKpWp7Hysr0knXA==",
|
||||
Policies: policies,
|
||||
AuthenticateURL: mustParseURL("https://authN.example.com"),
|
||||
DataBrokerURLString: "https://databroker.example.com",
|
||||
SharedKey: "AZA85podM73CjLCjViDNz1EUvvejKpWp7Hysr0knXA==",
|
||||
Policies: policies,
|
||||
},
|
||||
true,
|
||||
},
|
||||
|
@ -62,10 +61,10 @@ func TestNew(t *testing.T) {
|
|||
{
|
||||
"bad databroker url",
|
||||
config.Options{
|
||||
AuthenticateURL: mustParseURL("https://authN.example.com"),
|
||||
DataBrokerURL: &url.URL{},
|
||||
SharedKey: "AZA85podM73CjLCjViDNz1EUvvejKpWp7Hysr0knXA==",
|
||||
Policies: policies,
|
||||
AuthenticateURL: mustParseURL("https://authN.example.com"),
|
||||
DataBrokerURLString: "BAD",
|
||||
SharedKey: "AZA85podM73CjLCjViDNz1EUvvejKpWp7Hysr0knXA==",
|
||||
Policies: policies,
|
||||
},
|
||||
true,
|
||||
},
|
||||
|
@ -100,10 +99,10 @@ func TestAuthorize_OnConfigChange(t *testing.T) {
|
|||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
o := &config.Options{
|
||||
AuthenticateURL: mustParseURL("https://authN.example.com"),
|
||||
DataBrokerURL: mustParseURL("https://databroker.example.com"),
|
||||
SharedKey: tc.SharedKey,
|
||||
Policies: tc.Policies,
|
||||
AuthenticateURL: mustParseURL("https://authN.example.com"),
|
||||
DataBrokerURLString: "https://databroker.example.com",
|
||||
SharedKey: tc.SharedKey,
|
||||
Policies: tc.Policies,
|
||||
}
|
||||
a, err := New(&config.Config{Options: o})
|
||||
require.NoError(t, err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue