Skip to content

Commit a8b0a34

Browse files
authored
Add example (#9)
1 parent 4b7006d commit a8b0a34

Some content is hidden

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

53 files changed

+5422
-38
lines changed

.github/dependabot.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,29 @@ updates:
1212
- poad
1313

1414
- package-ecosystem: npm
15-
directory: '/'
15+
directory: '/package/'
16+
schedule:
17+
interval: daily
18+
timezone: Asia/Tokyo
19+
allow:
20+
- dependency-type: all
21+
rebase-strategy: auto
22+
assignees:
23+
- poad
24+
25+
- package-ecosystem: npm
26+
directory: '/example/'
27+
schedule:
28+
interval: daily
29+
timezone: Asia/Tokyo
30+
allow:
31+
- dependency-type: all
32+
rebase-strategy: auto
33+
assignees:
34+
- poad
35+
36+
- package-ecosystem: npm
37+
directory: '/example/app/'
1638
schedule:
1739
interval: daily
1840
timezone: Asia/Tokyo

.github/workflows/test.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ jobs:
2626
node-version: ${{ matrix.node-version }}
2727
check-latest: true
2828
cache: yarn
29+
cache-dependency-path: |
30+
package/yarn.lock
31+
example/yarn.lock
32+
example/app/yarn.lock
2933
3034
- uses: actions/cache@v3
3135
with:
@@ -34,7 +38,16 @@ jobs:
3438
restore-keys: |
3539
${{ runner.os }}-node-
3640
37-
- name: Build
41+
- name: Build (package)
42+
working-directory: package
43+
run: yarn install && yarn lint && yarn build
44+
45+
- name: Build (example)
46+
working-directory: example
47+
run: yarn install && yarn lint && yarn build
48+
49+
- name: Build (example/app)
50+
working-directory: example/app
3851
run: yarn install && yarn lint && yarn build
3952

4053
configure:

README.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,50 @@
1-
# github-cognito-oidc-proxy
1+
# GitHub OAuth 2.0 OpenID Connect Proxy for AWS Cognito
2+
3+
Connect to AWS Cognito using API Gateway and Lambda Function as a proxy for GitHub OAuth applications and as an Identity Provider via OpenID Connect.
4+
5+
## How to use?
6+
7+
### requirement
8+
9+
- Node.js 14+
10+
- AWS CDK
11+
- yarn 1.x
12+
13+
### Deploy AWS Resources
14+
15+
```sh
16+
cd api
17+
yarn install
18+
cdk deploy
19+
```
20+
21+
#### context parameter
22+
23+
| key | description | require |
24+
|:----|:------------|:--------|
25+
| env | The CloudFormation Sack to be built and the prefix name to be set for the AWS resource. | No |
26+
27+
### Configure the AWS Cognito user pool
28+
29+
Now that API Gateway v1 (Rest API) is built, set the GitHub OAuth application and API Gateway endpoint to "Federated identity provider sign-in" in the Cognito user pool.
30+
31+
<https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-oidc-idp.html>
32+
33+
| Name | Description of the value to be set |
34+
| Client ID | A client ID of Your GitHub OAuth 2.0 application. |
35+
| Client secret | A client secret of Your GitHub OAuth 2.0 application. |
36+
| Authorized scopes | `openid read:user user:email` |
37+
| Attribute request method | GET |
38+
| Setup method | Auto fill through issuer URL |
39+
| Issuer URL | The endpoint URL for the `default` stage of your API Gateway. |
40+
41+
#### Issuer URL
42+
43+
The stage name of the deployed API Gateway is default.
44+
45+
The value to be set for the Issue URL is as follows:
46+
47+
https://~{API ID}~.execute-api.~{AWS Region}~.amazonaws.com/default
48+
49+
### Attributes Mapping
50+

bin/github-cognito-oidc-proxy.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

example/.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.d.ts
2+
**.d.ts

example/.eslintrc

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
"root": true,
3+
"env": {
4+
"browser": true,
5+
"node": true,
6+
"es2022": true
7+
},
8+
"parserOptions": {
9+
"ecmaVersion": "latest",
10+
"sourceType": "module"
11+
},
12+
"extends": [
13+
"airbnb-base",
14+
"plugin:import/typescript"
15+
],
16+
"parser": "@typescript-eslint/parser",
17+
"plugins": [
18+
"@typescript-eslint"
19+
],
20+
"rules": {
21+
"@typescript-eslint/indent": [
22+
"error",
23+
2
24+
],
25+
"spaced-comment": [
26+
"error",
27+
"always",
28+
{
29+
"markers": [
30+
"/ <reference"
31+
]
32+
}
33+
],
34+
"import/no-extraneous-dependencies": [
35+
"off",
36+
{
37+
"devDependencies": true,
38+
"optionalDependencies": false
39+
}
40+
],
41+
"max-len": [
42+
"error",
43+
{
44+
"code": 200
45+
}
46+
],
47+
"@next/next/no-img-element": [
48+
"off"
49+
],
50+
"prefer-promise-reject-errors": [
51+
"off"
52+
],
53+
"react/jsx-filename-extension": [
54+
"off"
55+
],
56+
"react/prop-types": [
57+
"off"
58+
],
59+
"import/extensions": [
60+
"off"
61+
],
62+
"jsx-a11y/anchor-is-valid": [
63+
"off"
64+
],
65+
"no-return-assign": [
66+
"off"
67+
],
68+
"react/display-name": [
69+
"off"
70+
],
71+
"import/prefer-default-export": [
72+
"off"
73+
],
74+
"camelcase": [
75+
"off"
76+
],
77+
"no-unused-vars": [
78+
"off"
79+
]
80+
}
81+
}

example/.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*.js
2+
!jest.config.js
3+
*.d.ts
4+
node_modules
5+
6+
# CDK asset staging directory
7+
.cdk.staging
8+
cdk.out
9+
cdk.json
10+
!next.config.js
File renamed without changes.

example/.prettierrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"trailingComma": "es5"
5+
}
File renamed without changes.

0 commit comments

Comments
 (0)