@feathersjs/authentication 5.0.0-pre.29 → 5.0.0-pre.30
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/CHANGELOG.md +179 -432
- package/lib/options.d.ts +2 -117
- package/lib/options.js +2 -107
- package/lib/options.js.map +1 -1
- package/lib/service.js.map +1 -1
- package/package.json +13 -13
- package/src/options.ts +2 -111
- package/src/service.ts +1 -0
package/lib/options.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FromSchema } from '@feathersjs/schema';
|
|
1
|
+
import { FromSchema, authenticationSettingsSchema } from '@feathersjs/schema';
|
|
2
2
|
export declare const defaultOptions: {
|
|
3
3
|
authStrategies: string[];
|
|
4
4
|
jwtOptions: {
|
|
@@ -11,120 +11,5 @@ export declare const defaultOptions: {
|
|
|
11
11
|
expiresIn: string;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
-
export
|
|
15
|
-
readonly type: "object";
|
|
16
|
-
readonly required: readonly ["secret", "entity", "authStrategies"];
|
|
17
|
-
readonly properties: {
|
|
18
|
-
readonly secret: {
|
|
19
|
-
readonly type: "string";
|
|
20
|
-
readonly description: "The JWT signing secret";
|
|
21
|
-
};
|
|
22
|
-
readonly entity: {
|
|
23
|
-
readonly oneOf: readonly [{
|
|
24
|
-
readonly type: "null";
|
|
25
|
-
}, {
|
|
26
|
-
readonly type: "string";
|
|
27
|
-
}];
|
|
28
|
-
readonly description: "The name of the authentication entity (e.g. user)";
|
|
29
|
-
};
|
|
30
|
-
readonly entityId: {
|
|
31
|
-
readonly type: "string";
|
|
32
|
-
readonly description: "The name of the authentication entity id property";
|
|
33
|
-
};
|
|
34
|
-
readonly service: {
|
|
35
|
-
readonly type: "string";
|
|
36
|
-
readonly description: "The path of the entity service";
|
|
37
|
-
};
|
|
38
|
-
readonly authStrategies: {
|
|
39
|
-
readonly type: "array";
|
|
40
|
-
readonly items: {
|
|
41
|
-
readonly type: "string";
|
|
42
|
-
};
|
|
43
|
-
readonly description: "A list of authentication strategy names that are allowed to create JWT access tokens";
|
|
44
|
-
};
|
|
45
|
-
readonly parseStrategies: {
|
|
46
|
-
readonly type: "array";
|
|
47
|
-
readonly items: {
|
|
48
|
-
readonly type: "string";
|
|
49
|
-
};
|
|
50
|
-
readonly description: "A list of authentication strategy names that should parse HTTP headers for authentication information (defaults to `authStrategies`)";
|
|
51
|
-
};
|
|
52
|
-
readonly jwtOptions: {
|
|
53
|
-
readonly type: "object";
|
|
54
|
-
};
|
|
55
|
-
readonly jwt: {
|
|
56
|
-
readonly type: "object";
|
|
57
|
-
readonly properties: {
|
|
58
|
-
readonly header: {
|
|
59
|
-
readonly type: "string";
|
|
60
|
-
readonly default: "Authorization";
|
|
61
|
-
readonly description: "The HTTP header containing the JWT";
|
|
62
|
-
};
|
|
63
|
-
readonly schemes: {
|
|
64
|
-
readonly type: "array";
|
|
65
|
-
readonly items: {
|
|
66
|
-
readonly type: "string";
|
|
67
|
-
};
|
|
68
|
-
readonly description: "An array of schemes to support";
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
readonly local: {
|
|
73
|
-
readonly type: "object";
|
|
74
|
-
readonly required: readonly ["usernameField", "passwordField"];
|
|
75
|
-
readonly properties: {
|
|
76
|
-
readonly usernameField: {
|
|
77
|
-
readonly type: "string";
|
|
78
|
-
readonly description: "Name of the username field (e.g. `email`)";
|
|
79
|
-
};
|
|
80
|
-
readonly passwordField: {
|
|
81
|
-
readonly type: "string";
|
|
82
|
-
readonly description: "Name of the password field (e.g. `password`)";
|
|
83
|
-
};
|
|
84
|
-
readonly hashSize: {
|
|
85
|
-
readonly type: "number";
|
|
86
|
-
readonly description: "The BCrypt salt length";
|
|
87
|
-
};
|
|
88
|
-
readonly errorMessage: {
|
|
89
|
-
readonly type: "string";
|
|
90
|
-
readonly default: "Invalid login";
|
|
91
|
-
readonly description: "The error message to return on errors";
|
|
92
|
-
};
|
|
93
|
-
readonly entityUsernameField: {
|
|
94
|
-
readonly type: "string";
|
|
95
|
-
readonly description: "Name of the username field on the entity if authentication request data and entity field names are different";
|
|
96
|
-
};
|
|
97
|
-
readonly entityPasswordField: {
|
|
98
|
-
readonly type: "string";
|
|
99
|
-
readonly description: "Name of the password field on the entity if authentication request data and entity field names are different";
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
readonly oauth: {
|
|
104
|
-
readonly type: "object";
|
|
105
|
-
readonly properties: {
|
|
106
|
-
readonly redirect: {
|
|
107
|
-
readonly type: "string";
|
|
108
|
-
};
|
|
109
|
-
readonly origins: {
|
|
110
|
-
readonly type: "array";
|
|
111
|
-
readonly items: {
|
|
112
|
-
readonly type: "string";
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
|
-
readonly defaults: {
|
|
116
|
-
readonly type: "object";
|
|
117
|
-
readonly properties: {
|
|
118
|
-
readonly key: {
|
|
119
|
-
readonly type: "string";
|
|
120
|
-
};
|
|
121
|
-
readonly secret: {
|
|
122
|
-
readonly type: "string";
|
|
123
|
-
};
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
|
-
};
|
|
14
|
+
export { authenticationSettingsSchema };
|
|
130
15
|
export declare type AuthenticationConfiguration = FromSchema<typeof authenticationSettingsSchema>;
|
package/lib/options.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.authenticationSettingsSchema = exports.defaultOptions = void 0;
|
|
4
|
+
const schema_1 = require("@feathersjs/schema");
|
|
5
|
+
Object.defineProperty(exports, "authenticationSettingsSchema", { enumerable: true, get: function () { return schema_1.authenticationSettingsSchema; } });
|
|
4
6
|
exports.defaultOptions = {
|
|
5
7
|
authStrategies: [],
|
|
6
8
|
jwtOptions: {
|
|
@@ -11,111 +13,4 @@ exports.defaultOptions = {
|
|
|
11
13
|
expiresIn: '1d'
|
|
12
14
|
}
|
|
13
15
|
};
|
|
14
|
-
exports.authenticationSettingsSchema = {
|
|
15
|
-
type: 'object',
|
|
16
|
-
required: ['secret', 'entity', 'authStrategies'],
|
|
17
|
-
properties: {
|
|
18
|
-
secret: {
|
|
19
|
-
type: 'string',
|
|
20
|
-
description: 'The JWT signing secret'
|
|
21
|
-
},
|
|
22
|
-
entity: {
|
|
23
|
-
oneOf: [
|
|
24
|
-
{
|
|
25
|
-
type: 'null'
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
type: 'string'
|
|
29
|
-
}
|
|
30
|
-
],
|
|
31
|
-
description: 'The name of the authentication entity (e.g. user)'
|
|
32
|
-
},
|
|
33
|
-
entityId: {
|
|
34
|
-
type: 'string',
|
|
35
|
-
description: 'The name of the authentication entity id property'
|
|
36
|
-
},
|
|
37
|
-
service: {
|
|
38
|
-
type: 'string',
|
|
39
|
-
description: 'The path of the entity service'
|
|
40
|
-
},
|
|
41
|
-
authStrategies: {
|
|
42
|
-
type: 'array',
|
|
43
|
-
items: { type: 'string' },
|
|
44
|
-
description: 'A list of authentication strategy names that are allowed to create JWT access tokens'
|
|
45
|
-
},
|
|
46
|
-
parseStrategies: {
|
|
47
|
-
type: 'array',
|
|
48
|
-
items: { type: 'string' },
|
|
49
|
-
description: 'A list of authentication strategy names that should parse HTTP headers for authentication information (defaults to `authStrategies`)'
|
|
50
|
-
},
|
|
51
|
-
jwtOptions: {
|
|
52
|
-
type: 'object'
|
|
53
|
-
},
|
|
54
|
-
jwt: {
|
|
55
|
-
type: 'object',
|
|
56
|
-
properties: {
|
|
57
|
-
header: {
|
|
58
|
-
type: 'string',
|
|
59
|
-
default: 'Authorization',
|
|
60
|
-
description: 'The HTTP header containing the JWT'
|
|
61
|
-
},
|
|
62
|
-
schemes: {
|
|
63
|
-
type: 'array',
|
|
64
|
-
items: { type: 'string' },
|
|
65
|
-
description: 'An array of schemes to support'
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
local: {
|
|
70
|
-
type: 'object',
|
|
71
|
-
required: ['usernameField', 'passwordField'],
|
|
72
|
-
properties: {
|
|
73
|
-
usernameField: {
|
|
74
|
-
type: 'string',
|
|
75
|
-
description: 'Name of the username field (e.g. `email`)'
|
|
76
|
-
},
|
|
77
|
-
passwordField: {
|
|
78
|
-
type: 'string',
|
|
79
|
-
description: 'Name of the password field (e.g. `password`)'
|
|
80
|
-
},
|
|
81
|
-
hashSize: {
|
|
82
|
-
type: 'number',
|
|
83
|
-
description: 'The BCrypt salt length'
|
|
84
|
-
},
|
|
85
|
-
errorMessage: {
|
|
86
|
-
type: 'string',
|
|
87
|
-
default: 'Invalid login',
|
|
88
|
-
description: 'The error message to return on errors'
|
|
89
|
-
},
|
|
90
|
-
entityUsernameField: {
|
|
91
|
-
type: 'string',
|
|
92
|
-
description: 'Name of the username field on the entity if authentication request data and entity field names are different'
|
|
93
|
-
},
|
|
94
|
-
entityPasswordField: {
|
|
95
|
-
type: 'string',
|
|
96
|
-
description: 'Name of the password field on the entity if authentication request data and entity field names are different'
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
oauth: {
|
|
101
|
-
type: 'object',
|
|
102
|
-
properties: {
|
|
103
|
-
redirect: {
|
|
104
|
-
type: 'string'
|
|
105
|
-
},
|
|
106
|
-
origins: {
|
|
107
|
-
type: 'array',
|
|
108
|
-
items: { type: 'string' }
|
|
109
|
-
},
|
|
110
|
-
defaults: {
|
|
111
|
-
type: 'object',
|
|
112
|
-
properties: {
|
|
113
|
-
key: { type: 'string' },
|
|
114
|
-
secret: { type: 'string' }
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
16
|
//# sourceMappingURL=options.js.map
|
package/lib/options.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":";;;AAAA,+CAA6E;AAapE,6GAbY,qCAA4B,OAaZ;AAXxB,QAAA,cAAc,GAAG;IAC5B,cAAc,EAAE,EAAc;IAC9B,UAAU,EAAE;QACV,MAAM,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE;QACzB,QAAQ,EAAE,wBAAwB;QAClC,MAAM,EAAE,UAAU;QAClB,SAAS,EAAE,OAAO;QAClB,SAAS,EAAE,IAAI;KAChB;CACF,CAAA"}
|
package/lib/service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAgC;AAChC,+CAAqD;AACrD,iCAA8G;AAC9G,mCAA2C;AAC3C,yCAAsC;AACtC,iDAAiD;AAEjD,+CAAoD;AACpD,gEAAuC;AAEvC,MAAM,KAAK,GAAG,IAAA,qBAAW,EAAC,oCAAoC,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAgC;AAChC,+CAAqD;AACrD,iCAA8G;AAC9G,mCAA2C;AAC3C,yCAAsC;AACtC,iDAAiD;AAEjD,+CAAoD;AACpD,gEAAuC;AAEvC,MAAM,KAAK,GAAG,IAAA,qBAAW,EAAC,oCAAoC,CAAC,CAAA;AAwB/D,MAAa,qBACX,SAAQ,yBAAkB;IAG1B,YAAY,GAAQ,EAAE,SAAS,GAAG,gBAAgB,EAAE,OAAO,GAAG,EAAE;QAC9D,KAAK,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;QAE9B,IAAI,OAAO,GAAG,CAAC,qBAAqB,KAAK,UAAU,EAAE;YACnD,GAAG,CAAC,qBAAqB,GAAG,UAAU,QAAiB;gBACrD,MA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E,EAAE,IAAA,kBAAU,EAAC,OAAO,CAAC,EAAE,IAAA,aAAK,EAAC,OAAO,CAAC,CAAC;YAChE,MAAM,EAAE,CAAC,IAAA,wBAAe,GAAE,EAAE,IAAA,kBAAU,EAAC,QAAQ,CAAC,EAAE,IAAA,aAAK,EAAC,QAAQ,CAAC,CAAC;SAC5D,CAAC,CAAA;QAET,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE;YAC7C,MAAM,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,UAAU,CAAC,CAAA;QACvD,CAAC,CAAC,CAAA;QAEF,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,UAAU,EAAE;YACtC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAA;SACzB;IACH,CAAC;CACF;AAtKD,sDAsKC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feathersjs/authentication",
|
|
3
3
|
"description": "Add Authentication to your FeathersJS app.",
|
|
4
|
-
"version": "5.0.0-pre.
|
|
4
|
+
"version": "5.0.0-pre.30",
|
|
5
5
|
"homepage": "https://feathersjs.com",
|
|
6
6
|
"main": "lib/",
|
|
7
7
|
"types": "lib/",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"prepublish": "npm run compile",
|
|
45
|
-
"pack": "npm pack --pack-destination ../cli/test",
|
|
45
|
+
"pack": "npm pack --pack-destination ../cli/test/build",
|
|
46
46
|
"compile": "shx rm -rf lib/ && tsc && npm run pack",
|
|
47
47
|
"test": "mocha --config ../../.mocharc.json --recursive test/**.test.ts test/**/*.test.ts"
|
|
48
48
|
},
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
"access": "public"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@feathersjs/commons": "^5.0.0-pre.
|
|
57
|
-
"@feathersjs/errors": "^5.0.0-pre.
|
|
58
|
-
"@feathersjs/feathers": "^5.0.0-pre.
|
|
59
|
-
"@feathersjs/schema": "^5.0.0-pre.
|
|
60
|
-
"@feathersjs/transport-commons": "^5.0.0-pre.
|
|
56
|
+
"@feathersjs/commons": "^5.0.0-pre.30",
|
|
57
|
+
"@feathersjs/errors": "^5.0.0-pre.30",
|
|
58
|
+
"@feathersjs/feathers": "^5.0.0-pre.30",
|
|
59
|
+
"@feathersjs/schema": "^5.0.0-pre.30",
|
|
60
|
+
"@feathersjs/transport-commons": "^5.0.0-pre.30",
|
|
61
61
|
"@types/jsonwebtoken": "^8.5.9",
|
|
62
62
|
"jsonwebtoken": "^8.5.1",
|
|
63
63
|
"lodash": "^4.17.21",
|
|
@@ -65,15 +65,15 @@
|
|
|
65
65
|
"uuid": "^9.0.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@feathersjs/memory": "^5.0.0-pre.
|
|
69
|
-
"@types/lodash": "^4.14.
|
|
70
|
-
"@types/mocha": "^
|
|
71
|
-
"@types/node": "^18.
|
|
68
|
+
"@feathersjs/memory": "^5.0.0-pre.30",
|
|
69
|
+
"@types/lodash": "^4.14.186",
|
|
70
|
+
"@types/mocha": "^10.0.0",
|
|
71
|
+
"@types/node": "^18.8.2",
|
|
72
72
|
"@types/uuid": "^8.3.4",
|
|
73
73
|
"mocha": "^10.0.0",
|
|
74
74
|
"shx": "^0.3.4",
|
|
75
75
|
"ts-node": "^10.9.1",
|
|
76
|
-
"typescript": "^4.8.
|
|
76
|
+
"typescript": "^4.8.4"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "b535c91197f4b997520e0a0e608793eeba791931"
|
|
79
79
|
}
|
package/src/options.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FromSchema } from '@feathersjs/schema'
|
|
1
|
+
import { FromSchema, authenticationSettingsSchema } from '@feathersjs/schema'
|
|
2
2
|
|
|
3
3
|
export const defaultOptions = {
|
|
4
4
|
authStrategies: [] as string[],
|
|
@@ -11,115 +11,6 @@ export const defaultOptions = {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export
|
|
15
|
-
type: 'object',
|
|
16
|
-
required: ['secret', 'entity', 'authStrategies'],
|
|
17
|
-
properties: {
|
|
18
|
-
secret: {
|
|
19
|
-
type: 'string',
|
|
20
|
-
description: 'The JWT signing secret'
|
|
21
|
-
},
|
|
22
|
-
entity: {
|
|
23
|
-
oneOf: [
|
|
24
|
-
{
|
|
25
|
-
type: 'null'
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
type: 'string'
|
|
29
|
-
}
|
|
30
|
-
],
|
|
31
|
-
description: 'The name of the authentication entity (e.g. user)'
|
|
32
|
-
},
|
|
33
|
-
entityId: {
|
|
34
|
-
type: 'string',
|
|
35
|
-
description: 'The name of the authentication entity id property'
|
|
36
|
-
},
|
|
37
|
-
service: {
|
|
38
|
-
type: 'string',
|
|
39
|
-
description: 'The path of the entity service'
|
|
40
|
-
},
|
|
41
|
-
authStrategies: {
|
|
42
|
-
type: 'array',
|
|
43
|
-
items: { type: 'string' },
|
|
44
|
-
description: 'A list of authentication strategy names that are allowed to create JWT access tokens'
|
|
45
|
-
},
|
|
46
|
-
parseStrategies: {
|
|
47
|
-
type: 'array',
|
|
48
|
-
items: { type: 'string' },
|
|
49
|
-
description:
|
|
50
|
-
'A list of authentication strategy names that should parse HTTP headers for authentication information (defaults to `authStrategies`)'
|
|
51
|
-
},
|
|
52
|
-
jwtOptions: {
|
|
53
|
-
type: 'object'
|
|
54
|
-
},
|
|
55
|
-
jwt: {
|
|
56
|
-
type: 'object',
|
|
57
|
-
properties: {
|
|
58
|
-
header: {
|
|
59
|
-
type: 'string',
|
|
60
|
-
default: 'Authorization',
|
|
61
|
-
description: 'The HTTP header containing the JWT'
|
|
62
|
-
},
|
|
63
|
-
schemes: {
|
|
64
|
-
type: 'array',
|
|
65
|
-
items: { type: 'string' },
|
|
66
|
-
description: 'An array of schemes to support'
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
local: {
|
|
71
|
-
type: 'object',
|
|
72
|
-
required: ['usernameField', 'passwordField'],
|
|
73
|
-
properties: {
|
|
74
|
-
usernameField: {
|
|
75
|
-
type: 'string',
|
|
76
|
-
description: 'Name of the username field (e.g. `email`)'
|
|
77
|
-
},
|
|
78
|
-
passwordField: {
|
|
79
|
-
type: 'string',
|
|
80
|
-
description: 'Name of the password field (e.g. `password`)'
|
|
81
|
-
},
|
|
82
|
-
hashSize: {
|
|
83
|
-
type: 'number',
|
|
84
|
-
description: 'The BCrypt salt length'
|
|
85
|
-
},
|
|
86
|
-
errorMessage: {
|
|
87
|
-
type: 'string',
|
|
88
|
-
default: 'Invalid login',
|
|
89
|
-
description: 'The error message to return on errors'
|
|
90
|
-
},
|
|
91
|
-
entityUsernameField: {
|
|
92
|
-
type: 'string',
|
|
93
|
-
description:
|
|
94
|
-
'Name of the username field on the entity if authentication request data and entity field names are different'
|
|
95
|
-
},
|
|
96
|
-
entityPasswordField: {
|
|
97
|
-
type: 'string',
|
|
98
|
-
description:
|
|
99
|
-
'Name of the password field on the entity if authentication request data and entity field names are different'
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
oauth: {
|
|
104
|
-
type: 'object',
|
|
105
|
-
properties: {
|
|
106
|
-
redirect: {
|
|
107
|
-
type: 'string'
|
|
108
|
-
},
|
|
109
|
-
origins: {
|
|
110
|
-
type: 'array',
|
|
111
|
-
items: { type: 'string' }
|
|
112
|
-
},
|
|
113
|
-
defaults: {
|
|
114
|
-
type: 'object',
|
|
115
|
-
properties: {
|
|
116
|
-
key: { type: 'string' },
|
|
117
|
-
secret: { type: 'string' }
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
} as const
|
|
14
|
+
export { authenticationSettingsSchema }
|
|
124
15
|
|
|
125
16
|
export type AuthenticationConfiguration = FromSchema<typeof authenticationSettingsSchema>
|
package/src/service.ts
CHANGED
|
@@ -11,6 +11,7 @@ import jsonwebtoken from 'jsonwebtoken'
|
|
|
11
11
|
const debug = createDebug('@feathersjs/authentication/service')
|
|
12
12
|
|
|
13
13
|
declare module '@feathersjs/feathers/lib/declarations' {
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14
15
|
interface FeathersApplication<Services, Settings> {
|
|
15
16
|
// eslint-disable-line
|
|
16
17
|
/**
|