mirror of https://github.com/dexidp/dex.git
10 changed files with 474 additions and 470 deletions
@ -1,275 +1,358 @@ |
|||||||
package keystone |
package keystone |
||||||
|
|
||||||
import ( |
import ( |
||||||
"testing" |
|
||||||
"github.com/dexidp/dex/connector" |
|
||||||
|
|
||||||
"fmt" |
|
||||||
"io" |
|
||||||
"os" |
|
||||||
"time" |
|
||||||
"net/http" |
|
||||||
|
|
||||||
"github.com/docker/docker/api/types" |
|
||||||
"github.com/docker/docker/api/types/container" |
|
||||||
"github.com/docker/docker/client" |
|
||||||
networktypes "github.com/docker/docker/api/types/network" |
|
||||||
"github.com/docker/go-connections/nat" |
|
||||||
"golang.org/x/net/context" |
|
||||||
"bytes" |
"bytes" |
||||||
|
"context" |
||||||
"encoding/json" |
"encoding/json" |
||||||
|
"fmt" |
||||||
"io/ioutil" |
"io/ioutil" |
||||||
) |
"net/http" |
||||||
|
"os" |
||||||
const dockerCliVersion = "1.37" |
"reflect" |
||||||
|
"strings" |
||||||
const exposedKeystonePort = "5000" |
"testing" |
||||||
const exposedKeystonePortAdmin = "35357" |
|
||||||
|
|
||||||
const keystoneHost = "http://localhost" |
|
||||||
const keystoneURL = keystoneHost + ":" + exposedKeystonePort |
|
||||||
const keystoneAdminURL = keystoneHost + ":" + exposedKeystonePortAdmin |
|
||||||
const authTokenURL = keystoneURL + "/v3/auth/tokens/" |
|
||||||
const userURL = keystoneAdminURL + "/v3/users/" |
|
||||||
const groupURL = keystoneAdminURL + "/v3/groups/" |
|
||||||
|
|
||||||
func startKeystoneContainer() string { |
|
||||||
ctx := context.Background() |
|
||||||
cli, err := client.NewClientWithOpts(client.WithVersion(dockerCliVersion)) |
|
||||||
|
|
||||||
if err != nil { |
"github.com/dexidp/dex/connector" |
||||||
fmt.Printf("Error %v", err) |
) |
||||||
return "" |
|
||||||
} |
|
||||||
|
|
||||||
imageName := "openio/openstack-keystone" |
const ( |
||||||
out, err := cli.ImagePull(ctx, imageName, types.ImagePullOptions{}) |
adminUser = "demo" |
||||||
if err != nil { |
adminPass = "DEMO_PASS" |
||||||
fmt.Printf("Error %v", err) |
invalidPass = "WRONG_PASS" |
||||||
return "" |
|
||||||
} |
|
||||||
io.Copy(os.Stdout, out) |
|
||||||
|
|
||||||
resp, err := cli.ContainerCreate(ctx, &container.Config{ |
|
||||||
Image: imageName, |
|
||||||
}, &container.HostConfig{ |
|
||||||
PortBindings: nat.PortMap{ |
|
||||||
"5000/tcp": []nat.PortBinding{ |
|
||||||
{ |
|
||||||
HostIP: "0.0.0.0", |
|
||||||
HostPort: exposedKeystonePort, |
|
||||||
}, |
|
||||||
}, |
|
||||||
"35357/tcp": []nat.PortBinding{ |
|
||||||
{ |
|
||||||
HostIP: "0.0.0.0", |
|
||||||
HostPort: exposedKeystonePortAdmin, |
|
||||||
}, |
|
||||||
}, |
|
||||||
}, |
|
||||||
}, &networktypes.NetworkingConfig{}, "dex_keystone_test") |
|
||||||
|
|
||||||
if err != nil { |
testUser = "test_user" |
||||||
fmt.Printf("Error %v", err) |
testPass = "test_pass" |
||||||
return "" |
testEmail = "test@example.com" |
||||||
} |
testGroup = "test_group" |
||||||
|
testDomain = "default" |
||||||
|
) |
||||||
|
|
||||||
if err := cli.ContainerStart(ctx, resp.ID, types.ContainerStartOptions{}); err != nil { |
var ( |
||||||
panic(err) |
keystoneURL = "" |
||||||
} |
keystoneAdminURL = "" |
||||||
|
authTokenURL = "" |
||||||
|
usersURL = "" |
||||||
|
groupsURL = "" |
||||||
|
) |
||||||
|
|
||||||
fmt.Println(resp.ID) |
type userResponse struct { |
||||||
return resp.ID |
User struct { |
||||||
|
ID string `json:"id"` |
||||||
|
} `json:"user"` |
||||||
} |
} |
||||||
|
|
||||||
func cleanKeystoneContainer(ID string) { |
type groupResponse struct { |
||||||
ctx := context.Background() |
Group struct { |
||||||
cli, err := client.NewClientWithOpts(client.WithVersion(dockerCliVersion)) |
ID string `json:"id"` |
||||||
if err != nil { |
} `json:"group"` |
||||||
fmt.Printf("Error %v", err) |
|
||||||
return |
|
||||||
} |
|
||||||
duration := time.Duration(1) |
|
||||||
if err:= cli.ContainerStop(ctx, ID, &duration); err != nil { |
|
||||||
fmt.Printf("Error %v", err) |
|
||||||
return |
|
||||||
} |
|
||||||
if err:= cli.ContainerRemove(ctx, ID, types.ContainerRemoveOptions{}); err != nil { |
|
||||||
fmt.Printf("Error %v", err) |
|
||||||
} |
|
||||||
} |
} |
||||||
|
|
||||||
func getAdminToken(admin_name, admin_pass string) (token string) { |
func getAdminToken(t *testing.T, adminName, adminPass string) (token, id string) { |
||||||
|
t.Helper() |
||||||
client := &http.Client{} |
client := &http.Client{} |
||||||
|
|
||||||
jsonData := LoginRequestData{ |
jsonData := loginRequestData{ |
||||||
Auth: Auth{ |
auth: auth{ |
||||||
Identity: Identity{ |
Identity: identity{ |
||||||
Methods:[]string{"password"}, |
Methods: []string{"password"}, |
||||||
Password: Password{ |
Password: password{ |
||||||
User: User{ |
User: user{ |
||||||
Name: admin_name, |
Name: adminName, |
||||||
Domain: Domain{ID: "default"}, |
Domain: domain{ID: testDomain}, |
||||||
Password: admin_pass, |
Password: adminPass, |
||||||
}, |
}, |
||||||
}, |
}, |
||||||
}, |
}, |
||||||
}, |
}, |
||||||
} |
} |
||||||
|
|
||||||
body, _ := json.Marshal(jsonData) |
body, err := json.Marshal(jsonData) |
||||||
|
if err != nil { |
||||||
|
t.Fatal(err) |
||||||
|
} |
||||||
|
|
||||||
req, _ := http.NewRequest("POST", authTokenURL, bytes.NewBuffer(body)) |
req, err := http.NewRequest("POST", authTokenURL, bytes.NewBuffer(body)) |
||||||
|
if err != nil { |
||||||
|
t.Fatalf("keystone: failed to obtain admin token: %v\n", err) |
||||||
|
} |
||||||
|
|
||||||
req.Header.Set("Content-Type", "application/json") |
req.Header.Set("Content-Type", "application/json") |
||||||
resp, _ := client.Do(req) |
resp, err := client.Do(req) |
||||||
|
if err != nil { |
||||||
|
t.Fatal(err) |
||||||
|
} |
||||||
|
|
||||||
token = resp.Header["X-Subject-Token"][0] |
token = resp.Header.Get("X-Subject-Token") |
||||||
return token |
|
||||||
|
data, err := ioutil.ReadAll(resp.Body) |
||||||
|
if err != nil { |
||||||
|
t.Fatal(err) |
||||||
|
} |
||||||
|
defer resp.Body.Close() |
||||||
|
|
||||||
|
var tokenResp = new(tokenResponse) |
||||||
|
err = json.Unmarshal(data, &tokenResp) |
||||||
|
if err != nil { |
||||||
|
t.Fatal(err) |
||||||
|
} |
||||||
|
return token, tokenResp.Token.User.ID |
||||||
} |
} |
||||||
|
|
||||||
func createUser(token, user_name, user_email, user_pass string) (string){ |
func createUser(t *testing.T, token, userName, userEmail, userPass string) string { |
||||||
|
t.Helper() |
||||||
client := &http.Client{} |
client := &http.Client{} |
||||||
|
|
||||||
createUserData := CreateUserRequest{ |
createUserData := map[string]interface{}{ |
||||||
CreateUser: CreateUserForm{ |
"user": map[string]interface{}{ |
||||||
Name: user_name, |
"name": userName, |
||||||
Email: user_email, |
"email": userEmail, |
||||||
Enabled: true, |
"enabled": true, |
||||||
Password: user_pass, |
"password": userPass, |
||||||
Roles: []string{"admin"}, |
"roles": []string{"admin"}, |
||||||
}, |
}, |
||||||
} |
} |
||||||
|
|
||||||
body, _ := json.Marshal(createUserData) |
body, err := json.Marshal(createUserData) |
||||||
|
if err != nil { |
||||||
|
t.Fatal(err) |
||||||
|
} |
||||||
|
|
||||||
req, _ := http.NewRequest("POST", userURL, bytes.NewBuffer(body)) |
req, err := http.NewRequest("POST", usersURL, bytes.NewBuffer(body)) |
||||||
|
if err != nil { |
||||||
|
t.Fatal(err) |
||||||
|
} |
||||||
req.Header.Set("X-Auth-Token", token) |
req.Header.Set("X-Auth-Token", token) |
||||||
req.Header.Add("Content-Type", "application/json") |
req.Header.Add("Content-Type", "application/json") |
||||||
resp, _ := client.Do(req) |
resp, err := client.Do(req) |
||||||
|
if err != nil { |
||||||
|
t.Fatal(err) |
||||||
|
} |
||||||
|
|
||||||
data, _ := ioutil.ReadAll(resp.Body) |
data, err := ioutil.ReadAll(resp.Body) |
||||||
var userResponse = new(UserResponse) |
|
||||||
err := json.Unmarshal(data, &userResponse) |
|
||||||
if err != nil { |
if err != nil { |
||||||
fmt.Println(err) |
t.Fatal(err) |
||||||
} |
} |
||||||
|
defer resp.Body.Close() |
||||||
|
|
||||||
fmt.Println(userResponse.User.ID) |
var userResp = new(userResponse) |
||||||
return userResponse.User.ID |
err = json.Unmarshal(data, &userResp) |
||||||
|
if err != nil { |
||||||
|
t.Fatal(err) |
||||||
|
} |
||||||
|
|
||||||
|
return userResp.User.ID |
||||||
} |
} |
||||||
|
|
||||||
func deleteUser(token, id string) { |
// delete group or user
|
||||||
|
func delete(t *testing.T, token, id, uri string) { |
||||||
|
t.Helper() |
||||||
client := &http.Client{} |
client := &http.Client{} |
||||||
|
|
||||||
deleteUserURI := userURL + id |
deleteURI := uri + id |
||||||
fmt.Println(deleteUserURI) |
req, err := http.NewRequest("DELETE", deleteURI, nil) |
||||||
req, _ := http.NewRequest("DELETE", deleteUserURI, nil) |
if err != nil { |
||||||
|
t.Fatalf("error: %v", err) |
||||||
|
} |
||||||
req.Header.Set("X-Auth-Token", token) |
req.Header.Set("X-Auth-Token", token) |
||||||
resp, _ := client.Do(req) |
client.Do(req) |
||||||
fmt.Println(resp) |
|
||||||
} |
} |
||||||
|
|
||||||
func createGroup(token, description, name string) string{ |
func createGroup(t *testing.T, token, description, name string) string { |
||||||
|
t.Helper() |
||||||
client := &http.Client{} |
client := &http.Client{} |
||||||
|
|
||||||
createGroupData := CreateGroup{ |
createGroupData := map[string]interface{}{ |
||||||
CreateGroupForm{ |
"group": map[string]interface{}{ |
||||||
Description: description, |
"name": name, |
||||||
Name: name, |
"description": description, |
||||||
}, |
}, |
||||||
} |
} |
||||||
|
|
||||||
body, _ := json.Marshal(createGroupData) |
body, err := json.Marshal(createGroupData) |
||||||
|
if err != nil { |
||||||
|
t.Fatal(err) |
||||||
|
} |
||||||
|
|
||||||
req, _ := http.NewRequest("POST", groupURL, bytes.NewBuffer(body)) |
req, err := http.NewRequest("POST", groupsURL, bytes.NewBuffer(body)) |
||||||
|
if err != nil { |
||||||
|
t.Fatal(err) |
||||||
|
} |
||||||
req.Header.Set("X-Auth-Token", token) |
req.Header.Set("X-Auth-Token", token) |
||||||
req.Header.Add("Content-Type", "application/json") |
req.Header.Add("Content-Type", "application/json") |
||||||
resp, _ := client.Do(req) |
resp, err := client.Do(req) |
||||||
data, _ := ioutil.ReadAll(resp.Body) |
if err != nil { |
||||||
|
t.Fatal(err) |
||||||
|
} |
||||||
|
|
||||||
|
data, err := ioutil.ReadAll(resp.Body) |
||||||
|
if err != nil { |
||||||
|
t.Fatal(err) |
||||||
|
} |
||||||
|
defer resp.Body.Close() |
||||||
|
|
||||||
var groupResponse = new(GroupID) |
var groupResp = new(groupResponse) |
||||||
err := json.Unmarshal(data, &groupResponse) |
err = json.Unmarshal(data, &groupResp) |
||||||
if err != nil { |
if err != nil { |
||||||
fmt.Println(err) |
t.Fatal(err) |
||||||
} |
} |
||||||
|
|
||||||
return groupResponse.Group.ID |
return groupResp.Group.ID |
||||||
} |
} |
||||||
|
|
||||||
func addUserToGroup(token, groupId, userId string) { |
func addUserToGroup(t *testing.T, token, groupID, userID string) error { |
||||||
uri := groupURL + groupId + "/users/" + userId |
t.Helper() |
||||||
|
uri := groupsURL + groupID + "/users/" + userID |
||||||
client := &http.Client{} |
client := &http.Client{} |
||||||
req, _ := http.NewRequest("PUT", uri, nil) |
req, err := http.NewRequest("PUT", uri, nil) |
||||||
|
if err != nil { |
||||||
|
return err |
||||||
|
} |
||||||
req.Header.Set("X-Auth-Token", token) |
req.Header.Set("X-Auth-Token", token) |
||||||
resp, _ := client.Do(req) |
client.Do(req) |
||||||
fmt.Println(resp) |
return nil |
||||||
} |
} |
||||||
|
|
||||||
const adminUser = "demo" |
|
||||||
const adminPass = "DEMO_PASS" |
|
||||||
const invalidPass = "WRONG_PASS" |
|
||||||
|
|
||||||
const testUser = "test_user" |
|
||||||
const testPass = "test_pass" |
|
||||||
const testEmail = "test@example.com" |
|
||||||
|
|
||||||
const domain = "default" |
|
||||||
|
|
||||||
func TestIncorrectCredentialsLogin(t *testing.T) { |
func TestIncorrectCredentialsLogin(t *testing.T) { |
||||||
c := Connector{KeystoneHost: keystoneURL, Domain: domain, |
c := keystoneConnector{KeystoneHost: keystoneURL, Domain: testDomain, |
||||||
KeystoneUsername: adminUser, KeystonePassword: adminPass} |
KeystoneUsername: adminUser, KeystonePassword: adminPass} |
||||||
s := connector.Scopes{OfflineAccess: true, Groups: true} |
s := connector.Scopes{OfflineAccess: true, Groups: true} |
||||||
_, validPW, _ := c.Login(context.Background(), s, adminUser, invalidPass) |
_, validPW, err := c.Login(context.Background(), s, adminUser, invalidPass) |
||||||
|
if err != nil { |
||||||
if validPW { |
t.Fatal(err.Error()) |
||||||
t.Fail() |
} |
||||||
} |
|
||||||
|
if validPW { |
||||||
|
t.Fail() |
||||||
|
} |
||||||
} |
} |
||||||
|
|
||||||
func TestValidUserLogin(t *testing.T) { |
func TestValidUserLogin(t *testing.T) { |
||||||
token := getAdminToken(adminUser, adminPass) |
token, _ := getAdminToken(t, adminUser, adminPass) |
||||||
userID := createUser(token, testUser, testEmail, testPass) |
userID := createUser(t, token, testUser, testEmail, testPass) |
||||||
c := Connector{KeystoneHost: keystoneURL, Domain: domain, |
c := keystoneConnector{KeystoneHost: keystoneURL, Domain: testDomain, |
||||||
KeystoneUsername: adminUser, KeystonePassword: adminPass} |
KeystoneUsername: adminUser, KeystonePassword: adminPass} |
||||||
s := connector.Scopes{OfflineAccess: true, Groups: true} |
s := connector.Scopes{OfflineAccess: true, Groups: true} |
||||||
_, validPW, _ := c.Login(context.Background(), s, testUser, testPass) |
identity, validPW, err := c.Login(context.Background(), s, testUser, testPass) |
||||||
if !validPW { |
if err != nil { |
||||||
t.Fail() |
t.Fatal(err.Error()) |
||||||
} |
} |
||||||
deleteUser(token, userID) |
t.Log(identity) |
||||||
|
|
||||||
|
if !validPW { |
||||||
|
t.Fail() |
||||||
|
} |
||||||
|
delete(t, token, userID, usersURL) |
||||||
} |
} |
||||||
|
|
||||||
func TestUseRefreshToken(t *testing.T) { |
func TestUseRefreshToken(t *testing.T) { |
||||||
t.Fatal("Not implemented") |
token, adminID := getAdminToken(t, adminUser, adminPass) |
||||||
|
groupID := createGroup(t, token, "Test group description", testGroup) |
||||||
|
addUserToGroup(t, token, groupID, adminID) |
||||||
|
|
||||||
|
c := keystoneConnector{KeystoneHost: keystoneURL, Domain: testDomain, |
||||||
|
KeystoneUsername: adminUser, KeystonePassword: adminPass} |
||||||
|
s := connector.Scopes{OfflineAccess: true, Groups: true} |
||||||
|
|
||||||
|
identityLogin, _, err := c.Login(context.Background(), s, adminUser, adminPass) |
||||||
|
if err != nil { |
||||||
|
t.Fatal(err.Error()) |
||||||
|
} |
||||||
|
|
||||||
|
identityRefresh, err := c.Refresh(context.Background(), s, identityLogin) |
||||||
|
if err != nil { |
||||||
|
t.Fatal(err.Error()) |
||||||
|
} |
||||||
|
|
||||||
|
delete(t, token, groupID, groupsURL) |
||||||
|
|
||||||
|
expectEquals(t, 1, len(identityRefresh.Groups)) |
||||||
|
expectEquals(t, testGroup, string(identityRefresh.Groups[0])) |
||||||
} |
} |
||||||
|
|
||||||
func TestUseRefreshTokenUserDeleted(t *testing.T){ |
func TestUseRefreshTokenUserDeleted(t *testing.T) { |
||||||
t.Fatal("Not implemented") |
token, _ := getAdminToken(t, adminUser, adminPass) |
||||||
|
userID := createUser(t, token, testUser, testEmail, testPass) |
||||||
|
|
||||||
|
c := keystoneConnector{KeystoneHost: keystoneURL, Domain: testDomain, |
||||||
|
KeystoneUsername: adminUser, KeystonePassword: adminPass} |
||||||
|
s := connector.Scopes{OfflineAccess: true, Groups: true} |
||||||
|
|
||||||
|
identityLogin, _, err := c.Login(context.Background(), s, testUser, testPass) |
||||||
|
if err != nil { |
||||||
|
t.Fatal(err.Error()) |
||||||
|
} |
||||||
|
|
||||||
|
_, err = c.Refresh(context.Background(), s, identityLogin) |
||||||
|
if err != nil { |
||||||
|
t.Fatal(err.Error()) |
||||||
|
} |
||||||
|
|
||||||
|
delete(t, token, userID, usersURL) |
||||||
|
_, err = c.Refresh(context.Background(), s, identityLogin) |
||||||
|
|
||||||
|
if !strings.Contains(err.Error(), "does not exist") { |
||||||
|
t.Errorf("unexpected error: %s", err.Error()) |
||||||
|
} |
||||||
} |
} |
||||||
|
|
||||||
func TestUseRefreshTokenGroupsChanged(t *testing.T){ |
func TestUseRefreshTokenGroupsChanged(t *testing.T) { |
||||||
t.Fatal("Not implemented") |
token, _ := getAdminToken(t, adminUser, adminPass) |
||||||
|
userID := createUser(t, token, testUser, testEmail, testPass) |
||||||
|
|
||||||
|
c := keystoneConnector{KeystoneHost: keystoneURL, Domain: testDomain, |
||||||
|
KeystoneUsername: adminUser, KeystonePassword: adminPass} |
||||||
|
s := connector.Scopes{OfflineAccess: true, Groups: true} |
||||||
|
|
||||||
|
identityLogin, _, err := c.Login(context.Background(), s, testUser, testPass) |
||||||
|
if err != nil { |
||||||
|
t.Fatal(err.Error()) |
||||||
|
} |
||||||
|
|
||||||
|
identityRefresh, err := c.Refresh(context.Background(), s, identityLogin) |
||||||
|
if err != nil { |
||||||
|
t.Fatal(err.Error()) |
||||||
|
} |
||||||
|
|
||||||
|
expectEquals(t, 0, len(identityRefresh.Groups)) |
||||||
|
|
||||||
|
groupID := createGroup(t, token, "Test group description", testGroup) |
||||||
|
addUserToGroup(t, token, groupID, userID) |
||||||
|
|
||||||
|
identityRefresh, err = c.Refresh(context.Background(), s, identityLogin) |
||||||
|
if err != nil { |
||||||
|
t.Fatal(err.Error()) |
||||||
|
} |
||||||
|
|
||||||
|
delete(t, token, groupID, groupsURL) |
||||||
|
delete(t, token, userID, usersURL) |
||||||
|
|
||||||
|
expectEquals(t, 1, len(identityRefresh.Groups)) |
||||||
} |
} |
||||||
|
|
||||||
func TestMain(m *testing.M) { |
func TestMain(m *testing.M) { |
||||||
dockerID := startKeystoneContainer() |
keystoneURLEnv := "DEX_KEYSTONE_URL" |
||||||
repeats := 10 |
keystoneAdminURLEnv := "DEX_KEYSTONE_ADMIN_URL" |
||||||
running := false |
keystoneURL = os.Getenv(keystoneURLEnv) |
||||||
for i := 0; i < repeats; i++ { |
if keystoneURL == "" { |
||||||
_, err := http.Get(keystoneURL) |
fmt.Printf("variable %q not set, skipping keystone connector tests\n", keystoneURLEnv) |
||||||
if err == nil { |
return |
||||||
running = true |
} |
||||||
break |
keystoneAdminURL := os.Getenv(keystoneAdminURLEnv) |
||||||
} |
if keystoneAdminURL == "" { |
||||||
time.Sleep(10 * time.Second) |
fmt.Printf("variable %q not set, skipping keystone connector tests\n", keystoneAdminURLEnv) |
||||||
} |
return |
||||||
if !running { |
} |
||||||
fmt.Printf("Failed to start keystone container") |
authTokenURL = keystoneURL + "/v3/auth/tokens/" |
||||||
os.Exit(1) |
fmt.Printf("Auth token url %q\n", authTokenURL) |
||||||
} |
fmt.Printf("Keystone URL %q\n", keystoneURL) |
||||||
defer cleanKeystoneContainer(dockerID) |
usersURL = keystoneAdminURL + "/v3/users/" |
||||||
// run all tests
|
groupsURL = keystoneAdminURL + "/v3/groups/" |
||||||
|
// run all tests
|
||||||
m.Run() |
m.Run() |
||||||
} |
} |
||||||
|
|
||||||
|
func expectEquals(t *testing.T, a interface{}, b interface{}) { |
||||||
|
if !reflect.DeepEqual(a, b) { |
||||||
|
t.Errorf("Expected %v to be equal %v", a, b) |
||||||
|
} |
||||||
|
} |
||||||
|
|||||||
@ -1,55 +0,0 @@ |
|||||||
# The base path of dex and the external name of the OpenID Connect service. |
|
||||||
# This is the canonical URL that all clients MUST use to refer to dex. If a |
|
||||||
# path is provided, dex's HTTP service will listen at a non-root URL. |
|
||||||
issuer: http://0.0.0.0:5556/dex |
|
||||||
|
|
||||||
# The storage configuration determines where dex stores its state. Supported |
|
||||||
# options include SQL flavors and Kubernetes third party resources. |
|
||||||
# |
|
||||||
# See the storage document at Documentation/storage.md for further information. |
|
||||||
storage: |
|
||||||
type: sqlite3 |
|
||||||
config: |
|
||||||
file: examples/dex.db #be in the dex directory, else change path here |
|
||||||
|
|
||||||
# Configuration for the HTTP endpoints. |
|
||||||
web: |
|
||||||
https: 0.0.0.0:5556 |
|
||||||
# Uncomment for HTTPS options. |
|
||||||
# https: 127.0.0.1:5554 |
|
||||||
tlsCert: ./ssl/dex.crt |
|
||||||
tlsKey: ./ssl/dex.key |
|
||||||
|
|
||||||
# Configuration for telemetry |
|
||||||
telemetry: |
|
||||||
http: 0.0.0.0:5558 |
|
||||||
|
|
||||||
oauth2: |
|
||||||
responseTypes: ["id_token"] |
|
||||||
|
|
||||||
# Instead of reading from an external storage, use this list of clients. |
|
||||||
staticClients: |
|
||||||
- id: example-app |
|
||||||
redirectURIs: |
|
||||||
- 'http://127.0.0.1:5555/callback' |
|
||||||
name: 'Example App' |
|
||||||
secret: ZXhhbXBsZS1hcHAtc2VjcmV0 |
|
||||||
|
|
||||||
#Provide Keystone connector and its config here |
|
||||||
# /v3/auth/tokens |
|
||||||
connectors: |
|
||||||
- type: keystone |
|
||||||
id: keystone |
|
||||||
name: Keystone |
|
||||||
config: |
|
||||||
keystoneHost: http://localhost:5000 |
|
||||||
domain: default |
|
||||||
keystoneUsername: demo |
|
||||||
keystonePassword: DEMO_PASS |
|
||||||
|
|
||||||
# Let dex keep a list of passwords which can be used to login to dex. |
|
||||||
enablePasswordDB: true |
|
||||||
|
|
||||||
oauth2: |
|
||||||
skipApprovalScreen: true |
|
||||||
|
|
||||||
Loading…
Reference in new issue