-
Notifications
You must be signed in to change notification settings - Fork 9
feat: re-generate SDK documentation #212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+1,896
−285
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9753a69
feat: re-generate SDK documentation
mrudatsprint 97b137f
feat: generate the correct README.md
mrudatsprint d22961c
feat: run prettier on the docs
mrudatsprint 1067f9c
feat: A DPoP example where the SDK calls an API in a resource server.
mrudatsprint 988a12e
chore: force workflow execution
mrudatsprint 5c74067
chore: force workflow execution
mrudatsprint File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,11 @@ | ||
| # Public OAuth client identifiers; these are not secrets. | ||
| REACT_CLIENT_ID=replace-with-react-client-id | ||
| VUE_CLIENT_ID=replace-with-vue-client-id | ||
| ANGULAR_CLIENT_ID=replace-with-angular-client-id | ||
|
|
||
| # The current FusionAuth tenant issuer. | ||
| EXPECTED_ISSUER=https://example.com | ||
| FUSIONAUTH_JWKS_URL=http://host.orb.internal:9011/.well-known/jwks.json | ||
|
|
||
| # Canonical public origin used for DPoP htu validation. | ||
| API_EXTERNAL_ORIGIN=https://api.fusionauth-dpop.orb.local |
This file contains hidden or 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,2 @@ | ||
| .env | ||
|
|
This file contains hidden or 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,46 @@ | ||
| # Manual DPoP browser demo | ||
|
|
||
| This fixture builds the React, Vue, and Angular SDKs from this checkout, then | ||
| serves three minimal browser apps and one DPoP-protected Express API through | ||
| OrbStack. OrbStack terminates TLS. | ||
|
|
||
| ## Configure and start | ||
|
|
||
| Prerequisites: OrbStack with Docker Compose, and FusionAuth available at | ||
| `https://local.fusionauth.io`. | ||
|
|
||
| Create three public FusionAuth applications with Authorization Code and Refresh | ||
| Token grants, client authentication disabled, PKCE required with S256, and | ||
| asymmetric access-token signing. Use each app URL below as its exact authorized | ||
| redirect and logout URL. Add all three origins to FusionAuth CORS and allow the | ||
| `Authorization`, `Content-Type`, and `DPoP` headers with `GET`, `POST`, and | ||
| `OPTIONS` methods. | ||
|
|
||
| ```bash | ||
| cd e2e/dpop | ||
| cp .env.example .env | ||
| # Edit .env with the three public client IDs. | ||
| docker compose build | ||
| docker compose up -d | ||
| docker compose ps | ||
| ``` | ||
|
|
||
| Open: | ||
|
|
||
| - https://react.fusionauth-dpop.orb.local | ||
| - https://vue.fusionauth-dpop.orb.local | ||
| - https://angular.fusionauth-dpop.orb.local | ||
| - https://api.fusionauth-dpop.orb.local/health | ||
|
|
||
| In each app, click **Login**, authenticate, click **Call resource server**, and | ||
| confirm the protected response. Click **Logout** to finish. | ||
|
|
||
| Stop the fixture with: | ||
|
|
||
| ```bash | ||
| docker compose down | ||
| ``` | ||
|
|
||
| The `.env` values are public identifiers, but `.env` is local configuration and | ||
| must not contain secrets. | ||
|
|
||
This file contains hidden or 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,24 @@ | ||
| FROM node:24.15.0-alpine AS sdk-build | ||
| WORKDIR /repo | ||
| ENV HUSKY=0 | ||
| COPY package.json yarn.lock tsconfig.json ./ | ||
| COPY packages ./packages | ||
| RUN corepack enable && corepack prepare yarn@1.22.22 --activate | ||
| RUN yarn install --frozen-lockfile --ignore-engines --non-interactive | ||
| RUN yarn build:sdk-angular | ||
|
|
||
| FROM node:24.15.0-alpine AS app-build | ||
| WORKDIR /app | ||
| ARG CLIENT_ID | ||
| RUN corepack enable && corepack prepare yarn@1.22.22 --activate | ||
| COPY e2e/dpop/angular/package.json ./ | ||
| COPY --from=sdk-build /repo/packages/sdk-angular/dist/fusionauth-angular-sdk ./vendor/angular-sdk | ||
| RUN yarn install --non-interactive | ||
| COPY e2e/dpop/angular/angular.json e2e/dpop/angular/tsconfig.json ./ | ||
| COPY e2e/dpop/angular/src ./src | ||
| RUN test -n "$CLIENT_ID" && sed -i "s|__CLIENT_ID__|$CLIENT_ID|" src/main.ts | ||
| RUN yarn build | ||
|
|
||
| FROM nginx:1.29-alpine | ||
| COPY e2e/dpop/nginx.conf /etc/nginx/conf.d/default.conf | ||
| COPY --from=app-build /app/dist/angular/browser /usr/share/nginx/html |
This file contains hidden or 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,28 @@ | ||
| { | ||
| "$schema": "./node_modules/@angular/cli/lib/config/schema.json", | ||
| "version": 1, | ||
| "newProjectRoot": "projects", | ||
| "projects": { | ||
| "angular": { | ||
| "projectType": "application", | ||
| "root": "", | ||
| "sourceRoot": "src", | ||
| "prefix": "app", | ||
| "architect": { | ||
| "build": { | ||
| "builder": "@angular/build:application", | ||
| "options": { | ||
| "browser": "src/main.ts", | ||
| "index": "src/index.html", | ||
| "outputPath": "dist/angular", | ||
| "polyfills": ["zone.js"], | ||
| "tsConfig": "tsconfig.json" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "cli": { | ||
| "analytics": false | ||
| } | ||
| } |
This file contains hidden or 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,24 @@ | ||
| { | ||
| "name": "dpop-angular-demo", | ||
| "private": true, | ||
| "version": "0.0.0", | ||
| "scripts": { | ||
| "build": "ng build" | ||
| }, | ||
| "dependencies": { | ||
| "@angular/common": "22.0.0", | ||
| "@angular/compiler": "22.0.0", | ||
| "@angular/core": "22.0.0", | ||
| "@angular/platform-browser": "22.0.0", | ||
| "@fusionauth/angular-sdk": "file:vendor/angular-sdk", | ||
| "rxjs": "7.8.2", | ||
| "tslib": "2.8.1", | ||
| "zone.js": "0.15.1" | ||
| }, | ||
| "devDependencies": { | ||
| "@angular/build": "22.0.0", | ||
| "@angular/cli": "22.0.0", | ||
| "@angular/compiler-cli": "22.0.0", | ||
| "typescript": "6.0.2" | ||
| } | ||
| } |
This file contains hidden or 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,12 @@ | ||
| <!doctype html> | ||
|
mrudatsprint marked this conversation as resolved.
|
||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>Angular DPoP demo</title> | ||
| <base href="/" /> | ||
| </head> | ||
| <body> | ||
| <app-root></app-root> | ||
| </body> | ||
| </html> | ||
This file contains hidden or 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 @@ | ||
| import { Component, inject } from '@angular/core'; | ||
| import { bootstrapApplication } from '@angular/platform-browser'; | ||
| import { FusionAuthModule, FusionAuthService } from '@fusionauth/angular-sdk'; | ||
|
|
||
| const apiUrl = 'https://api.fusionauth-dpop.orb.local/resource'; | ||
| const appUrl = 'https://angular.fusionauth-dpop.orb.local'; | ||
|
|
||
| @Component({ | ||
| imports: [FusionAuthModule], | ||
| selector: 'app-root', | ||
| standalone: true, | ||
| template: ` | ||
| <main> | ||
| <h1>Angular DPoP demo</h1> | ||
| @if (fusionAuth.isLoggedInSignal()) { | ||
| <button (click)="fusionAuth.logout()">Logout</button> | ||
| <button (click)="callResource()">Call resource server</button> | ||
| } @else { | ||
| <button (click)="fusionAuth.startLogin()">Login</button> | ||
| } | ||
| <pre>{{ result }}</pre> | ||
| </main> | ||
| `, | ||
| }) | ||
| class AppComponent { | ||
| readonly fusionAuth = inject(FusionAuthService); | ||
| result = ''; | ||
|
|
||
| async callResource() { | ||
| try { | ||
| const response = await this.fusionAuth.dpopFetch(apiUrl); | ||
| const body = await response.text(); | ||
| this.result = response.ok ? body : `HTTP ${response.status}: ${body}`; | ||
| } catch (error) { | ||
| this.result = error instanceof Error ? error.message : 'Request failed'; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| bootstrapApplication(AppComponent, { | ||
| providers: [ | ||
| ...FusionAuthModule.forRoot({ | ||
| clientId: '__CLIENT_ID__', | ||
| dpopTokenStorage: 'localStorage', | ||
| postLogoutRedirectUri: appUrl, | ||
| redirectUri: appUrl, | ||
| serverUrl: 'https://local.fusionauth.io', | ||
| useDpop: true, | ||
| }).providers!, | ||
| ], | ||
| }).catch(() => { | ||
| document.body.textContent = 'Application failed to start'; | ||
| }); |
This file contains hidden or 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,14 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "experimentalDecorators": true, | ||
| "lib": ["ES2022", "DOM"], | ||
| "module": "preserve", | ||
| "moduleResolution": "bundler", | ||
| "strict": true, | ||
| "target": "ES2022" | ||
| }, | ||
| "angularCompilerOptions": { | ||
| "strictTemplates": true | ||
| }, | ||
| "files": ["src/main.ts"] | ||
| } |
This file contains hidden or 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,11 @@ | ||
| FROM node:24.15.0-alpine | ||
| WORKDIR /app | ||
| ENV NODE_ENV=production | ||
| RUN corepack enable && corepack prepare yarn@1.22.22 --activate | ||
| COPY e2e/dpop/api/package.json ./ | ||
| RUN yarn install --production --non-interactive | ||
| COPY e2e/dpop/api/server.mjs ./ | ||
| USER node | ||
| EXPOSE 3000 | ||
| CMD ["node", "server.mjs"] | ||
|
|
This file contains hidden or 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,11 @@ | ||
| { | ||
| "name": "dpop-resource-server", | ||
| "private": true, | ||
| "version": "0.0.0", | ||
| "type": "module", | ||
| "dependencies": { | ||
| "cors": "2.8.5", | ||
| "express": "5.1.0", | ||
| "jose": "6.1.0" | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.