Skip to content

Commit d8a34dd

Browse files
author
ala
committed
authorizer setup
1 parent b91f205 commit d8a34dd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+84615
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
-----BEGIN PRIVATE KEY-----
2+
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC/Y6OK/Q2IB7CV
3+
uw56UKbj6EB4D5lX6SD4Vo2vQP/9KFqIduL2/WPRcjGWRASHl6PAMOPHVTV/i0O7
4+
/gVot315WoeOkonXTlLewewSV988li5ND6SBeTcrkrc8KSsCJXR6u9ZZ7Z07l4C3
5+
RPUm1PHaKhTkHnrQNVUaCUxOLJ/qNoTF0hemznROjcxvtnzEQoAZ8FoBSVpT0hia
6+
fs6vJIlYu66zSr+MTt1VR5cFoX1xh1aEw4/YlKO6JnNu4AZyNUVWQ6RKw73XmAuW
7+
026F0ZlDGajDycbG7noQDXm3cfAn4rPAWU+ser/OLZyHfm8d6Q3EVc5zYitzSHoR
8+
gD9VpHjTAgMBAAECggEBAJ6D4AhV3scz10WsUCluc0uAKSVHhjIRnIUS6vakV2FN
9+
8u3jycfXxrzKX9edLkM/jRi5ZW7LXCvvJIKnucMpdnr0SCIFrLTu4iQtaWEn9nUv
10+
zdl1g0LZKqCkO69QSZbVfsvIl5iT/Q5GRQ2Fx6YJ6OZQxEzMEdwwz/NokBKPU0Of
11+
w2UMUWIadI/cmdHgheXo4dAnbrlAjGurpzGJyj7k1puy6GN6GLrHWX4xCFgZ8Ub6
12+
AhscoYdYo99loiMkg2epvb7+lGY5vdHnM61Ue+Nv4Xv/NXS5WapaZfSlhfiuZvmS
13+
eORhBRVFGXaf5PeNb/TUWKnsYee8VsknESO87AtnEIECgYEA9YjV/nVIYcSPQs0n
14+
Sydy+ThX1Q5NqqstJy9B0f6mKO+qTdpBrQhy6lTXk3eCXHLH7gfq8ATSPhbObZCf
15+
tzcn3KvrsraSfifcQ2BwOtvDxlpMjcLHNE6eGJBl/0kWAnU6wX8Hz5CxMKwzUhr0
16+
96kARxaGJzYjKVwI8qDiwk5ckSkCgYEAx4v+S06FLFXrxxrVG+zN+zLmD3Qs0m0b
17+
BnxTTjiqpWD8iCudhWslPTDouFDMkYpL6R+yMWjb9oWuRGIzTKUzfa1+Eq7zsQx9
18+
FfQE6Hfa3WFO9141oPqKLqSJvAPJw1OunOonAlyPWOWQqq0yAphkqAzUdvZ47l6k
19+
3J8lUYYdjZsCgYAS56RCYVlfXbkCFbWuzazGj5YDq4RDXcauO68/sfGtOTbNo75m
20+
yj2+2SV4Dz2UTKokI6vtKxHdAfiG6xnBC5ggH4SYUAJbgEovTd+WSJF8VjuKtrKL
21+
znnRvlx8GW5+ZfROLa+2RZe+/aM98SFnaDXDQ3K01jBC4Pk3ZTfQaiQqcQKBgQCa
22+
guHi+efQjq9EupgtSU2tppnReYmDXoxAl2AB/4rTB6hC4FLWjkKFgSuSHK5qO4XP
23+
+4UFEUbROm3X8Zn7TSfztrUaTnHPs/XfW9W5E6VbKg/1JvOrtJPuzeUAuoYuQsvA
24+
IOcXwwgUM52zKuzAabP3FAgoHW1CVfKeCnThDVIw5QKBgQDsh43g2Ndh1hu+i8QS
25+
6fw+CXkyoG4h1MOKhoKvX9PjKaBGxQbWKAd8OEjGFv3Bte698sLyirav3CjILS/r
26+
YDB4YyK5egMNLhNyvQ7k5X86Y9XyImYtzePX07meyRBaIKeYr2u4MaxEumsQrHlG
27+
e/Duh1d2bjKZF7oq8qy3SaO94w==
28+
-----END PRIVATE KEY-----

authorizer-app/backend/server.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
const fastify = require('fastify')({logger: true})
2+
const fs = require('fs');
3+
const jwt = require('jsonwebtoken');
4+
5+
fastify.register(require('fastify-cors'), {
6+
origin: (origin, cb) => {
7+
if(/localhost/.test(origin)){
8+
// Request from localhost will pass
9+
cb(null, true)
10+
return
11+
}
12+
// Generate an error on other origins, disabling access
13+
cb(new Error("Not allowed"))
14+
},
15+
methods: ['GET', 'PUT', 'POST']
16+
})
17+
18+
// Declare a route
19+
fastify.get('/generate-token', async (request, reply) => {
20+
21+
const privateKey = fs.readFileSync('keys/private.pem');
22+
const token = jwt.sign({foo: 'bar'}, privateKey, {algorithm: 'RS256'});
23+
24+
return {token}
25+
})
26+
27+
// Run the server!
28+
const start = async () => {
29+
try {
30+
await fastify.listen(3001)
31+
} catch (err) {
32+
fastify.log.error(err)
33+
process.exit(1)
34+
}
35+
}
36+
start()

