Skip to content

Commit 469d662

Browse files
WIP browsertest2
1 parent b59b741 commit 469d662

File tree

8 files changed

+165
-24
lines changed

8 files changed

+165
-24
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"clientId": "browsertest",
3+
"name": "browsertest",
4+
"description": "",
5+
"rootUrl": "http://localhost:65432/",
6+
"adminUrl": "http://localhost:65432/",
7+
"baseUrl": "http://localhost:65432/",
8+
"surrogateAuthRequired": false,
9+
"enabled": true,
10+
"alwaysDisplayInConsole": false,
11+
"clientAuthenticatorType": "client-secret",
12+
"redirectUris": [
13+
"http://localhost:65432/"
14+
],
15+
"webOrigins": [
16+
"http://localhost:65432/"
17+
],
18+
"notBefore": 0,
19+
"bearerOnly": false,
20+
"consentRequired": false,
21+
"standardFlowEnabled": true,
22+
"implicitFlowEnabled": false,
23+
"directAccessGrantsEnabled": true,
24+
"serviceAccountsEnabled": false,
25+
"publicClient": true,
26+
"frontchannelLogout": true,
27+
"protocol": "openid-connect",
28+
"attributes": {
29+
"oidc.ciba.grant.enabled": "false",
30+
"post.logout.redirect.uris": "http://localhost:65432/",
31+
"oauth2.device.authorization.grant.enabled": "false",
32+
"backchannel.logout.session.required": "true",
33+
"backchannel.logout.revoke.offline.tokens": "false"
34+
},
35+
"authenticationFlowBindingOverrides": {},
36+
"fullScopeAllowed": true,
37+
"nodeReRegistrationTimeout": -1,
38+
"defaultClientScopes": [
39+
"web-origins",
40+
"acr",
41+
"profile",
42+
"roles",
43+
"email"
44+
],
45+
"optionalClientScopes": [
46+
"address",
47+
"phone",
48+
"offline_access",
49+
"microprofile-jwt"
50+
],
51+
"access": {
52+
"view": true,
53+
"configure": true,
54+
"manage": true
55+
}
56+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
: "${KC_VERSION:=24.0.3}"
3+
: "${KC_BROWSERTEST_CLIENT_SECRET:=$(uuidgen)}"
4+
5+
curl -o kc.zip "https://github.com/keycloak/keycloak/releases/download/${KC_VERSION}/keycloak-${KC_VERSION}.zip"
6+
7+
unzip kc.zip -d keycloak-${KC_VERSION}
8+
9+
export PATH=$PATH:$(pwd)/keycloak-${KC_VERSION}/bin
10+
11+
kcadm.sh config credentials --server http://localhost:65432/auth --realm master --user admin << EOF
12+
changeme
13+
EOF
14+
15+
# &response_type=code&scope=openid+profile+email+offline_access&state=XTM-A9nrcpX1p6rT88jsqg4iw30EmYdUq4Cqd1qEYOA
16+
17+
kcadm.sh create clients -r opentdf -s clientId=browsertest -s enabled=true -s 'redirectUris=["http://localhost:65432/"]' -s consentRequired=false -s standardFlowEnabled=true -s directAccessGrantsEnabled=true -s serviceAccountsEnabled=false -s publicClient=true -s protocol=openid-connect
18+
kcadm.sh create users -r opentdf -s username=user1 -s enabled=true
19+
kcadm.sh set-password -r opentdf --username user1 --new-password testuser123
20+
21+
go run ./platform/service start
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
services:
2+
keycloak:
3+
# This is kc 24.0.1 with opentdf protocol mapper on board
4+
image: ghcr.io/opentdf/keycloak:sha-8a6d35a
5+
restart: always
6+
command: ["start-dev", "--log-level=DEBUG"]
7+
environment:
8+
KC_DB_VENDOR: postgres
9+
KC_DB_URL_HOST: keycloakdb
10+
KC_DB_URL_PORT: 5432
11+
KC_DB_URL_DATABASE: keycloak
12+
KC_DB_USERNAME: keycloak
13+
KC_DB_PASSWORD: changeme
14+
KC_FEATURES: "preview,token-exchange"
15+
KC_HEALTH_ENABLED: "true"
16+
KC_HOSTNAME_ADMIN_URL: "http://localhost:65432/auth"
17+
KC_HOSTNAME_PORT: "65432"
18+
KC_HOSTNAME_STRICT: "false"
19+
KC_HOSTNAME_STRICT_BACKCHANNEL: "false"
20+
KC_HOSTNAME_STRICT_HTTPS: "false"
21+
KC_HOSTNAME_URL: "http://localhost:65432/auth"
22+
KC_HTTP_ENABLED: "true"
23+
KC_HTTP_PORT: "8888"
24+
KC_HTTP_RELATIVE_PATH: "/auth"
25+
KC_PROXY: "edge"
26+
KEYCLOAK_ADMIN: admin
27+
KEYCLOAK_ADMIN_PASSWORD: changeme
28+
ports:
29+
- "8888:8888"
30+
healthcheck:
31+
test: ['CMD-SHELL', '[ -f /tmp/HealthCheck.java ] || echo "public class HealthCheck { public static void main(String[] args) throws java.lang.Throwable { System.exit(java.net.HttpURLConnection.HTTP_OK == ((java.net.HttpURLConnection)new java.net.URL(args[0]).openConnection()).getResponseCode() ? 0 : 1); } }" > /tmp/HealthCheck.java && java /tmp/HealthCheck.java http://localhost:8888/auth/health/live']
32+
interval: 5s
33+
timeout: 10s
34+
retries: 3
35+
start_period: 2m
36+
keycloakdb:
37+
image: postgres
38+
restart: always
39+
user: postgres
40+
environment:
41+
POSTGRES_PASSWORD: changeme
42+
POSTGRES_USER: postgres
43+
POSTGRES_DB: keycloak
44+
healthcheck:
45+
test: ["CMD-SHELL", "pg_isready"]
46+
interval: 5s
47+
timeout: 5s
48+
retries: 10
49+
opentdfdb:
50+
image: public.ecr.aws/docker/library/postgres:15-alpine
51+
restart: always
52+
user: postgres
53+
environment:
54+
POSTGRES_USER: postgres
55+
POSTGRES_PASSWORD: changeme
56+
POSTGRES_DB: opentdf
57+
healthcheck:
58+
test: ["CMD-SHELL", "pg_isready"]
59+
interval: 5s
60+
timeout: 5s
61+
retries: 10
62+
ports:
63+
- "5432:5432"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,6 @@ dist
109109

