Skip to content

Commit fe112c1

Browse files
AlexZeitlerbrockallen
authored andcommitted
Nodejs api e2e sample (#138)
* implement Node.js API access sample * remove dead code * update to idrsrv 1.3.1 * throw if signing cert is missing * using HOST_IP instead of localhost * remove unused dependencies * fix docker build for client * enable cors / update dependencies * avoid crash on empty host node_modules folder * add hint about empty cert export password * migrate to csproj / VS 2017 * update tooling for Docker image * remove dead file * add sln file
1 parent b81e0ff commit fe112c1

88 files changed

Lines changed: 36507 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Api/node_modules
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
*.pem
3+
*.pfx
4+
.vscode
5+
.idea
224 KB
Loading
225 KB
Loading
346 KB
Loading
402 KB
Loading
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
openssl req -x509 -days 365 -newkey rsa:4096 -keyout key.pem -out cert.pem
2+
openssl pkcs12 -export -in cert.pem -inkey key.pem -out cert.pfx
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
version: "2"
2+
3+
services:
4+
5+
identityserver:
6+
build: ./src/QuickStartIdentityServer
7+
container_name: identityserver
8+
environment:
9+
- ASPNETCORE_ENVIRONMENT=Development
10+
- HOST_IP
11+
ports:
12+
- "5000:5000"
13+
volumes:
14+
- ./cert.pfx:/app/cert.pfx
15+
16+
api:
17+
build: ./src/Api
18+
container_name: api
19+
ports:
20+
- "5004:5004"
21+
volumes:
22+
- /app/node_modules/
23+
environment:
24+
- HOST_IP
25+
26+
client:
27+
build: ./src/Client
28+
container_name: client
29+
ports:
30+
- "5005:5005"
31+
volumes:
32+
- ./src/Client:/app
33+
- /app/node_modules/
34+
environment:
35+
- HOST_IP
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# IdentityServer4, OIDC JavaScript Client and Node.js API
2+
3+
## Usage
4+
5+
1. Create a signing certificate by running `create_signing_cert.sh`. Make sure leave the "Export Password" empty.
6+
2. Make sure `node src/tools/ip.js` only returns a single IP address.
7+
3. Run `start.sh`
8+
4. Open `http://<ipaddress>:5005` in your browser and click the "Profile and Access Token" Button:
9+
10+
![](assets/1.png)
11+
12+
![](assets/2.png)
13+
14+
![](assets/3.png)
15+
16+
5. Click the "Call Service" button
17+
18+
![](assets/4.png)
19+
20+
21+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

0 commit comments

Comments
 (0)