Skip to content

Commit 05d3e75

Browse files
authored
Merge branch 'main' into v7-ef-jwt-validation
2 parents 382decb + 4d0ab48 commit 05d3e75

32 files changed

+13238
-41
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
**NOTICE TO CONTRIBUTORS**
2+
3+
This repository is not actively monitored and any pull requests made to this repository will be closed/ignored.
4+
5+
Please submit the pull request to [edgio-docs/edgio-examples](https://github.com/edgio-docs/edgio-examples) instead.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Deploy to Edgio
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
7+
jobs:
8+
deploy-to-edgio:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: actions/setup-node@v3
13+
with:
14+
node-version: 18
15+
- run: if [ -f yarn.lock ]; then yarn install; else npm ci; fi
16+
- run: if [ -f yarn.lock ]; then yarn edgio:deploy -- --token=$EDGIO_DEPLOY_TOKEN; else npm run edgio:deploy -- --token=$EDGIO_DEPLOY_TOKEN; fi
17+
env:
18+
EDGIO_DEPLOY_TOKEN: ${{secrets.EDGIO_DEPLOY_TOKEN}}
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
.yarn/install-state.gz
8+
9+
# testing
10+
/coverage
11+
12+
# next.js
13+
/.next/
14+
/out/
15+
16+
# production
17+
/build
18+
19+
# misc
20+
.DS_Store
21+
*.pem
22+
23+
# debug
24+
npm-debug.log*
25+
yarn-debug.log*
26+
yarn-error.log*
27+
28+
# local env files
29+
.env*.local
30+
31+
# vercel
32+
.vercel
33+
34+
# typescript
35+
*.tsbuildinfo
36+
next-env.d.ts
37+
38+
# Edgio generated build directory
39+
.edgio
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "chrome",
9+
"request": "launch",
10+
"name": "tokenauth:chrome",
11+
"url": "http://localhost:3000",
12+
"webRoot": "${workspaceFolder}",
13+
"preLaunchTask": "delay"
14+
},
15+
{
16+
"type": "node",
17+
"request": "launch",
18+
"name": "tokenauth:edgio",
19+
"cwd": "${workspaceFolder}",
20+
"autoAttachChildProcesses": true,
21+
"envFile": "${workspaceFolder}/.env.local",
22+
"program": "${workspaceFolder}/node_modules/@edgio/cli",
23+
"args": ["dev"]
24+
}
25+
],
26+
"compounds": [
27+
{
28+
"name": "Debug [tokenauth]",
29+
"configurations": [
30+
"tokenauth:edgio",
31+
"tokenauth:chrome"
32+
]
33+
}
34+
]
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "delay",
6+
"command": "sleep 4",
7+
"type": "shell",
8+
"presentation": {
9+
"reveal": "silent",
10+
"panel": "shared"
11+
},
12+
"group": "none"
13+
}
14+
]
15+
}
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Next.js Demo of Edgio Token Auth Functionality
2+
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).
3+
4+
## Available Pages
5+
This application exposes a few separate pages and one API endpoint:
6+
7+
* Main Page `/`: This page does not require a token.
8+
* Token Auth Landing Page `/secure`: This page does not require a token. All links on this page require a valid token.
9+
* Static Secure Page `/secure/static`: This page shows static data.
10+
* Static Dynamic Page `/secure/dynamic`: This page shows dynamic data fetched from a third-party API.
11+
* Token Generator/Decoder `/secure/generator`: This page allows the visitor to create and decode `ectoken`-compatible tokens.
12+
* Current Token Information `/secure/info`: This page shows the decoded information about the token used to access the page.
13+
* 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.
14+
15+
## How to Use
16+
1. Navigate to the project homepage and click the link for the "Landing Page."
17+
1. On the landing page, click the button to "Generate a temporary token."
18+
1. Copy the generated token to your clipboard. Note that the links on this page will automatically update when a token is generated.
19+
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.
20+
21+
## Generating a Custom Token
22+
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.)
23+
1. Navigate to the "Client-side Token Generator/Decoder" page.
24+
1. Under the "Encode Token" section, enter the values you need for your token.
25+
1. In that same section, enter one of the two keys you entered in your Token Auth settings for your Edgio environment.
26+
1. Click "Encode Token."
27+
1. The "Token value" field will contain the encoded token for your environment. Copy that token, and use it when navigating the demo site.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
connector: '@edgio/next',
3+
organization: 'edgio-community',
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"compilerOptions": {
3+
"paths": {
4+
"@/*": ["./src/*"]
5+
}
6+
}
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// This file was automatically added by edgio init.
2+
// You should commit this file to source control.
3+
const { withEdgio } = require('@edgio/next/config')
4+
5+
module.exports = (phase, config) =>
6+
withEdgio({
7+
// Write your Next config here
8+
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/** @type {import('next').NextConfig} */
2+
const nextConfig = {};
3+
4+
export default nextConfig;

0 commit comments

Comments
 (0)