@nocobase/auth 0.14.0-alpha.6 → 0.14.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.
@@ -7,7 +7,7 @@ import { ITokenBlacklistService } from './base/token-blacklist-service';
7
7
  type Storer = {
8
8
  get: (name: string) => Promise<Model>;
9
9
  };
10
- type AuthManagerOptions = {
10
+ export type AuthManagerOptions = {
11
11
  authKey: string;
12
12
  default?: string;
13
13
  jwt?: JwtOptions;
@@ -17,10 +17,10 @@ type AuthConfig = {
17
17
  title?: string;
18
18
  };
19
19
  export declare class AuthManager {
20
+ jwt: JwtService;
20
21
  protected options: AuthManagerOptions;
21
22
  protected authTypes: Registry<AuthConfig>;
22
23
  protected storer: Storer;
23
- jwt: JwtService;
24
24
  constructor(options: AuthManagerOptions);
25
25
  setStorer(storer: Storer): void;
26
26
  setTokenBlacklistService(service: ITokenBlacklistService): void;
@@ -24,11 +24,11 @@ module.exports = __toCommonJS(auth_manager_exports);
24
24
  var import_utils = require("@nocobase/utils");
25
25
  var import_jwt_service = require("./base/jwt-service");
26
26
  const _AuthManager = class _AuthManager {
27
+ jwt;
27
28
  options;
28
29
  authTypes = new import_utils.Registry();
29
30
  // authenticators collection manager.
30
31
  storer;
31
- jwt;
32
32
  constructor(options) {
33
33
  this.options = options;
34
34
  this.jwt = new import_jwt_service.JwtService(options.jwt);
@@ -14,6 +14,7 @@ export declare class BaseAuth extends Auth {
14
14
  get jwt(): JwtService;
15
15
  set user(user: Model);
16
16
  get user(): Model;
17
+ validateUsername(username: string): boolean;
17
18
  check(): Promise<any>;
18
19
  validate(): Promise<Model>;
19
20
  signIn(): Promise<{
package/lib/base/auth.js CHANGED
@@ -41,6 +41,9 @@ const _BaseAuth = class _BaseAuth extends import_auth.Auth {
41
41
  get user() {
42
42
  return this.ctx.state.currentUser;
43
43
  }
44
+ validateUsername(username) {
45
+ return /^[^@.<>"'/]{2,16}$/.test(username);
46
+ }
44
47
  async check() {
45
48
  const token = this.ctx.getBearerToken();
46
49
  if (!token) {
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@nocobase/auth",
3
- "version": "0.14.0-alpha.6",
3
+ "version": "0.14.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.14.0-alpha.6",
10
- "@nocobase/database": "0.14.0-alpha.6",
11
- "@nocobase/resourcer": "0.14.0-alpha.6",
12
- "@nocobase/utils": "0.14.0-alpha.6",
9
+ "@nocobase/actions": "0.14.0-alpha.8",
10
+ "@nocobase/database": "0.14.0-alpha.8",
11
+ "@nocobase/resourcer": "0.14.0-alpha.8",
12
+ "@nocobase/utils": "0.14.0-alpha.8",
13
13
  "@types/jsonwebtoken": "^8.5.8",
14
14
  "jsonwebtoken": "^8.5.1"
15
15
  },
@@ -18,5 +18,5 @@
18
18
  "url": "git+https://github.com/nocobase/nocobase.git",
19
19
  "directory": "packages/auth"
20
20
  },
21
- "gitHead": "7f2858222231c207030b57704a0bb6ebc98e4e45"
21
+ "gitHead": "59c82fef6e34707802b5841f5ec4d9b3b6b68abb"
22
22
  }