27b80cbca8
This commit adds support for dex to authenticate users from a CloudFoundry User Account and Authentication (UAA) Server. Fixes: #538
47 lines
1.1 KiB
Go
47 lines
1.1 KiB
Go
package connector
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestUAAConnectorConfigInvalidserverURLNotAValidURL(t *testing.T) {
|
|
cc := UAAConnectorConfig{
|
|
ID: "uaa",
|
|
ClientID: "test-client",
|
|
ClientSecret: "test-client-secret",
|
|
ServerURL: "https//login.apigee.com",
|
|
}
|
|
|
|
_, err := cc.Connector(ns, lf, templates)
|
|
if err == nil {
|
|
t.Fatal("Expected UAAConnector initialization to fail when UAA URL is an invalid URL")
|
|
}
|
|
}
|
|
|
|
func TestUAAConnectorConfigInvalidserverURLNotAbsolute(t *testing.T) {
|
|
cc := UAAConnectorConfig{
|
|
ID: "uaa",
|
|
ClientID: "test-client",
|
|
ClientSecret: "test-client-secret",
|
|
ServerURL: "/uaa",
|
|
}
|
|
|
|
_, err := cc.Connector(ns, lf, templates)
|
|
if err == nil {
|
|
t.Fatal("Expected UAAConnector initialization to fail when UAA URL is not an aboslute URL")
|
|
}
|
|
}
|
|
|
|
func TestUAAConnectorConfigValidserverURL(t *testing.T) {
|
|
cc := UAAConnectorConfig{
|
|
ID: "uaa",
|
|
ClientID: "test-client",
|
|
ClientSecret: "test-client-secret",
|
|
ServerURL: "https://login.apigee.com",
|
|
}
|
|
|
|
_, err := cc.Connector(ns, lf, templates)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|