-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mason Hu <[email protected]>
- Loading branch information
Showing
16 changed files
with
192 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,3 +83,4 @@ dist/ | |
tests/screenshots | ||
|
||
haproxy-local.cfg | ||
tests/.auth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
moved to [contribution guidelines](CONTRIBUTING.md) | ||
moved to [contribution guidelines](CONTRIBUTING.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { Page } from "@playwright/test"; | ||
import { expect } from "../fixtures/lxd-test"; | ||
|
||
// These identities are created by the create_oidc_identities script in tests/scripts | ||
// These identities are created by the setup_test script in tests/scripts | ||
export const identityBar = "[email protected]"; | ||
export const identityFoo = "[email protected]"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#! /usr/bin/env bash | ||
set -e | ||
|
||
# remove tls cert for oidc login | ||
FINGERPRINT=$(lxc config trust list | grep lxd-ui.crt | awk '{print $8}') | ||
lxc config trust remove ${FINGERPRINT} | ||
|
||
# setup oidc configs | ||
if [ -f .env.local ] | ||
then | ||
set -o allexport; source .env.local; set +o allexport | ||
fi | ||
lxc config set oidc.issuer=${LXD_OIDC_ISSUER} | ||
lxc config set oidc.client.id=${LXD_OIDC_CLIENT_ID} | ||
lxc config set oidc.audience=${LXD_OIDC_AUDIENCE} | ||
lxc config set oidc.groups.claim=${LXD_OIDC_GROUPS_CLAIM} | ||
|
||
# create identity provider group mapping | ||
lxc auth group create login-admin | ||
lxc auth group permission add login-admin server admin | ||
# The name of the identity provider group should be the same as the role name assigned to the user | ||
lxc auth identity-provider-group create admin | ||
lxc auth identity-provider-group group add admin login-admin | ||
|
||
# create oidc user foo | ||
lxd sql global " | ||
INSERT OR REPLACE INTO identities | ||
(id, auth_method, type, identifier, name, metadata) | ||
VALUES | ||
( | ||
(SELECT id from identities WHERE name='foo'), | ||
2, | ||
5, | ||
'[email protected]', | ||
'foo', | ||
'{}' | ||
); | ||
" | ||
|
||
# create oidc user bar | ||
lxd sql global " | ||
INSERT OR REPLACE INTO identities | ||
(id, auth_method, type, identifier, name, metadata) | ||
VALUES | ||
( | ||
(SELECT id from identities WHERE name='bar'), | ||
2, | ||
5, | ||
'[email protected]', | ||
'bar', | ||
'{}' | ||
); | ||
" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#! /usr/bin/env bash | ||
set -e | ||
|
||
lxd sql global " | ||
DELETE | ||
FROM identities | ||
WHERE name IN ('foo', 'bar', 'admin'); | ||
" | ||
lxc auth identity-provider-group delete admin | ||
lxc auth group delete login-admin | ||
|
||
# add tls cert back | ||
lxc config trust add keys/lxd-ui.crt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Page } from "@playwright/test"; | ||
import { test as setup, expect, authFile } from "../fixtures/lxd-test"; | ||
|
||
const loginUser = async (page: Page) => { | ||
await page.getByRole("link", { name: "Login with SSO" }).click(); | ||
await page.getByLabel("Email address*").click(); | ||
await page.getByLabel("Email address*").fill(process.env.LXD_OIDC_USER || ""); | ||
await page.getByLabel("Password*").click(); | ||
await page.getByLabel("Password*").fill(process.env.LXD_OIDC_PASSWORD || ""); | ||
await page.getByRole("button", { name: "Continue", exact: true }).click(); | ||
await expect(page.getByText("Log out")).toBeVisible(); | ||
}; | ||
|
||
setup("authenticate", async ({ page }) => { | ||
await page.goto("/ui/"); | ||
await loginUser(page); | ||
// Check logout functionality | ||
await page.getByText("Log out").click(); | ||
await expect( | ||
page.getByRole("link", { name: "Login with SSO" }), | ||
).toBeVisible(); | ||
await loginUser(page); | ||
|
||
await page.context().storageState({ path: authFile }); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1623,6 +1623,13 @@ | |
resolved "https://registry.yarnpkg.com/@types/cytoscape/-/cytoscape-3.21.0.tgz#30f5634774862b9a507b89a1b10616efabf1bf88" | ||
integrity sha512-RN5SPiyVDpUP+LoOlxxlOYAMzkE7iuv3gA1jt3Hx2qTwArpZVPPdO+SI0hUj49OAn4QABR7JK9Gi0hibzGE0Aw== | ||
|
||
"@types/[email protected]": | ||
version "8.2.0" | ||
resolved "https://registry.yarnpkg.com/@types/dotenv/-/dotenv-8.2.0.tgz#5cd64710c3c98e82d9d15844375a33bf1b45d053" | ||
integrity sha512-ylSC9GhfRH7m1EUXBXofhgx4lUWmFeQDINW5oLuS+gxWdfUeW4zJdeVTYVkexEW+e2VUvlZR2kGnGGipAWR7kw== | ||
dependencies: | ||
dotenv "*" | ||
|
||
"@types/[email protected]", "@types/estree@^1.0.0": | ||
version "1.0.5" | ||
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4" | ||
|
@@ -2905,6 +2912,11 @@ domexception@^4.0.0: | |
dependencies: | ||
webidl-conversions "^7.0.0" | ||
|
||
dotenv@*, [email protected]: | ||
version "16.4.5" | ||
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.5.tgz#cdd3b3b604cb327e286b4762e13502f717cb099f" | ||
integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg== | ||
|
||
eastasianwidth@^0.2.0: | ||
version "0.2.0" | ||
resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" | ||
|