-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f11fcab
commit 94e2b9e
Showing
14 changed files
with
528 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"rest-client.environmentVariables": { | ||
"$shared": { | ||
"api": "https://localhost:6001", | ||
"tenant": "https://localhost:5001", | ||
"audience": "urn:calcapi" | ||
} | ||
} | ||
} |
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,23 @@ | ||
########## | ||
# | ||
# Basics (Metadata) | ||
# | ||
########## | ||
|
||
|
||
# OpenID Provider Configuration Request | ||
# https://openid.net/specs/openid-connect-discovery-1_0.html | ||
# | ||
# @name configuration | ||
GET {{tenant}}/.well-known/openid-configuration | ||
|
||
### | ||
|
||
@jwks_uri = {{configuration.response.body.$.jwks_uri}} | ||
|
||
# JSON Web Key Set document | ||
# https://tools.ietf.org/html/draft-ietf-jose-json-web-key-31 | ||
# | ||
# @name jwks | ||
|
||
GET {{jwks_uri}} |
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,49 @@ | ||
########## | ||
# | ||
# Client Credentials Grant | ||
# | ||
# https://datatracker.ietf.org/doc/html/rfc6749#section-4.4 | ||
# | ||
########## | ||
|
||
|
||
##### | ||
# Configuration --> use Client Credentials Grant | ||
|
||
@client_id= worker | ||
@client_secret = secret | ||
@scope = calc:double | ||
|
||
# | ||
##### | ||
|
||
|
||
# Get Access Token for Client (double-only) | ||
# @name token | ||
POST {{tenant}}/connect/token | ||
Content-Type: application/x-www-form-urlencoded | ||
|
||
grant_type=client_credentials | ||
&client_id={{client_id}} | ||
&client_secret={{client_secret}} | ||
&scope={{scope}} | ||
|
||
### | ||
# @name double | ||
|
||
@access_token = {{token.response.body.$.access_token}} | ||
|
||
# Call API | ||
GET {{api}}/Double/2 | ||
Authorization: Bearer {{access_token}} | ||
|
||
|
||
### | ||
# @name square | ||
|
||
@access_token = {{token.response.body.$.access_token}} | ||
|
||
# Call API | ||
GET {{api}}/Square/2 | ||
Authorization: Bearer {{access_token}} | ||
|
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,44 @@ | ||
########## | ||
# | ||
# Authorization Code Grant with PKCE | ||
# | ||
# https://datatracker.ietf.org/doc/html/rfc6749#section-1.3.1 | ||
# https://www.rfc-editor.org/rfc/rfc7636.html | ||
# | ||
########## | ||
|
||
|
||
##### | ||
# Configuration --> use Authorization Code Grant with PKCE | ||
# generate custom code_challenge and code_verifier with auth-code-pkce.js | ||
|
||
@client_id= web | ||
@client_secret = secret | ||
@redirect_uri = https://localhost:5002/signin-oidc | ||
@code_challenge = JiCfjR0ceTNiBRcxghqjnWxBwRl9o2B7ogdxpGl2tDw | ||
@code_verifier = aj1cBUxqDQvrueJKvr-taJkWPpmuodt-kqX5Z4KukSM | ||
@scope = openid email profile offline_access calc:double | ||
# | ||
##### | ||
|
||
|
||
# Authorize | ||
GET {{tenant}}/connect/authorize?state=l337&redirect_uri={{redirect_uri}}&code_challenge_method=S256&code_challenge={{code_challenge}}&client_id={{client_id}}&response_type=code&scope={{scope}}&audience={{audience}}&prompt=consent | ||
|
||
### | ||
|
||
# Get access and refresh token | ||
# @name token | ||
|
||
@code = 892A6B9BB1FF2BD98A79A3E595548C687E1B8098DBA64B0E3F1DC5E183FBD154-1 | ||
|
||
|
||
POST {{tenant}}/connect/token | ||
Content-Type: application/x-www-form-urlencoded | ||
|
||
grant_type=authorization_code | ||
&client_id={{client_id}} | ||
&client_secret={{client_secret}} | ||
&code_verifier={{code_verifier}} | ||
&code={{code}} | ||
&redirect_uri={{redirect_uri}} |
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,74 @@ | ||
########## | ||
# | ||
# Device Authorization Grant | ||
# | ||
# https://datatracker.ietf.org/doc/html/rfc8628 | ||
# | ||
########## | ||
|
||
|
||
##### | ||
# Configuration --> use Device Code Grant | ||
|
||
@client_id = device | ||
@client_secret = secret | ||
@scope = openid email profile offline_access calc:double | ||
@resource = urn:calcapi | ||
|
||
# | ||
##### | ||
|
||
# Get Device Code | ||
# @name devicecode | ||
|
||
POST {{tenant}}/connect/deviceauthorization | ||
Content-Type: application/x-www-form-urlencoded | ||
|
||
client_id={{client_id}} | ||
&client_secret={{client_secret}} | ||
&scope={{scope}} | ||
&resource={{resource}} | ||
|
||
|
||
### | ||
|
||
@device_code = {{devicecode.response.body.$.device_code}} | ||
@user_code = {{devicecode.response.body.$.user_code}} | ||
|
||
# Get Token | ||
# @name token | ||
|
||
POST {{tenant}}/connect/token | ||
Content-Type: application/x-www-form-urlencoded | ||
|
||
grant_type=urn:ietf:params:oauth:grant-type:device_code | ||
&client_id={{client_id}} | ||
&client_secret={{client_secret}} | ||
&device_code={{device_code}} | ||
|
||
### | ||
|
||
@access_token = {{token.response.body.$.access_token}} | ||
@id_token = {{token.response.body.$.id_token}} | ||
|
||
# Get Userinfo with identity token | ||
GET {{tenant}}/connect/userinfo | ||
Authorization: Bearer {{access_token}} | ||
|
||
### | ||
|
||
# Double Calucator API | ||
GET https://localhost:6001/Double/3 | ||
Authorization: Bearer {{access_token}} | ||
|
||
### | ||
|
||
# Square Calucator API | ||
GET https://localhost:6001/Square/3 | ||
Authorization: Bearer {{access_token}} | ||
|
||
### | ||
|
||
# Tokeninfo Calucator API | ||
GET http://localhost:5001/api/tokeninfo | ||
Authorization: Bearer {{access_token}} |
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,12 @@ | ||
# OAuth / OpenID Connect Sample Requests | ||
|
||
## Prerequisites | ||
|
||
- [Visual Studio Code](https://code.visualstudio.com) | ||
- [REST Client](https://marketplace.visualstudio.com/items?itemName=humao.rest-client) | ||
|
||
## Usage | ||
|
||
- Customize configuration settings in [.vscode\settings.json](.vscode/settings.json) | ||
- Start IdentityServer in [IdentityServer](../src/IdentityServerUi)] | ||
- Start Calculator API in [CalcApi](../src/CalcApi) |
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,76 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# next.js build output | ||
.next | ||
|
||
# nuxt.js build output | ||
.nuxt | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless | ||
|
||
# FuseBox cache | ||
.fusebox/ |
22 changes: 22 additions & 0 deletions
22
Requests/helpers/auth-code-pkce/.devcontainer/devcontainer.json
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,22 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node | ||
{ | ||
"name": "Node.js & TypeScript", | ||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
"image": "mcr.microsoft.com/devcontainers/typescript-node:0-20" | ||
|
||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "yarn install", | ||
|
||
// Configure tool-specific properties. | ||
// "customizations": {}, | ||
|
||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} |
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,11 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "npm" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "weekly" |
Oops, something went wrong.