dex/connector/connector_uaa_test.go
Jeremy Whitlock 27b80cbca8 connector: add uaa connector
This commit adds support for dex to authenticate users from a
CloudFoundry User Account and Authentication (UAA) Server.

Fixes: #538
2016-08-10 16:04:39 -06:00

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)
}
}