Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ An example SPA demonstrating the code and deployment to integrate with token han

The example deployment requires the following components:

- Node.js 20+
- Node.js 22+
- Docker
- jq
- OpenSSL 3
Expand All @@ -24,12 +24,6 @@ Use the [Curity developer portal](https://developer.curity.io/releases/token-han
- [OpenResty OAuth Proxy 2.0.1+](https://developer.curity.io/releases/token-handler?proxy=openresty)
- [NGINX OAuth Proxy 2.0.0+](https://developer.curity.io/releases/token-handler?proxy=nginx)

Also, ensure that your computer's Curity Docker image is up to date (9.5.0 or later):

```bash
docker pull curity.azurecr.io/curity/idsvr
```

## Deploy the System

Two example deployments are provided, to explain the moving parts of the end-to-end solution.
Expand Down Expand Up @@ -91,6 +85,13 @@ Browse to the SPA at `http://www.product.example`.\
Log in as the pre-shipped account `demouser` / `Password1`.\
Test all OAuth lifecycle operations against token handler components running at `http://bff.product.example`.

## Adapt the Deployment

Once you understand the deployment you can adapt and redeploy in various ways:

- [Run in Development Mode](https://curity.io/resources/learn/token-handler-deployment-example/#spa-developer-setup) to understand the pure SPA developer experience.
- [Change Domain Names](https://curity.io/resources/learn/token-handler-deployment-example/#change-external-urls) and [Upgrade to HTTPS URLs](https://curity.io/resources/learn/token-handler-deployment-example/#https-setup) to rehearse real deployments.

## Clean Up

When finished testing, teardown any local Docker-deployed components like this:
Expand Down
2 changes: 1 addition & 1 deletion api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20-bookworm-slim
FROM node:22-bookworm-slim

RUN groupadd --gid 10000 apiuser \
&& useradd --uid 10001 --gid apiuser --shell /bin/bash --create-home apiuser
Expand Down
282 changes: 142 additions & 140 deletions api/package-lock.json

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,21 @@
"description": "An example API to validate JWTs and return data to the SPA",
"author": "Curity AB",
"license": "Apache-2.0",
"main": "server.ts",
"type": "module",
"engines": {
"node": ">=20"
"node": ">=22"
},
"scripts": {
"build": "rm -rf dist && tsc",
"start": "npm run build && node dist/server.js"
},
"dependencies": {
"express": "^5.1.0",
"jose": "^6.0.10"
"express": "^5.2.1",
"jose": "^6.1.3"
},
"devDependencies": {
"@types/express": "^5.0.1",
"@types/node": "^20.11.30",
"typescript": "^5.8.3"
"@types/express": "^5.0.6",
"@types/node": "^22.13.14",
"typescript": "^5.9.3"
}
}
4 changes: 2 additions & 2 deletions api/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"target": "ES2022",
"strict": true,
"lib": ["ES2022"],
"module": "ES2022",
"moduleResolution": "Node",
"module": "Node18",
"moduleResolution": "Node16",
"allowSyntheticDefaultImports": true,
"outDir": "dist"
},
Expand Down
5 changes: 5 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ if [ $? -ne 0 ]; then
exit 1
fi

#
# Pull the latest image for the Curity Token Handler
#
docker pull curity.azurecr.io/curity/idsvr

#
# Run the deployment for this scenario
#
Expand Down
2 changes: 1 addition & 1 deletion deployments/curity/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ services:
# The SQL database used by the Curity Identity Server
#
curity-data:
image: postgres:17.4
image: postgres:18.1
hostname: dbserver
volumes:
- ./idsvr/data-backup.sql:/docker-entrypoint-initdb.d/data-backup.sql
Expand Down
6 changes: 2 additions & 4 deletions deployments/external/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ services:
# Keycloak is used as the external authorization server
#
keycloak:
image: quay.io/keycloak/keycloak:25.0.1
image: quay.io/keycloak/keycloak:26.4.7
hostname: login-internal
ports:
- 8080:8080
Expand All @@ -108,8 +108,6 @@ services:
KC_HTTP_ENABLED: 'true'
KC_HTTPS_ENABLED: 'false'
KC_HEALTH_ENABLED: 'true'
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: Password1
KC_LOG_LEVEL: INFO
KC_DB: postgres
KC_DB_URL_HOST: keycloak-dbserver
Expand All @@ -129,7 +127,7 @@ services:
# Keycloak's data includes preshipped user accounts
#
keycloakdata:
image: postgres:17.4
image: postgres:18.1
hostname: keycloak-dbserver
environment:
POSTGRES_USER: postgres
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions spa/css/bootstrap.min.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions spa/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<meta name='viewport' content='width=device-width, initial-scale=1, shrink-to-fit=no'>
<title>Demo Web Client</title>

<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css' rel='stylesheet' integrity='sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC' crossorigin='anonymous' />
<link href='bootstrap.min.css' rel='stylesheet' />
<link href='app.css' rel='stylesheet' />
</head>
<body>
<div id='root'></div>
<script type='module' async src='vendor.bundle.js'></script>
<script type='module' async src='app.bundle.js'></script>
</body>
</html>
</html>
Loading