-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into v7-ef-jwt-validation
- Loading branch information
Showing
32 changed files
with
13,238 additions
and
41 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
examples/v7-token-auth-example/.github/pull_request_template.md
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,5 @@ | ||
**NOTICE TO CONTRIBUTORS** | ||
|
||
This repository is not actively monitored and any pull requests made to this repository will be closed/ignored. | ||
|
||
Please submit the pull request to [edgio-docs/edgio-examples](https://github.com/edgio-docs/edgio-examples) instead. |
18 changes: 18 additions & 0 deletions
18
examples/v7-token-auth-example/.github/workflows/edgio.yml
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,18 @@ | ||
name: Deploy to Edgio | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
|
||
jobs: | ||
deploy-to-edgio: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- run: if [ -f yarn.lock ]; then yarn install; else npm ci; fi | ||
- run: if [ -f yarn.lock ]; then yarn edgio:deploy -- --token=$EDGIO_DEPLOY_TOKEN; else npm run edgio:deploy -- --token=$EDGIO_DEPLOY_TOKEN; fi | ||
env: | ||
EDGIO_DEPLOY_TOKEN: ${{secrets.EDGIO_DEPLOY_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,39 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
.yarn/install-state.gz | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# local env files | ||
.env*.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
|
||
# Edgio generated build directory | ||
.edgio |
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,35 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "chrome", | ||
"request": "launch", | ||
"name": "tokenauth:chrome", | ||
"url": "http://localhost:3000", | ||
"webRoot": "${workspaceFolder}", | ||
"preLaunchTask": "delay" | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "tokenauth:edgio", | ||
"cwd": "${workspaceFolder}", | ||
"autoAttachChildProcesses": true, | ||
"envFile": "${workspaceFolder}/.env.local", | ||
"program": "${workspaceFolder}/node_modules/@edgio/cli", | ||
"args": ["dev"] | ||
} | ||
], | ||
"compounds": [ | ||
{ | ||
"name": "Debug [tokenauth]", | ||
"configurations": [ | ||
"tokenauth:edgio", | ||
"tokenauth:chrome" | ||
] | ||
} | ||
] | ||
} |
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,15 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "delay", | ||
"command": "sleep 4", | ||
"type": "shell", | ||
"presentation": { | ||
"reveal": "silent", | ||
"panel": "shared" | ||
}, | ||
"group": "none" | ||
} | ||
] | ||
} |
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,27 @@ | ||
# Next.js Demo of Edgio Token Auth Functionality | ||
This project demonstrates how Token Auth works with Edgio. For more details on this feature, visit [the docs](https://docs.edg.io/applications/v7/security/token_auth). | ||
|
||
## Available Pages | ||
This application exposes a few separate pages and one API endpoint: | ||
|
||
* Main Page `/`: This page does not require a token. | ||
* Token Auth Landing Page `/secure`: This page does not require a token. All links on this page require a valid token. | ||
* Static Secure Page `/secure/static`: This page shows static data. | ||
* Static Dynamic Page `/secure/dynamic`: This page shows dynamic data fetched from a third-party API. | ||
* Token Generator/Decoder `/secure/generator`: This page allows the visitor to create and decode `ectoken`-compatible tokens. | ||
* Current Token Information `/secure/info`: This page shows the decoded information about the token used to access the page. | ||
* API route `/api/token`: This API route takes a `GET` request and returns a new token valid for all users but only for three minutes from when it was generated. | ||
|
||
## How to Use | ||
1. Navigate to the project homepage and click the link for the "Landing Page." | ||
1. On the landing page, click the button to "Generate a temporary token." | ||
1. Copy the generated token to your clipboard. Note that the links on this page will automatically update when a token is generated. | ||
1. If you have generated a token via the client-side generator (see below), you can replace the token in the query string for any of the secure routes. | ||
|
||
## Generating a Custom Token | ||
You can also generate a custom token for this site. (Please note: the primary and backup tokens must be present in the Edgio environment variables for this feature to work properly.) | ||
1. Navigate to the "Client-side Token Generator/Decoder" page. | ||
1. Under the "Encode Token" section, enter the values you need for your token. | ||
1. In that same section, enter one of the two keys you entered in your Token Auth settings for your Edgio environment. | ||
1. Click "Encode Token." | ||
1. The "Token value" field will contain the encoded token for your environment. Copy that token, and use it when navigating the demo site. |
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,4 @@ | ||
module.exports = { | ||
connector: '@edgio/next', | ||
organization: 'edgio-community', | ||
} |
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,7 @@ | ||
{ | ||
"compilerOptions": { | ||
"paths": { | ||
"@/*": ["./src/*"] | ||
} | ||
} | ||
} |
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,8 @@ | ||
// This file was automatically added by edgio init. | ||
// You should commit this file to source control. | ||
const { withEdgio } = require('@edgio/next/config') | ||
|
||
module.exports = (phase, config) => | ||
withEdgio({ | ||
// Write your Next config here | ||
}) |
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,4 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {}; | ||
|
||
export default nextConfig; |
Oops, something went wrong.