Skip to content

Commit

Permalink
feat: allow keycloak to act as idp (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
Maurice Faber authored Oct 7, 2021
1 parent 6fa0f40 commit 3c4684a
Show file tree
Hide file tree
Showing 25 changed files with 11,654 additions and 12,375 deletions.
37 changes: 32 additions & 5 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
root: true

parser: '@typescript-eslint/parser'
parserOptions:
project: ['./tsconfig.json']
ecmaVersion: 2021
Expand All @@ -13,7 +14,7 @@ extends:
- airbnb-base
- plugin:prettier/recommended
- prettier
- prettier/@typescript-eslint
- plugin:import/recommended
- plugin:import/errors
- plugin:import/warnings
- plugin:import/typescript
Expand All @@ -35,14 +36,40 @@ env:
node: true

rules:
'@typescript-eslint/ban-ts-comment': off
# disabled until https://github.com/typescript-eslint/typescript-eslint/issues/2077#issuecomment-634811363:
# '@typescript-eslint/camelcase': warn
'@typescript-eslint/member-delimiter-style': off
'@typescript-eslint/no-explicit-any': off
'@typescript-eslint/explicit-function-return-type': off
'@typescript-eslint/no-unsafe-assignment': off
'@typescript-eslint/no-unsafe-member-access': off
'@typescript-eslint/no-unsafe-return': off
'@typescript-eslint/no-unused-vars': off
'@typescript-eslint/no-use-before-define': off
# this next line is disabling all the warnings about non typed stuff:
# '@typescript-eslint/explicit-module-boundary-types': off
'@typescript-eslint/restrict-template-expressions': off
'@typescript-eslint/no-unsafe-call': off
'@typescript-eslint/no-non-null-assertion': off
'@typescript-eslint/no-floating-promises': off
'@typescript-eslint/no-shadow': error
func-names: 'off'
import/no-extraneous-dependencies: off
import/extensions: off
import/prefer-default-export: off
eol-last: ['error', 'always']
no-shadow: warn
no-unused-vars: error
no-shadow: 'off'
no-unused-vars: warn
prefer-destructuring: error
no-use-before-define: error
no-console: warn
no-use-before-define: 'off'
no-console: 'off'
object-shorthand: error
no-debugger: error
no-param-reassign:
- error
- props: true
ignorePropertyModificationsFor: [memo]
no-plusplus:
- 2
- allowForLoopAfterthoughts: true
3 changes: 3 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

npx --no-install commitlint --edit $1
4 changes: 4 additions & 0 deletions .husky/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

run-if-changed
4 changes: 4 additions & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

run-if-changed
4 changes: 4 additions & 0 deletions .husky/post-rewrite
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

run-if-changed
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged && npm run lint
3 changes: 3 additions & 0 deletions .husky/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

exec < /dev/tty && npx cz --hook || true
19 changes: 13 additions & 6 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
"runtimeArgs": ["run-script", "tasks:drone-dev"],
"cwd": "${workspaceRoot}",
"env": {
"DEBUG": "*"
"DEBUG": "*",
"NODE_TLS_REJECT_UNAUTHORIZED": "0"
},
"console": "integratedTerminal"
},
Expand All @@ -83,7 +84,8 @@
"runtimeArgs": ["run-script", "tasks:gitea-dev"],
"cwd": "${workspaceRoot}",
"env": {
"DEBUG": "*"
"DEBUG": "*",
"NODE_TLS_REJECT_UNAUTHORIZED": "0"
},
"console": "integratedTerminal"
},
Expand All @@ -95,7 +97,8 @@
"runtimeArgs": ["run-script", "tasks:gitea-drone-auth-dev"],
"cwd": "${workspaceRoot}",
"env": {
"DEBUG": "*"
"DEBUG": "*",
"NODE_TLS_REJECT_UNAUTHORIZED": "0"
},
"console": "integratedTerminal"
},
Expand All @@ -107,7 +110,8 @@
"runtimeArgs": ["run-script", "tasks:harbor-dev"],
"cwd": "${workspaceRoot}",
"env": {
"DEBUG": "*"
"DEBUG": "*",
"NODE_TLS_REJECT_UNAUTHORIZED": "0"
},
"console": "integratedTerminal"
},
Expand All @@ -119,7 +123,8 @@
"runtimeArgs": ["run-script", "tasks:otomi-chart-dev"],
"cwd": "${workspaceRoot}",
"env": {
"DEBUG": "*"
"DEBUG": "*",
"NODE_TLS_REJECT_UNAUTHORIZED": "0"
},
"console": "integratedTerminal"
},
Expand All @@ -131,7 +136,8 @@
"runtimeArgs": ["run-script", "tasks:keycloak-dev"],
"cwd": "${workspaceRoot}",
"env": {
"DEBUG": "*"
"DEBUG": "*",
"NODE_TLS_REJECT_UNAUTHORIZED": "0"
},
"console": "integratedTerminal"
},
Expand All @@ -143,6 +149,7 @@
"runtimeArgs": ["run-script", "tasks:certs-aws-dev"],
"env": {
"DEBUG": "*",
"NODE_TLS_REJECT_UNAUTHORIZED": "0",
"REGION": "eu-central-1"
},
"cwd": "${workspaceRoot}",
Expand Down
28 changes: 24 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
{
"[docker]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[md]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[shell]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
},
"[typescript]": {
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": true
},
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.codeActionsOnSave": {
"source.fixAll": true
},
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.formatOnSave": true,
"eslint.enable": true,
"eslint.format.enable": true,
"eslint.validate": ["javascript", "typescript"],
"files.associations": {
Expand All @@ -15,8 +36,7 @@
"mochaExplorer.files": "src/**/*.test.ts",
"mochaExplorer.require": "ts-node/register",
"mochaExplorer.timeout": 20000,
"prettier.disableLanguages": ["javascript", "typescript"],
"prettier.enable": true,
"typescript.autoClosingTags": false,
"standard.enable": false
"standard.enable": false,
"typescript.autoClosingTags": false
}
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,36 @@ Then start a proxy to the api you wish to target:

Or start them all with `bin/start-proxies.sh`

Now you can execute a task locally:
Now you can execute a task locally:

```
npm run task:(gitea*|harbor|keycloak|certs-aws|...)-dev
npm run tasks:(gitea*|harbor|keycloak|certs-aws|...)-dev
```

Or you can start them in the vscode debugger.

**Skipping TLS (like for staging certs):**

Run the next line in your shell to skip TLS cert validation, like when using self-signed certs like letsencrypt staging:

```bash
export NODE_TLS_REJECT_UNAUTHORIZED='0'
```

**Setting debug level:**

For all packages to turn on debug:

```bash
export DEBUG='*'
```

To limit scope please read [the debug docs](https://github.com/visionmedia/debug).

## Unit tests

There are not many unit tests, as the tasks are *very* robust and idempotent. You can run them as always with:
There are not many unit tests, as the tasks are _very_ robust and idempotent. You can run them as always with:

```
npm test
```
```
Loading

0 comments on commit 3c4684a

Please sign in to comment.