authorizer-app/client/.gitignore

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
24+
25+
#amplify-do-not-edit-begin
26+
amplify/\#current-cloud-backend
27+
amplify/.config/local-*
28+
amplify/logs
29+
amplify/mock-data
30+
amplify/backend/amplify-meta.json
31+
amplify/backend/awscloudformation
32+
amplify/backend/.temp
33+
build/
34+
dist/
35+
node_modules/
36+
aws-exports.js
37+
awsconfiguration.json
38+
amplifyconfiguration.json
39+
amplifyconfiguration.dart
40+
amplify-build-config.json
41+
amplify-gradle-config.json
42+
amplifytools.xcconfig
43+
.secret-*
44+
**.sample
45+
#amplify-do-not-edit-end

authorizer-app/client/README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Getting Started with Create React App
2+
3+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4+
5+
## Available Scripts
6+
7+
In the project directory, you can run:
8+
9+
### `yarn start`
10+
11+
Runs the app in the development mode.\
12+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
13+
14+
The page will reload if you make edits.\
15+
You will also see any lint errors in the console.
16+
17+
### `yarn test`
18+
19+
Launches the test runner in the interactive watch mode.\
20+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21+
22+
### `yarn build`
23+
24+
Builds the app for production to the `build` folder.\
25+
It correctly bundles React in production mode and optimizes the build for the best performance.
26+
27+
The build is minified and the filenames include the hashes.\
28+
Your app is ready to be deployed!
29+
30+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31+
32+
### `yarn eject`
33+
34+
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
35+
36+
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37+
38+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
39+
40+
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
41+
42+
## Learn More
43+
44+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45+
46+
To learn React, check out the [React documentation](https://reactjs.org/).
47+
48+
### Code Splitting
49+
50+
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
51+
52+
### Analyzing the Bundle Size
53+
54+
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
55+
56+
### Making a Progressive Web App
57+
58+
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
59+
60+
### Advanced Configuration
61+
62+
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
63+
64+
### Deployment
65+
66+
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
67+
68+
### `yarn build` fails to minify
69+
70+
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Getting Started with Amplify CLI
2+
This directory was generated by [Amplify CLI](https://docs.amplify.aws/cli).
3+
4+
Helpful resources:
5+
- Amplify documentation: https://docs.amplify.aws
6+
- Amplify CLI documentation: https://docs.amplify.aws/cli
7+
- More details on this folder & generated files: https://docs.amplify.aws/cli/reference/files
8+
- Join Amplify's community: https://amplify.aws/community/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[
2+
{
3+
"Key": "user:Stack",
4+
"Value": "{project-env}"
5+
},
6+
{
7+
"Key": "user:Application",
8+
"Value": "{project-name}"
9+
}
10+
]
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"features": {
3+
"graphqltransformer": {
4+
"addmissingownerfields": true,
5+
"improvepluralization": false,
6+
"validatetypenamereservedwords": true,
7+
"useexperimentalpipelinedtransformer": false,
8+
"enableiterativegsiupdates": true,
9+
"secondarykeyasgsi": true,
10+
"skipoverridemutationinputtypes": true
11+
},
12+
"frontend-ios": {
13+
"enablexcodeintegration": true
14+
},
15+
"auth": {
16+
"enablecaseinsensitivity": true,
17+
"useinclusiveterminology": true,
18+
"breakcirculardependency": true,
19+
"forcealiasattributes": false
20+
},
21+
"codegen": {
22+
"useappsyncmodelgenplugin": true,
23+
"usedocsgeneratorplugin": true,
24+
"usetypesgeneratorplugin": true,
25+
"cleangeneratedmodelsdirectory": true,
26+
"retaincasestyle": true,
27+
"addtimestampfields": true,
28+
"handlelistnullabilitytransparently": true,
29+
"emitauthprovider": true,
30+
"generateindexrules": true,
31+
"enabledartnullsafety": true
32+
},
33+
"appsync": {
34+
"generategraphqlpermissions": true
35+
},
36+
"latestregionsupport": {
37+
"pinpoint": 1,
38+
"translate": 1,
39+
"transcribe": 1,
40+
"rekognition": 1,
41+
"textract": 1,
42+
"comprehend": 1
43+
}
44+
}
45+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"dev": {
3+
"awscloudformation": {
4+
"AuthRoleName": "amplify-authorizerapp-dev-155324-authRole",
5+
"UnauthRoleArn": "arn:aws:iam::555485882223:role/amplify-authorizerapp-dev-155324-unauthRole",
6+
"AuthRoleArn": "arn:aws:iam::555485882223:role/amplify-authorizerapp-dev-155324-authRole",
7+
"Region": "eu-west-1",
8+
"DeploymentBucketName": "amplify-authorizerapp-dev-155324-deployment",
9+
"UnauthRoleName": "amplify-authorizerapp-dev-155324-unauthRole",
10+
"StackName": "amplify-authorizerapp-dev-155324",
11+
"StackId": "arn:aws:cloudformation:eu-west-1:555485882223:stack/amplify-authorizerapp-dev-155324/4bf95c70-3f11-11ec-a70a-02fd02b97be7",
12+
"AmplifyAppId": "d27vmfvbemwz6k"
13+
}
14+
}
15+
}

0 commit comments

Comments
 (0)