Compare commits
23 Commits
main
...
e52bf62066
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e52bf62066 | ||
|
|
678f79274d | ||
|
|
2e976da1d9 | ||
|
|
0af299c8ee | ||
|
|
a49ad5f681 | ||
|
|
f219856698 | ||
|
|
d5c5c18996 | ||
|
|
733f1343a6 | ||
|
|
23fd094c5f | ||
|
|
f327e73d5f | ||
|
|
5ba0791478 | ||
|
|
a6d390bc49 | ||
|
|
832b381732 | ||
|
|
23c8602a9f | ||
|
|
075f93f550 | ||
|
|
a44fb04abe | ||
|
|
96a8406630 | ||
|
|
d39e228a38 | ||
|
|
c642b31aef | ||
|
|
c23d668e18 | ||
|
|
9c26e2d666 | ||
|
|
3584a57554 | ||
|
|
045e6f2c5f |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -17,3 +17,6 @@ uploads/
|
|||||||
|
|
||||||
# Coverage
|
# Coverage
|
||||||
coverage/
|
coverage/
|
||||||
|
|
||||||
|
# test secrets
|
||||||
|
redispass
|
||||||
46
package.json
46
package.json
@@ -94,60 +94,60 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@directus/errors": "^0.0.2",
|
"@directus/errors": "^0.2.4",
|
||||||
"@directus/extensions-sdk": "^10.2.0",
|
"@directus/extensions-sdk": "^11.0.1",
|
||||||
"@directus/tsconfig": "^1.0.1",
|
"@directus/tsconfig": "^1.0.1",
|
||||||
"@directus/types": "^10.1.6",
|
"@directus/types": "^11.0.7",
|
||||||
"@directus/utils": "^10.0.11",
|
"@directus/utils": "^11.0.6",
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@semantic-release/changelog": "^6.0.3",
|
"@semantic-release/changelog": "^6.0.3",
|
||||||
"@semantic-release/commit-analyzer": "^10.0.4",
|
"@semantic-release/commit-analyzer": "^10.0.4",
|
||||||
"@semantic-release/exec": "^6.0.3",
|
"@semantic-release/exec": "^6.0.3",
|
||||||
"@semantic-release/github": "^9.2.3",
|
"@semantic-release/github": "^9.2.6",
|
||||||
"@semantic-release/npm": "^10.0.6",
|
"@semantic-release/npm": "^10.0.6",
|
||||||
"@types/chai": "^4.3.10",
|
"@types/chai": "^4.3.12",
|
||||||
"@types/chai-as-promised": "^7.1.8",
|
"@types/chai-as-promised": "^7.1.8",
|
||||||
"@types/config": "^3.3.3",
|
"@types/config": "^3.3.3",
|
||||||
"@types/express": "^4.17.21",
|
"@types/express": "^4.17.21",
|
||||||
"@types/fs-extra": "^11.0.4",
|
"@types/fs-extra": "^11.0.4",
|
||||||
"@types/js-yaml": "^4.0.9",
|
"@types/js-yaml": "^4.0.9",
|
||||||
"@types/jsonwebtoken": "^9.0.5",
|
"@types/jsonwebtoken": "^9.0.6",
|
||||||
"@types/lodash-es": "^4.17.11",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"@types/mocha": "^10.0.4",
|
"@types/mocha": "^10.0.6",
|
||||||
"@types/node": "^20.9.1",
|
"@types/node": "^20.11.25",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
||||||
"@vitest/coverage-istanbul": "^0.34.6",
|
"@vitest/coverage-istanbul": "^0.34.6",
|
||||||
"axios": "^1.6.2",
|
"axios": "^1.6.7",
|
||||||
"config": "^3.3.9",
|
"config": "^3.3.11",
|
||||||
"dotenv": "^16.3.1",
|
"dotenv": "^16.4.5",
|
||||||
"eslint": "^8.53.0",
|
"eslint": "^8.57.0",
|
||||||
"eslint-config-standard-with-typescript": "^37.0.0",
|
"eslint-config-standard-with-typescript": "^37.0.0",
|
||||||
"eslint-plugin-import": "^2.29.0",
|
"eslint-plugin-import": "^2.29.1",
|
||||||
"eslint-plugin-n": "^15.7.0",
|
"eslint-plugin-n": "^15.7.0",
|
||||||
"eslint-plugin-no-loops": "^0.3.0",
|
"eslint-plugin-no-loops": "^0.3.0",
|
||||||
"eslint-plugin-promise": "^6.1.1",
|
"eslint-plugin-promise": "^6.1.1",
|
||||||
"fs-extra": "^11.1.1",
|
"fs-extra": "^11.2.0",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"knex": "^2.5.1",
|
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"semantic-release": "^21.1.2",
|
"semantic-release": "^21.1.2",
|
||||||
"sqlite3": "^5.1.6",
|
"sqlite3": "^5.1.7",
|
||||||
"ts-mocha": "^10.0.0",
|
"ts-mocha": "^10.0.0",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.2",
|
||||||
"typescript": "^5.2.2",
|
"typescript": "^5.4.2",
|
||||||
"vitest": "^0.34.6"
|
"vitest": "^0.34.6"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@keyv/redis": "^2.8.0",
|
"@keyv/redis": "^2.8.4",
|
||||||
"jsonwebtoken": "^9.0.2",
|
"jsonwebtoken": "^9.0.2",
|
||||||
"jwks-rsa": "^3.1.0",
|
"jwks-rsa": "^3.1.0",
|
||||||
"keyv": "^4.5.4",
|
"keyv": "^4.5.4",
|
||||||
"openid-client": "^5.6.1"
|
"openid-client": "^5.6.5"
|
||||||
},
|
},
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"vite@<4.3.9": "^4.3.9",
|
"vite": "^4.3.9",
|
||||||
"zod@<=3.22.2": ">=3.22.3",
|
"zod@<=3.22.2": ">=3.22.3",
|
||||||
"axios@<=1.4.0": ">=1.4.1"
|
"axios@<=1.4.0": ">=1.4.1"
|
||||||
}
|
}
|
||||||
|
|||||||
3266
pnpm-lock.yaml
generated
3266
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
6
redis.conf
Normal file
6
redis.conf
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
bind 127.0.0.1 -::1
|
||||||
|
protected-mode yes
|
||||||
|
port 6379
|
||||||
|
tcp-keepalive 300
|
||||||
|
|
||||||
|
requirepass asd@123
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
import type { Accountability } from '@directus/types';
|
import type { Accountability } from '@directus/types';
|
||||||
import { getAuthProviders } from './authProvider/get-auth-providers.js';
|
import { getAuthProviders } from './authProvider/get-auth-providers.js';
|
||||||
import type { Knex } from 'knex';
|
|
||||||
import { verify_token } from './verify-token.js';
|
import { verify_token } from './verify-token.js';
|
||||||
import { CacheEnabled, CacheGet, CacheSet } from './cache.js';
|
import { CacheEnabled, CacheGet, CacheSet } from './cache.js';
|
||||||
|
import type { Knex } from 'knex';
|
||||||
|
|
||||||
|
|
||||||
const authProviders = await getAuthProviders();
|
const authProviders = await getAuthProviders();
|
||||||
|
|||||||
@@ -2,15 +2,14 @@ import { defineHook } from '@directus/extensions-sdk';
|
|||||||
import { getAccountabilityForToken } from './external-jwt/get-accountability-for-token';
|
import { getAccountabilityForToken } from './external-jwt/get-accountability-for-token';
|
||||||
import type { Request } from 'express';
|
import type { Request } from 'express';
|
||||||
import jwt from 'jsonwebtoken';
|
import jwt from 'jsonwebtoken';
|
||||||
import { HookConfig } from '@directus/types';
|
import type {HookConfig} from '@directus/extensions'
|
||||||
|
import type { Accountability, EventContext } from '@directus/types';
|
||||||
|
|
||||||
|
|
||||||
export default defineHook<HookConfig>(({ filter }) => {
|
export default defineHook<HookConfig>(({ filter }) => {
|
||||||
|
|
||||||
// get all configuration
|
// get all configuration
|
||||||
|
|
||||||
filter('authenticate', (defaultAccountability, event, context) => {
|
filter('authenticate', (defaultAccountability: Accountability, event, context: EventContext) => {
|
||||||
const req = <Request>event['req'];
|
const req = <Request>event['req'];
|
||||||
if(!req.token) return defaultAccountability;
|
if(!req.token) return defaultAccountability;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user