@webda/core 4.0.0-beta.3 → 4.0.0-beta.5
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/application/application.d.ts +31 -0
- package/lib/application/application.d.ts.map +1 -1
- package/lib/application/application.js +55 -2
- package/lib/application/application.js.map +1 -1
- package/lib/application/deployment.d.ts +93 -0
- package/lib/application/deployment.d.ts.map +1 -0
- package/lib/application/deployment.js +99 -0
- package/lib/application/deployment.js.map +1 -0
- package/lib/application/unpackedapplication.d.ts.map +1 -1
- package/lib/application/unpackedapplication.js +9 -1
- package/lib/application/unpackedapplication.js.map +1 -1
- package/lib/bin/cli.d.ts +36 -1
- package/lib/bin/cli.d.ts.map +1 -1
- package/lib/bin/cli.js +108 -2
- package/lib/bin/cli.js.map +1 -1
- package/lib/contexts/execution.js +1 -1
- package/lib/contexts/execution.js.map +1 -1
- package/lib/contexts/operationcontext.d.ts +3 -0
- package/lib/contexts/operationcontext.d.ts.map +1 -1
- package/lib/contexts/operationcontext.js +6 -3
- package/lib/contexts/operationcontext.js.map +1 -1
- package/lib/core/core.js +1 -1
- package/lib/core/core.js.map +1 -1
- package/lib/core/hooks.d.ts +22 -0
- package/lib/core/hooks.d.ts.map +1 -1
- package/lib/core/hooks.js +24 -0
- package/lib/core/hooks.js.map +1 -1
- package/lib/core/operations.d.ts.map +1 -1
- package/lib/core/operations.js +13 -11
- package/lib/core/operations.js.map +1 -1
- package/lib/deployers/deployer.d.ts +157 -0
- package/lib/deployers/deployer.d.ts.map +1 -0
- package/lib/deployers/deployer.js +81 -0
- package/lib/deployers/deployer.js.map +1 -0
- package/lib/deployers/git.d.ts +27 -0
- package/lib/deployers/git.d.ts.map +1 -0
- package/lib/deployers/git.js +66 -0
- package/lib/deployers/git.js.map +1 -0
- package/lib/deployers/packager.d.ts +85 -0
- package/lib/deployers/packager.d.ts.map +1 -0
- package/lib/deployers/packager.js +259 -0
- package/lib/deployers/packager.js.map +1 -0
- package/lib/index.d.ts +10 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +10 -4
- package/lib/index.js.map +1 -1
- package/lib/models/aclmodel.d.ts +32 -5
- package/lib/models/aclmodel.d.ts.map +1 -1
- package/lib/models/aclmodel.js +34 -9
- package/lib/models/aclmodel.js.map +1 -1
- package/lib/models/coremodel.model.d.ts.map +1 -1
- package/lib/models/coremodel.model.js.map +1 -1
- package/lib/models/decorator.d.ts +4 -0
- package/lib/models/decorator.d.ts.map +1 -1
- package/lib/models/decorator.js +4 -0
- package/lib/models/decorator.js.map +1 -1
- package/lib/models/deployment.d.ts +2 -21
- package/lib/models/deployment.d.ts.map +1 -1
- package/lib/models/encrypted.model.d.ts +46 -0
- package/lib/models/encrypted.model.d.ts.map +1 -0
- package/lib/models/encrypted.model.js +87 -0
- package/lib/models/encrypted.model.js.map +1 -0
- package/lib/models/ident.model.d.ts +103 -64
- package/lib/models/ident.model.d.ts.map +1 -1
- package/lib/models/ident.model.js +168 -76
- package/lib/models/ident.model.js.map +1 -1
- package/lib/models/ownermodel.model.d.ts +25 -3
- package/lib/models/ownermodel.model.d.ts.map +1 -1
- package/lib/models/ownermodel.model.js +46 -10
- package/lib/models/ownermodel.model.js.map +1 -1
- package/lib/models/password.model.d.ts +78 -0
- package/lib/models/password.model.d.ts.map +1 -0
- package/lib/models/password.model.js +171 -0
- package/lib/models/password.model.js.map +1 -0
- package/lib/models/permissions.d.ts +236 -0
- package/lib/models/permissions.d.ts.map +1 -0
- package/lib/models/permissions.js +495 -0
- package/lib/models/permissions.js.map +1 -0
- package/lib/models/refreshtoken.model.d.ts +30 -0
- package/lib/models/refreshtoken.model.d.ts.map +1 -0
- package/lib/models/refreshtoken.model.js +29 -0
- package/lib/models/refreshtoken.model.js.map +1 -0
- package/lib/models/registry.model.d.ts.map +1 -1
- package/lib/models/registry.model.js.map +1 -1
- package/lib/models/rolemodel.model.d.ts.map +1 -1
- package/lib/models/rolemodel.model.js +1 -2
- package/lib/models/rolemodel.model.js.map +1 -1
- package/lib/models/simpleuser.model.d.ts.map +1 -1
- package/lib/models/simpleuser.model.js +2 -1
- package/lib/models/simpleuser.model.js.map +1 -1
- package/lib/models/user.model.d.ts +33 -21
- package/lib/models/user.model.d.ts.map +1 -1
- package/lib/models/user.model.js +81 -26
- package/lib/models/user.model.js.map +1 -1
- package/lib/rest/restoperationstransport.service.d.ts.map +1 -1
- package/lib/rest/restoperationstransport.service.js +7 -5
- package/lib/rest/restoperationstransport.service.js.map +1 -1
- package/lib/services/audit.model.d.ts +2 -2
- package/lib/services/audit.model.d.ts.map +1 -1
- package/lib/services/audit.model.js +16 -6
- package/lib/services/audit.model.js.map +1 -1
- package/lib/services/binary.service.d.ts +42 -4
- package/lib/services/binary.service.d.ts.map +1 -1
- package/lib/services/binary.service.js +33 -13
- package/lib/services/binary.service.js.map +1 -1
- package/lib/services/domainservice.service.d.ts +111 -1
- package/lib/services/domainservice.service.d.ts.map +1 -1
- package/lib/services/domainservice.service.js +303 -50
- package/lib/services/domainservice.service.js.map +1 -1
- package/lib/services/iauthentication.d.ts +196 -3
- package/lib/services/iauthentication.d.ts.map +1 -1
- package/lib/services/servicecommands.d.ts.map +1 -1
- package/lib/services/servicecommands.js +17 -11
- package/lib/services/servicecommands.js.map +1 -1
- package/lib/services/token.service.d.ts +95 -0
- package/lib/services/token.service.d.ts.map +1 -0
- package/lib/services/token.service.js +182 -0
- package/lib/services/token.service.js.map +1 -0
- package/lib/session/manager.model.d.ts +16 -0
- package/lib/session/manager.model.d.ts.map +1 -1
- package/lib/session/manager.model.js +58 -1
- package/lib/session/manager.model.js.map +1 -1
- package/lib/session/session.d.ts +44 -1
- package/lib/session/session.d.ts.map +1 -1
- package/lib/session/session.js +51 -2
- package/lib/session/session.js.map +1 -1
- package/lib/stores/memory.service.d.ts.map +1 -1
- package/lib/stores/memory.service.js +4 -3
- package/lib/stores/memory.service.js.map +1 -1
- package/lib/templates/templates.d.ts +8 -0
- package/lib/templates/templates.d.ts.map +1 -1
- package/lib/templates/templates.js +10 -1
- package/lib/templates/templates.js.map +1 -1
- package/lib/test/behavior-fixture.model.d.ts +30 -0
- package/lib/test/behavior-fixture.model.d.ts.map +1 -0
- package/lib/test/behavior-fixture.model.js +63 -0
- package/lib/test/behavior-fixture.model.js.map +1 -0
- package/lib/test/legacyident.fixture.model.d.ts +98 -0
- package/lib/test/legacyident.fixture.model.d.ts.map +1 -0
- package/lib/test/legacyident.fixture.model.js +125 -0
- package/lib/test/legacyident.fixture.model.js.map +1 -0
- package/lib/test/objects.d.ts +2 -2
- package/lib/test/objects.d.ts.map +1 -1
- package/lib/test/objects.js +2 -2
- package/lib/test/objects.js.map +1 -1
- package/package.json +32 -11
- package/test/config-cached.json +2 -1
- package/test/config.json +3 -1
- package/test/my-cnf.json +1 -1
- package/webda.module.json +656 -390
- package/lib/services/authentication.service.d.ts +0 -442
- package/lib/services/authentication.service.d.ts.map +0 -1
- package/lib/services/authentication.service.js +0 -932
- package/lib/services/authentication.service.js.map +0 -1
- package/lib/services/oauth.d.ts +0 -250
- package/lib/services/oauth.d.ts.map +0 -1
- package/lib/services/oauth.js +0 -405
- package/lib/services/oauth.js.map +0 -1
|
@@ -1,442 +0,0 @@
|
|
|
1
|
-
import { Counter } from "../metrics/metrics.js";
|
|
2
|
-
import { Ident } from "../models/ident.model.js";
|
|
3
|
-
import type { User } from "../models/user.model.js";
|
|
4
|
-
import { Service } from "../services/service.js";
|
|
5
|
-
import type { OperationContext } from "../contexts/operationcontext.js";
|
|
6
|
-
import { type HttpMethodType } from "../contexts/httpcontext.js";
|
|
7
|
-
import type { CryptoService } from "./cryptoservice.service.js";
|
|
8
|
-
import type { Mailer } from "./mailer.service.js";
|
|
9
|
-
import { EventWithContext } from "../events/events.js";
|
|
10
|
-
import { ServiceParameters } from "./serviceparameters.js";
|
|
11
|
-
import { ServiceName } from "../core/hooks.js";
|
|
12
|
-
import { WebContext } from "../contexts/webcontext.js";
|
|
13
|
-
import type { ModelClass, Repository } from "@webda/models";
|
|
14
|
-
/**
|
|
15
|
-
* Emitted when the /me route is called
|
|
16
|
-
*/
|
|
17
|
-
export interface EventAuthenticationGetMe<T extends User = User> extends EventWithContext {
|
|
18
|
-
user: T;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Emitted when new user registered
|
|
22
|
-
*/
|
|
23
|
-
export interface EventAuthenticationRegister<T extends User = User> extends EventAuthenticationGetMe<T> {
|
|
24
|
-
data: any;
|
|
25
|
-
identId: string;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Emitted when user logout
|
|
29
|
-
*/
|
|
30
|
-
export interface EventAuthenticationLogout extends EventWithContext {
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Sent when a user update his password
|
|
34
|
-
*/
|
|
35
|
-
export interface EventAuthenticationPasswordUpdate<T extends User = User> extends EventAuthenticationGetMe<T> {
|
|
36
|
-
password: string;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Emitted when user login
|
|
40
|
-
*/
|
|
41
|
-
export interface EventAuthenticationLogin<T extends User = User> extends EventWithContext {
|
|
42
|
-
userId: string;
|
|
43
|
-
user?: T;
|
|
44
|
-
identId: string;
|
|
45
|
-
ident: Ident;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Export when a user failed to authenticate with his password
|
|
49
|
-
*/
|
|
50
|
-
export interface EventAuthenticationLoginFailed<T extends User = User> extends EventAuthenticationGetMe<T> {
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Implement a PasswordVerifier so you can implement
|
|
54
|
-
* your own rules
|
|
55
|
-
*/
|
|
56
|
-
export interface PasswordVerifier extends Service {
|
|
57
|
-
/**
|
|
58
|
-
* If the password is not valid, send a 400 exception or
|
|
59
|
-
* return false
|
|
60
|
-
*
|
|
61
|
-
* @param password to verify
|
|
62
|
-
* @param user to verify from
|
|
63
|
-
*/
|
|
64
|
-
validate(password: string, user?: User): Promise<boolean>;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Information required to reset a password
|
|
68
|
-
*/
|
|
69
|
-
export interface PasswordRecoveryInfos {
|
|
70
|
-
/**
|
|
71
|
-
* Links are short lived
|
|
72
|
-
*/
|
|
73
|
-
expire: number;
|
|
74
|
-
/**
|
|
75
|
-
* Generated token
|
|
76
|
-
*/
|
|
77
|
-
token: string;
|
|
78
|
-
/**
|
|
79
|
-
* Login to reset password fors
|
|
80
|
-
*/
|
|
81
|
-
login: string;
|
|
82
|
-
}
|
|
83
|
-
interface PasswordRecoveryBody extends PasswordRecoveryInfos {
|
|
84
|
-
/**
|
|
85
|
-
* Password to set
|
|
86
|
-
*/
|
|
87
|
-
password: string;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Login info
|
|
91
|
-
*
|
|
92
|
-
* If register = true, you can add many other information
|
|
93
|
-
*
|
|
94
|
-
* @SchemaAdditionalProperties
|
|
95
|
-
*/
|
|
96
|
-
interface LoginBody {
|
|
97
|
-
login: string;
|
|
98
|
-
register?: boolean;
|
|
99
|
-
token?: string;
|
|
100
|
-
email?: string;
|
|
101
|
-
password?: string;
|
|
102
|
-
}
|
|
103
|
-
/** Parameters for the Authentication service including identity, email, and password settings */
|
|
104
|
-
export declare class AuthenticationParameters extends ServiceParameters {
|
|
105
|
-
/**
|
|
106
|
-
* Idents store for authentication identifiers
|
|
107
|
-
*
|
|
108
|
-
* @default "Webda/Ident"
|
|
109
|
-
*/
|
|
110
|
-
identModel?: string;
|
|
111
|
-
/**
|
|
112
|
-
* User store for authentication users
|
|
113
|
-
*
|
|
114
|
-
* @default "Webda/User"
|
|
115
|
-
*/
|
|
116
|
-
userModel?: string;
|
|
117
|
-
/**
|
|
118
|
-
* @default "/auth"
|
|
119
|
-
*/
|
|
120
|
-
url?: string;
|
|
121
|
-
/**
|
|
122
|
-
* Enable the email authentication
|
|
123
|
-
*/
|
|
124
|
-
email?: {
|
|
125
|
-
/**
|
|
126
|
-
* Mailer service name
|
|
127
|
-
*/
|
|
128
|
-
mailer?: ServiceName;
|
|
129
|
-
/**
|
|
130
|
-
* Allow user to create their account without validating their email first
|
|
131
|
-
*/
|
|
132
|
-
postValidation: boolean;
|
|
133
|
-
/**
|
|
134
|
-
* Do not even validate the email at all
|
|
135
|
-
*/
|
|
136
|
-
skipEmailValidation: boolean;
|
|
137
|
-
/**
|
|
138
|
-
* Minimal delay between two password recovery or validation email
|
|
139
|
-
*
|
|
140
|
-
* @default 3600000 * 4
|
|
141
|
-
*/
|
|
142
|
-
delay: number;
|
|
143
|
-
/**
|
|
144
|
-
* When a delay is added between two attempt to authenticate
|
|
145
|
-
*
|
|
146
|
-
* @default 3
|
|
147
|
-
*/
|
|
148
|
-
failedLoginBeforeDelay: number;
|
|
149
|
-
};
|
|
150
|
-
password: {
|
|
151
|
-
/**
|
|
152
|
-
* Password verifier Service name
|
|
153
|
-
*/
|
|
154
|
-
verifier?: ServiceName;
|
|
155
|
-
/**
|
|
156
|
-
* Regexp that password must check
|
|
157
|
-
* @default "{8,}"
|
|
158
|
-
*/
|
|
159
|
-
regexp?: string;
|
|
160
|
-
};
|
|
161
|
-
/**
|
|
162
|
-
* Number of salt iteration for bcrypt.hashSync
|
|
163
|
-
*/
|
|
164
|
-
salt: string;
|
|
165
|
-
/**
|
|
166
|
-
* Redirect to this page when email validation failed
|
|
167
|
-
*/
|
|
168
|
-
failureRedirect: string;
|
|
169
|
-
/**
|
|
170
|
-
* Redirect to this page when email validation succeed
|
|
171
|
-
*/
|
|
172
|
-
successRedirect: string;
|
|
173
|
-
/**
|
|
174
|
-
* Redirect to this page once email is validate to finish the registration process
|
|
175
|
-
*/
|
|
176
|
-
registerRedirect: string;
|
|
177
|
-
/**
|
|
178
|
-
* Load parameters with defaults for authentication URLs, models, and password policy
|
|
179
|
-
* @param params - the service parameters
|
|
180
|
-
* @returns this for chaining
|
|
181
|
-
*/
|
|
182
|
-
load(params?: any): this;
|
|
183
|
-
}
|
|
184
|
-
export type AuthenticationEvents = {
|
|
185
|
-
"Authentication.GetMe": EventAuthenticationGetMe;
|
|
186
|
-
"Authentication.Register": EventAuthenticationRegister;
|
|
187
|
-
"Authentication.PasswordUpdate": EventAuthenticationPasswordUpdate;
|
|
188
|
-
"Authentication.Logout": EventAuthenticationLogout;
|
|
189
|
-
"Authentication.Login": EventAuthenticationLogin;
|
|
190
|
-
"Authentication.LoginFailed": EventAuthenticationLoginFailed;
|
|
191
|
-
"Authentication.PasswordCreate": EventAuthenticationPasswordUpdate;
|
|
192
|
-
};
|
|
193
|
-
/**
|
|
194
|
-
* This class is known as the Authentication module
|
|
195
|
-
* It handles OAuth for several providers for now (Facebook, Google, Amazon, GitHub and Twitter)
|
|
196
|
-
* It also handles email authentication with prevalidation or postvalidation of the email
|
|
197
|
-
*
|
|
198
|
-
* It requires two Store to work one `idents` and one `users`
|
|
199
|
-
*
|
|
200
|
-
* The parameters are
|
|
201
|
-
* ```
|
|
202
|
-
* providerName: {
|
|
203
|
-
* clientID: '...',
|
|
204
|
-
* clientSecret: '...',
|
|
205
|
-
* scope: ''
|
|
206
|
-
* },
|
|
207
|
-
* email: {
|
|
208
|
-
* postValidation: true|false // If postValidation=true, account created without email verification
|
|
209
|
-
* }
|
|
210
|
-
* url: 'url' // By default /auth
|
|
211
|
-
* ```
|
|
212
|
-
*
|
|
213
|
-
* Core authentication service handling login, registration, password recovery, and email validation
|
|
214
|
-
*
|
|
215
|
-
* @category CoreServices
|
|
216
|
-
* @WebdaModda
|
|
217
|
-
*/
|
|
218
|
-
declare class Authentication<T extends AuthenticationParameters = AuthenticationParameters, E extends AuthenticationEvents = AuthenticationEvents> extends Service<T, E> {
|
|
219
|
-
/**
|
|
220
|
-
* Ident model to use
|
|
221
|
-
*/
|
|
222
|
-
protected identModel: Repository<ModelClass<Ident>>;
|
|
223
|
-
/**
|
|
224
|
-
* User model to use
|
|
225
|
-
*/
|
|
226
|
-
protected userModel: Repository<ModelClass<User>>;
|
|
227
|
-
/**
|
|
228
|
-
* Used for hmac
|
|
229
|
-
*/
|
|
230
|
-
cryptoService: CryptoService;
|
|
231
|
-
/**
|
|
232
|
-
* Password verification system
|
|
233
|
-
*/
|
|
234
|
-
_passwordVerifier: PasswordVerifier;
|
|
235
|
-
/**
|
|
236
|
-
*
|
|
237
|
-
*/
|
|
238
|
-
providers: Set<string>;
|
|
239
|
-
metrics: {
|
|
240
|
-
login: Counter;
|
|
241
|
-
logout: Counter;
|
|
242
|
-
loginFailed?: Counter;
|
|
243
|
-
recovery?: Counter;
|
|
244
|
-
recovered?: Counter;
|
|
245
|
-
registration?: Counter;
|
|
246
|
-
};
|
|
247
|
-
/**
|
|
248
|
-
* Get user model
|
|
249
|
-
* @returns the result
|
|
250
|
-
*/
|
|
251
|
-
getUserModel(): Repository<ModelClass<User>>;
|
|
252
|
-
/**
|
|
253
|
-
* Get ident model
|
|
254
|
-
* @returns the result
|
|
255
|
-
*/
|
|
256
|
-
getIdentModel(): Repository<ModelClass<Ident>>;
|
|
257
|
-
/**
|
|
258
|
-
* @ignore
|
|
259
|
-
* Setup the default routes
|
|
260
|
-
*/
|
|
261
|
-
computeParameters(): void;
|
|
262
|
-
/**
|
|
263
|
-
* @override
|
|
264
|
-
*/
|
|
265
|
-
initMetrics(): void;
|
|
266
|
-
/**
|
|
267
|
-
* Add a provider to the oauth scheme
|
|
268
|
-
* @param name - the name to use
|
|
269
|
-
*/
|
|
270
|
-
addProvider(name: string): void;
|
|
271
|
-
/**
|
|
272
|
-
* Ensure email is enabled for all emails routes
|
|
273
|
-
* @override
|
|
274
|
-
*/
|
|
275
|
-
getUrl(url: string, methods: HttpMethodType[]): string;
|
|
276
|
-
/**
|
|
277
|
-
* Send or resend an email to validate the email address
|
|
278
|
-
*
|
|
279
|
-
* @param ctx - the operation context
|
|
280
|
-
* @throws 409 if ident is linked to someone else
|
|
281
|
-
* @throws 412 if the email is already validated
|
|
282
|
-
* @throws 429 if a validation email has been sent recently
|
|
283
|
-
*/
|
|
284
|
-
_sendEmailValidation(ctx: any): Promise<void>;
|
|
285
|
-
/**
|
|
286
|
-
* Return current user
|
|
287
|
-
* @param ctx - the operation context
|
|
288
|
-
*/
|
|
289
|
-
_getMe(ctx: OperationContext): Promise<void>;
|
|
290
|
-
/**
|
|
291
|
-
* Handle both list of available authentication
|
|
292
|
-
* and logout with method 'DELETE'
|
|
293
|
-
*
|
|
294
|
-
* @param ctx - the operation context
|
|
295
|
-
* @returns the result
|
|
296
|
-
*/
|
|
297
|
-
_listAuthentications(ctx: WebContext): Promise<void>;
|
|
298
|
-
/**
|
|
299
|
-
* Handle login via an identity provider, creating or linking the ident to a user
|
|
300
|
-
* @param ctx - the operation context
|
|
301
|
-
* @param provider - the provider name
|
|
302
|
-
* @param identId - the identity identifier
|
|
303
|
-
* @param profile - the user profile
|
|
304
|
-
* @param tokens - the authentication tokens
|
|
305
|
-
*/
|
|
306
|
-
onIdentLogin(ctx: WebContext, provider: string, identId: string, profile: any, tokens?: any): Promise<void>;
|
|
307
|
-
/**
|
|
308
|
-
* Create a new User with the link ident
|
|
309
|
-
* @param ident
|
|
310
|
-
*
|
|
311
|
-
async createUserWithIdent(provider: string, identId: string, profile: any = {}) {
|
|
312
|
-
if (await this.identModel.ref(`${identId}_${provider}`).exists()) {
|
|
313
|
-
throw new Error("Ident is already known");
|
|
314
|
-
}
|
|
315
|
-
const ctx = await this._webda.newWebContext(new HttpContext("fake", "GET", "/"));
|
|
316
|
-
// Pretend we logged in with the ident
|
|
317
|
-
await this.onIdentLogin(ctx, provider, identId, profile);
|
|
318
|
-
}
|
|
319
|
-
*/
|
|
320
|
-
/**
|
|
321
|
-
* Create and register a new user, emitting a registration event
|
|
322
|
-
* @param ctx - the operation context
|
|
323
|
-
* @param data - the data to process
|
|
324
|
-
* @param identId - the identity identifier
|
|
325
|
-
* @param user - the user object
|
|
326
|
-
* @returns the result
|
|
327
|
-
*/
|
|
328
|
-
registerUser(ctx: WebContext, data: any, identId: string, user?: User): Promise<User>;
|
|
329
|
-
/**
|
|
330
|
-
* Generate password recovery info (token and expiry) for a user
|
|
331
|
-
* @param uuid - the unique identifier
|
|
332
|
-
* @param interval - the interval
|
|
333
|
-
* @returns the result
|
|
334
|
-
*/
|
|
335
|
-
getPasswordRecoveryInfos(uuid: string | User, interval?: number): Promise<PasswordRecoveryInfos>;
|
|
336
|
-
/**
|
|
337
|
-
* Manage password recovery
|
|
338
|
-
* @param ctx - the operation context
|
|
339
|
-
*/
|
|
340
|
-
_passwordRecoveryEmail(ctx: WebContext): Promise<void>;
|
|
341
|
-
/**
|
|
342
|
-
* Verify that a password meets the configured policy or custom verifier
|
|
343
|
-
* @param password - the password
|
|
344
|
-
* @param user - the user object
|
|
345
|
-
*/
|
|
346
|
-
_verifyPassword(password: string, user?: User): Promise<void>;
|
|
347
|
-
/**
|
|
348
|
-
* Handle password recovery: verify token and update the user's password
|
|
349
|
-
* @param ctx - the operation context
|
|
350
|
-
*/
|
|
351
|
-
_passwordRecovery(ctx: WebContext<PasswordRecoveryBody>): Promise<void>;
|
|
352
|
-
/**
|
|
353
|
-
* Callback to validate an email address
|
|
354
|
-
* @param ctx - the operation context
|
|
355
|
-
* @returns the result
|
|
356
|
-
*/
|
|
357
|
-
_handleEmailCallback(ctx: WebContext): Promise<void>;
|
|
358
|
-
/**
|
|
359
|
-
* Send an email to recover the user password
|
|
360
|
-
*
|
|
361
|
-
* @param ctx - the operation context
|
|
362
|
-
* @param user - the user object
|
|
363
|
-
* @param email - the email address
|
|
364
|
-
* @returns the result
|
|
365
|
-
*/
|
|
366
|
-
sendRecoveryEmail(ctx: WebContext, user: any, email: string): Promise<any>;
|
|
367
|
-
/**
|
|
368
|
-
* Send an email to validate the user email by sending a unique link to
|
|
369
|
-
* his email
|
|
370
|
-
*
|
|
371
|
-
* @param ctx - the operation context
|
|
372
|
-
* @param email - the email address
|
|
373
|
-
* @returns the result
|
|
374
|
-
*/
|
|
375
|
-
sendValidationEmail(ctx: WebContext, email: string): Promise<any>;
|
|
376
|
-
/**
|
|
377
|
-
* Check the password match the stored hash
|
|
378
|
-
* @param hash generate prior by hashPassword
|
|
379
|
-
* @param password as entered by the user
|
|
380
|
-
* @param pass - the password
|
|
381
|
-
* @returns true if the condition is met
|
|
382
|
-
*/
|
|
383
|
-
checkPassword(hash?: string, pass?: string): boolean;
|
|
384
|
-
/**
|
|
385
|
-
* Hash the password according to good practices
|
|
386
|
-
*
|
|
387
|
-
* @param pass to hash
|
|
388
|
-
* @returns the result string
|
|
389
|
-
*/
|
|
390
|
-
hashPassword(pass: string): string;
|
|
391
|
-
/**
|
|
392
|
-
* Logout user
|
|
393
|
-
* @param ctx - the operation context
|
|
394
|
-
*/
|
|
395
|
-
logout(ctx: WebContext): Promise<void>;
|
|
396
|
-
/**
|
|
397
|
-
* Login a user
|
|
398
|
-
*
|
|
399
|
-
* @param ctx - the operation context
|
|
400
|
-
* @param user - the user object
|
|
401
|
-
* @param ident - the identity object
|
|
402
|
-
* @param provider - the provider name
|
|
403
|
-
* @returns the result
|
|
404
|
-
*/
|
|
405
|
-
login(ctx: WebContext, user: User | string, ident: Ident, provider: string): Promise<void>;
|
|
406
|
-
/**
|
|
407
|
-
* Get the mailer service
|
|
408
|
-
* @returns the result
|
|
409
|
-
*/
|
|
410
|
-
getMailMan(): Mailer;
|
|
411
|
-
/**
|
|
412
|
-
* Handle a user login request
|
|
413
|
-
*
|
|
414
|
-
* @param ctx - the operation context
|
|
415
|
-
* @param ident - the identity object
|
|
416
|
-
*/
|
|
417
|
-
protected handleLogin(ctx: WebContext<LoginBody>, ident: Ident): Promise<void>;
|
|
418
|
-
/**
|
|
419
|
-
* Handle the POST /auth/email
|
|
420
|
-
*
|
|
421
|
-
* @param ctx - the operation context
|
|
422
|
-
* @returns the result
|
|
423
|
-
*/
|
|
424
|
-
_handleEmail(ctx: WebContext<LoginBody>): Promise<any>;
|
|
425
|
-
/**
|
|
426
|
-
* Generate an HMAC-based token for email address validation
|
|
427
|
-
* @param user - the user object
|
|
428
|
-
* @param email - the email address
|
|
429
|
-
* @returns the result string
|
|
430
|
-
*/
|
|
431
|
-
generateEmailValidationToken(user: string, email: string): Promise<string>;
|
|
432
|
-
/**
|
|
433
|
-
* Create a new User with the link ident
|
|
434
|
-
* @param ident - the identity object
|
|
435
|
-
* @param provider - the provider name
|
|
436
|
-
* @param identId - the identity identifier
|
|
437
|
-
* @param profile - the user profile
|
|
438
|
-
*/
|
|
439
|
-
createUserWithIdent(provider: string, identId: string, profile?: any): Promise<void>;
|
|
440
|
-
}
|
|
441
|
-
export { Authentication };
|
|
442
|
-
//# sourceMappingURL=authentication.service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.service.d.ts","sourceRoot":"","sources":["../../src/services/authentication.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAU,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAkC,WAAW,EAAqB,MAAM,kBAAkB,CAAC;AAClG,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,wBAAwB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