@nocobase/auth 0.17.0-alpha.7 → 0.18.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/auth-manager.d.ts +6 -2
- package/lib/auth-manager.js +1 -1
- package/lib/auth.d.ts +4 -3
- package/lib/base/auth.js +1 -1
- package/package.json +7 -7
package/lib/auth-manager.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { Context, Next } from '@nocobase/actions';
|
|
2
|
-
import { Model } from '@nocobase/database';
|
|
3
2
|
import { Registry } from '@nocobase/utils';
|
|
4
3
|
import { Auth, AuthExtend } from './auth';
|
|
5
4
|
import { JwtOptions, JwtService } from './base/jwt-service';
|
|
6
5
|
import { ITokenBlacklistService } from './base/token-blacklist-service';
|
|
6
|
+
export interface Authenticator {
|
|
7
|
+
authType: string;
|
|
8
|
+
options: Record<string, any>;
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}
|
|
7
11
|
export interface Storer {
|
|
8
|
-
get: (name: string) => Promise<
|
|
12
|
+
get: (name: string) => Promise<Authenticator>;
|
|
9
13
|
}
|
|
10
14
|
export type AuthManagerOptions = {
|
|
11
15
|
authKey: string;
|
package/lib/auth-manager.js
CHANGED
|
@@ -96,7 +96,7 @@ const _AuthManager = class _AuthManager {
|
|
|
96
96
|
ctx.auth = authenticator;
|
|
97
97
|
} catch (err) {
|
|
98
98
|
ctx.auth = {};
|
|
99
|
-
ctx.
|
|
99
|
+
ctx.logger.warn(err.message, { method: "check", authenticator: name });
|
|
100
100
|
return next();
|
|
101
101
|
}
|
|
102
102
|
if (authenticator) {
|
package/lib/auth.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Context } from '@nocobase/actions';
|
|
2
2
|
import { Model } from '@nocobase/database';
|
|
3
|
+
import { Authenticator } from './auth-manager';
|
|
3
4
|
export type AuthConfig = {
|
|
4
|
-
authenticator:
|
|
5
|
+
authenticator: Authenticator;
|
|
5
6
|
options: {
|
|
6
7
|
[key: string]: any;
|
|
7
8
|
};
|
|
@@ -17,13 +18,13 @@ interface IAuth {
|
|
|
17
18
|
}
|
|
18
19
|
export declare abstract class Auth implements IAuth {
|
|
19
20
|
abstract user: Model;
|
|
20
|
-
protected authenticator:
|
|
21
|
+
protected authenticator: Authenticator;
|
|
21
22
|
protected options: {
|
|
22
23
|
[key: string]: any;
|
|
23
24
|
};
|
|
24
25
|
protected ctx: Context;
|
|
25
26
|
constructor(config: AuthConfig);
|
|
26
|
-
abstract check():
|
|
27
|
+
abstract check(): Promise<Model>;
|
|
27
28
|
signIn(): Promise<any>;
|
|
28
29
|
signUp(): Promise<any>;
|
|
29
30
|
signOut(): Promise<any>;
|
package/lib/base/auth.js
CHANGED
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/auth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0-alpha.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./lib/index.js",
|
|
7
7
|
"types": "./lib/index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@nocobase/actions": "0.
|
|
10
|
-
"@nocobase/cache": "0.
|
|
11
|
-
"@nocobase/database": "0.
|
|
12
|
-
"@nocobase/resourcer": "0.
|
|
13
|
-
"@nocobase/utils": "0.
|
|
9
|
+
"@nocobase/actions": "0.18.0-alpha.8",
|
|
10
|
+
"@nocobase/cache": "0.18.0-alpha.8",
|
|
11
|
+
"@nocobase/database": "0.18.0-alpha.8",
|
|
12
|
+
"@nocobase/resourcer": "0.18.0-alpha.8",
|
|
13
|
+
"@nocobase/utils": "0.18.0-alpha.8",
|
|
14
14
|
"@types/jsonwebtoken": "^8.5.8",
|
|
15
15
|
"jsonwebtoken": "^8.5.1"
|
|
16
16
|
},
|
|
@@ -19,5 +19,5 @@
|
|
|
19
19
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
20
20
|
"directory": "packages/auth"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "727d42f6f14e5f863831da3dbf3255ba1165b567"
|
|
23
23
|
}
|