110110
# temporary folders
111111
**/temp/
112+
113+
# For integration testing
114+
/platform

remote-store/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/demo-evironment.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,14 @@ ROOT_DIR="$(cd "${APP_DIR}/.." >/dev/null && pwd)"
77

88
_run_platform() {
99
git clone https://github.com/opentdf/platform.git
10+
docker compose -f .github/workflows/roundtrip/docker-compose.yaml up -d --wait --wait-timeout 240
11+
1012
cd platform
11-
# TODO Modify docker-compose.yaml as follows:
12-
# KC_HOSTNAME_PORT: "65432"
13-
docker compose up -d --wait --wait-timeout 240
1413
.github/scripts/init-temp-keys.sh
15-
16-
# TODO Modify opentdf-example.yaml as follows:
17-
# KC_HOSTNAME_PORT: "65432"
1814
cp opentdf-example.yaml opentdf.yaml
1915
go run ./service provision keycloak
16+
cd ..
17+
2018
}
2119

2220
_wait-for() {

web-app/package-lock.json

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web-app/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function decryptedFileExtension(encryptedFileName: string): string {
3131

3232
const oidcClient = new OidcClient(
3333
'http://localhost:65432/auth/realms/opentdf',
34-
'opentdf',
34+
'browsertest',
3535
'otdf-sample-web-app'
3636
);
3737

0 commit comments

Comments
 (0)