@liquid-js/lyr-firebase-auth 0.0.0-stage → 22.0.0-alpha.0
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/LICENSE.txt
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Akveo.
|
|
4
|
+
Copyright (c) 2026 Liquid-JS and contributors.
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
23
|
+
|
package/README.md
CHANGED
|
@@ -1,3 +1,43 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Lyra Firebase Auth
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/Liquid-JS/lyra/blob/master/LICENSE.txt)
|
|
4
|
+
[](https://www.npmjs.com/package/@liquid-js/lyr-firebase-auth)
|
|
5
|
+
[](https://www.npmjs.com/package/@liquid-js/lyr-firebase-auth)
|
|
6
|
+
|
|
7
|
+
Firebase authentication strategies for Lyra Auth: email and password, Google, Facebook and Twitter.
|
|
8
|
+
|
|
9
|
+
## Quick links
|
|
10
|
+
|
|
11
|
+
- [Firebase authentication](https://liquid-js.github.io/lyra/extras/auth/firebase-authentication/)
|
|
12
|
+
- [Lyra Auth](https://liquid-js.github.io/lyra/extras/auth/introduction/)
|
|
13
|
+
|
|
14
|
+
### Installing
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npm install --save @liquid-js/lyr-auth @liquid-js/lyr-firebase-auth
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The app provides the Firebase app and its Auth instance with [AngularFire](https://github.com/angular/angularfire).
|
|
21
|
+
|
|
22
|
+
### Provide a strategy
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { provideNbAuth } from '@liquid-js/lyr-auth'
|
|
26
|
+
import { NbFirebasePasswordStrategy, provideNbFirebaseAuth } from '@liquid-js/lyr-firebase-auth'
|
|
27
|
+
|
|
28
|
+
bootstrapApplication(AppComponent, {
|
|
29
|
+
providers: [
|
|
30
|
+
provideFirebaseApp(() => initializeApp(firebaseConfig)),
|
|
31
|
+
provideAuth(() => getAuth()),
|
|
32
|
+
provideNbFirebaseAuth(),
|
|
33
|
+
provideNbAuth({
|
|
34
|
+
strategies: [
|
|
35
|
+
NbFirebasePasswordStrategy.setup({
|
|
36
|
+
name: 'password'
|
|
37
|
+
})
|
|
38
|
+
],
|
|
39
|
+
forms: {}
|
|
40
|
+
})
|
|
41
|
+
]
|
|
42
|
+
})
|
|
43
|
+
```
|
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { NgModule, Service, inject, makeEnvironmentProviders } from "@angular/core";
|
|
3
|
+
import { Auth } from "@angular/fire/auth";
|
|
4
|
+
import { FacebookAuthProvider, GoogleAuthProvider, TwitterAuthProvider, confirmPasswordReset, createUserWithEmailAndPassword, sendPasswordResetEmail, signInWithEmailAndPassword, signInWithPopup, signOut, updatePassword } from "firebase/auth";
|
|
5
|
+
import { from, of } from "rxjs";
|
|
6
|
+
import { catchError, map, switchMap } from "rxjs/operators";
|
|
7
|
+
import { NbAuthIllegalTokenError, NbAuthJWTToken, NbAuthResult, NbAuthStrategy, NbAuthStrategyOptions, getDeepFromObject, nbAuthMessages } from "@liquid-js/lyr-auth";
|
|
8
|
+
import { ActivatedRoute } from "@angular/router";
|
|
9
|
+
function isModuleOptions(value) {
|
|
10
|
+
return typeof value === "object" && value !== null;
|
|
11
|
+
}
|
|
12
|
+
var NbFirebaseBaseStrategy = class NbFirebaseBaseStrategy extends NbAuthStrategy {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.auth = inject(Auth);
|
|
16
|
+
}
|
|
17
|
+
logout() {
|
|
18
|
+
const module = "logout";
|
|
19
|
+
return from(signOut(this.auth)).pipe(map(() => {
|
|
20
|
+
const options = this.moduleOptions(module);
|
|
21
|
+
return new NbAuthResult(true, void 0, options.redirect?.success, [], options.defaultMessages);
|
|
22
|
+
}), catchError((error) => this.processFailure(error, module)));
|
|
23
|
+
}
|
|
24
|
+
register(_data) {
|
|
25
|
+
throw new Error(`'register' is not supported by '${this.constructor.name}', use 'authenticate'.`);
|
|
26
|
+
}
|
|
27
|
+
requestPassword(_data) {
|
|
28
|
+
throw new Error(`'requestPassword' is not supported by '${this.constructor.name}', use 'authenticate'.`);
|
|
29
|
+
}
|
|
30
|
+
resetPassword(_data) {
|
|
31
|
+
throw new Error(`'resetPassword' is not supported by '${this.constructor.name}', use 'authenticate'.`);
|
|
32
|
+
}
|
|
33
|
+
refreshToken(_data) {
|
|
34
|
+
const module = "refreshToken";
|
|
35
|
+
return from(this.auth.authStateReady()).pipe(map(() => this.auth.currentUser), switchMap((user) => {
|
|
36
|
+
if (user == null) return of(new NbAuthResult(false, void 0, this.moduleOptions(module).redirect?.failure, ["There is no logged in user so refresh of id token isn't possible"]));
|
|
37
|
+
return this.refreshIdToken(user, module);
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
moduleOptions(module) {
|
|
41
|
+
const options = getDeepFromObject(this.options, module);
|
|
42
|
+
return isModuleOptions(options) ? options : {};
|
|
43
|
+
}
|
|
44
|
+
processFailure(error, module) {
|
|
45
|
+
const errorMessages = new Array();
|
|
46
|
+
const options = this.options;
|
|
47
|
+
const getter = options?.errors?.getter;
|
|
48
|
+
if (error instanceof NbAuthIllegalTokenError) errorMessages.push(error.message);
|
|
49
|
+
else if (options && getter) errorMessages.push(...getter(module, error, options));
|
|
50
|
+
return of(new NbAuthResult(false, error, this.moduleOptions(module).redirect?.failure, errorMessages, []));
|
|
51
|
+
}
|
|
52
|
+
processSuccess(res, module) {
|
|
53
|
+
const options = this.options;
|
|
54
|
+
const getter = options?.messages?.getter;
|
|
55
|
+
return from(res.user.getIdToken()).pipe(map((token) => new NbAuthResult(true, res, this.moduleOptions(module).redirect?.success, [], options && getter ? getter(module, res, options) : void 0, this.createToken(token))));
|
|
56
|
+
}
|
|
57
|
+
refreshIdToken(user, module) {
|
|
58
|
+
return from(user.getIdToken(true)).pipe(map((token) => {
|
|
59
|
+
const options = this.moduleOptions(module);
|
|
60
|
+
return new NbAuthResult(true, void 0, options.redirect?.success, [], options.defaultMessages, this.createToken(token));
|
|
61
|
+
}), catchError((error) => this.processFailure(error, module)));
|
|
62
|
+
}
|
|
63
|
+
static {
|
|
64
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
65
|
+
minVersion: "12.0.0",
|
|
66
|
+
version: "22.3.0",
|
|
67
|
+
ngImport: i0,
|
|
68
|
+
type: NbFirebaseBaseStrategy,
|
|
69
|
+
deps: [],
|
|
70
|
+
target: i0.ɵɵFactoryTarget.Service
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
static {
|
|
74
|
+
this.ɵprov = i0.ɵɵngDeclareService({
|
|
75
|
+
minVersion: "22.0.0",
|
|
76
|
+
version: "22.3.0",
|
|
77
|
+
ngImport: i0,
|
|
78
|
+
type: NbFirebaseBaseStrategy,
|
|
79
|
+
autoProvided: false
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
84
|
+
minVersion: "12.0.0",
|
|
85
|
+
version: "22.3.0",
|
|
86
|
+
ngImport: i0,
|
|
87
|
+
type: NbFirebaseBaseStrategy,
|
|
88
|
+
decorators: [{
|
|
89
|
+
type: Service,
|
|
90
|
+
args: [{ autoProvided: false }]
|
|
91
|
+
}]
|
|
92
|
+
});
|
|
93
|
+
var NbFirebasePasswordStrategyOptions = class extends NbAuthStrategyOptions {
|
|
94
|
+
constructor() {
|
|
95
|
+
super(...arguments);
|
|
96
|
+
this.token = { class: NbAuthJWTToken };
|
|
97
|
+
this.register = {
|
|
98
|
+
redirect: {
|
|
99
|
+
success: "/",
|
|
100
|
+
failure: null
|
|
101
|
+
},
|
|
102
|
+
defaultErrors: ["Something went wrong, please try again."],
|
|
103
|
+
defaultMessages: ["You have been successfully registered."]
|
|
104
|
+
};
|
|
105
|
+
this.login = {
|
|
106
|
+
redirect: {
|
|
107
|
+
success: "/",
|
|
108
|
+
failure: null
|
|
109
|
+
},
|
|
110
|
+
defaultErrors: ["Login/Email combination is not correct, please try again."],
|
|
111
|
+
defaultMessages: ["You have been successfully logged in."]
|
|
112
|
+
};
|
|
113
|
+
this.logout = {
|
|
114
|
+
redirect: {
|
|
115
|
+
success: "/",
|
|
116
|
+
failure: null
|
|
117
|
+
},
|
|
118
|
+
defaultErrors: ["Something went wrong, please try again."],
|
|
119
|
+
defaultMessages: ["You have been successfully logged out."]
|
|
120
|
+
};
|
|
121
|
+
this.refreshToken = {
|
|
122
|
+
redirect: {
|
|
123
|
+
success: null,
|
|
124
|
+
failure: null
|
|
125
|
+
},
|
|
126
|
+
defaultErrors: ["Something went wrong, please try again."],
|
|
127
|
+
defaultMessages: ["Your token has been successfully refreshed."]
|
|
128
|
+
};
|
|
129
|
+
this.requestPassword = {
|
|
130
|
+
redirect: {
|
|
131
|
+
success: "/",
|
|
132
|
+
failure: null
|
|
133
|
+
},
|
|
134
|
+
defaultErrors: ["Something went wrong, please try again."],
|
|
135
|
+
defaultMessages: ["Reset password instructions have been sent to your email."]
|
|
136
|
+
};
|
|
137
|
+
this.resetPassword = {
|
|
138
|
+
redirect: {
|
|
139
|
+
success: "/",
|
|
140
|
+
failure: null
|
|
141
|
+
},
|
|
142
|
+
resetPasswordTokenKey: "oobCode",
|
|
143
|
+
defaultErrors: ["Something went wrong, please try again."],
|
|
144
|
+
defaultMessages: ["Your password has been successfully changed."]
|
|
145
|
+
};
|
|
146
|
+
this.errors = {
|
|
147
|
+
key: "message",
|
|
148
|
+
getter: (module, res, options) => nbAuthMessages(getDeepFromObject(res, options.errors.key, getDeepFromObject(options, `${module}.defaultErrors`)))
|
|
149
|
+
};
|
|
150
|
+
this.messages = {
|
|
151
|
+
key: "messages",
|
|
152
|
+
getter: (module, _res, options) => nbAuthMessages(getDeepFromObject(options, `${module}.defaultMessages`))
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
const firebasePasswordStrategyOptions = new NbFirebasePasswordStrategyOptions();
|
|
157
|
+
var NbFirebasePasswordStrategy = class NbFirebasePasswordStrategy extends NbFirebaseBaseStrategy {
|
|
158
|
+
constructor() {
|
|
159
|
+
super(...arguments);
|
|
160
|
+
this.defaultOptions = firebasePasswordStrategyOptions;
|
|
161
|
+
this.route = inject(ActivatedRoute);
|
|
162
|
+
}
|
|
163
|
+
static setup(options) {
|
|
164
|
+
return [NbFirebasePasswordStrategy, options];
|
|
165
|
+
}
|
|
166
|
+
authenticate({ email, password }) {
|
|
167
|
+
const module = "login";
|
|
168
|
+
return from(signInWithEmailAndPassword(this.auth, email, password)).pipe(switchMap((res) => this.processSuccess(res, module)), catchError((error) => this.processFailure(error, module)));
|
|
169
|
+
}
|
|
170
|
+
register({ email, password }) {
|
|
171
|
+
const module = "register";
|
|
172
|
+
return from(createUserWithEmailAndPassword(this.auth, email, password)).pipe(switchMap((res) => this.processSuccess(res, module)), catchError((error) => this.processFailure(error, module)));
|
|
173
|
+
}
|
|
174
|
+
requestPassword({ email }) {
|
|
175
|
+
const module = "requestPassword";
|
|
176
|
+
return from(sendPasswordResetEmail(this.auth, email)).pipe(map(() => new NbAuthResult(true, void 0, this.getOption(`${module}.redirect.success`), [], this.getOption(`${module}.defaultMessages`))), catchError((error) => this.processFailure(error, module)));
|
|
177
|
+
}
|
|
178
|
+
resetPassword({ code, password }) {
|
|
179
|
+
const module = "resetPassword";
|
|
180
|
+
const codeKey = this.getOption(`${module}.resetPasswordTokenKey`) ?? "oobCode";
|
|
181
|
+
const queryCode = this.route.snapshot.queryParams[codeKey];
|
|
182
|
+
const resetCode = code ?? (typeof queryCode === "string" ? queryCode : void 0);
|
|
183
|
+
if (!resetCode) return this.processFailure(/* @__PURE__ */ new Error(`No password reset code in the page's "${codeKey}" query.`), module);
|
|
184
|
+
return from(this.confirmPasswordReset(resetCode, password)).pipe(map(() => new NbAuthResult(true, void 0, this.getOption(`${module}.redirect.success`), [], this.getOption(`${module}.defaultMessages`))), catchError((error) => this.processFailure(error, module)));
|
|
185
|
+
}
|
|
186
|
+
confirmPasswordReset(code, password) {
|
|
187
|
+
return confirmPasswordReset(this.auth, code, password);
|
|
188
|
+
}
|
|
189
|
+
updatePassword(user, password, module) {
|
|
190
|
+
return from(updatePassword(user, password)).pipe(map((token) => {
|
|
191
|
+
const options = this.moduleOptions(module);
|
|
192
|
+
return new NbAuthResult(true, void 0, options.redirect?.success, [], options.defaultMessages, this.createToken(token));
|
|
193
|
+
}), catchError((error) => this.processFailure(error, module)));
|
|
194
|
+
}
|
|
195
|
+
static {
|
|
196
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
197
|
+
minVersion: "12.0.0",
|
|
198
|
+
version: "22.3.0",
|
|
199
|
+
ngImport: i0,
|
|
200
|
+
type: NbFirebasePasswordStrategy,
|
|
201
|
+
deps: [],
|
|
202
|
+
target: i0.ɵɵFactoryTarget.Service
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
static {
|
|
206
|
+
this.ɵprov = i0.ɵɵngDeclareService({
|
|
207
|
+
minVersion: "22.0.0",
|
|
208
|
+
version: "22.3.0",
|
|
209
|
+
ngImport: i0,
|
|
210
|
+
type: NbFirebasePasswordStrategy,
|
|
211
|
+
autoProvided: false
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
216
|
+
minVersion: "12.0.0",
|
|
217
|
+
version: "22.3.0",
|
|
218
|
+
ngImport: i0,
|
|
219
|
+
type: NbFirebasePasswordStrategy,
|
|
220
|
+
decorators: [{
|
|
221
|
+
type: Service,
|
|
222
|
+
args: [{ autoProvided: false }]
|
|
223
|
+
}]
|
|
224
|
+
});
|
|
225
|
+
var NbFirebaseIdentityProviderStrategyOptions = class extends NbAuthStrategyOptions {
|
|
226
|
+
constructor() {
|
|
227
|
+
super(...arguments);
|
|
228
|
+
this.token = { class: NbAuthJWTToken };
|
|
229
|
+
this.logout = {
|
|
230
|
+
redirect: {
|
|
231
|
+
success: "/",
|
|
232
|
+
failure: null
|
|
233
|
+
},
|
|
234
|
+
defaultErrors: ["Something went wrong, please try again."],
|
|
235
|
+
defaultMessages: ["You have been successfully logged out."]
|
|
236
|
+
};
|
|
237
|
+
this.authenticate = {
|
|
238
|
+
redirect: {
|
|
239
|
+
success: "/",
|
|
240
|
+
failure: null
|
|
241
|
+
},
|
|
242
|
+
defaultErrors: ["Something went wrong, please try again."],
|
|
243
|
+
defaultMessages: ["You have been successfully authenticated."]
|
|
244
|
+
};
|
|
245
|
+
this.refreshToken = {
|
|
246
|
+
redirect: {
|
|
247
|
+
success: null,
|
|
248
|
+
failure: null
|
|
249
|
+
},
|
|
250
|
+
defaultErrors: ["Something went wrong, please try again."],
|
|
251
|
+
defaultMessages: ["Your token has been successfully refreshed."]
|
|
252
|
+
};
|
|
253
|
+
this.errors = {
|
|
254
|
+
key: "message",
|
|
255
|
+
getter: (module, _res, options) => nbAuthMessages(getDeepFromObject(options, `${module}.defaultErrors`))
|
|
256
|
+
};
|
|
257
|
+
this.messages = {
|
|
258
|
+
key: "message",
|
|
259
|
+
getter: (module, _res, options) => nbAuthMessages(getDeepFromObject(options, `${module}.defaultMessages`))
|
|
260
|
+
};
|
|
261
|
+
this.scopes = [];
|
|
262
|
+
this.customParameters = {};
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
var NbFirebaseGoogleStrategy = class NbFirebaseGoogleStrategy extends NbFirebaseBaseStrategy {
|
|
266
|
+
constructor() {
|
|
267
|
+
super(...arguments);
|
|
268
|
+
this.defaultOptions = new NbFirebaseIdentityProviderStrategyOptions();
|
|
269
|
+
}
|
|
270
|
+
static setup(options) {
|
|
271
|
+
return [NbFirebaseGoogleStrategy, options];
|
|
272
|
+
}
|
|
273
|
+
authenticate(_data) {
|
|
274
|
+
const module = "authenticate";
|
|
275
|
+
const provider = new GoogleAuthProvider();
|
|
276
|
+
this.getOption("scopes")?.forEach((scope) => provider.addScope(scope));
|
|
277
|
+
provider.setCustomParameters(this.getOption("customParameters") ?? {});
|
|
278
|
+
return from(signInWithPopup(this.auth, provider)).pipe(switchMap((res) => this.processSuccess(res, module)), catchError((error) => this.processFailure(error, module)));
|
|
279
|
+
}
|
|
280
|
+
static {
|
|
281
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
282
|
+
minVersion: "12.0.0",
|
|
283
|
+
version: "22.3.0",
|
|
284
|
+
ngImport: i0,
|
|
285
|
+
type: NbFirebaseGoogleStrategy,
|
|
286
|
+
deps: [],
|
|
287
|
+
target: i0.ɵɵFactoryTarget.Service
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
static {
|
|
291
|
+
this.ɵprov = i0.ɵɵngDeclareService({
|
|
292
|
+
minVersion: "22.0.0",
|
|
293
|
+
version: "22.3.0",
|
|
294
|
+
ngImport: i0,
|
|
295
|
+
type: NbFirebaseGoogleStrategy,
|
|
296
|
+
autoProvided: false
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
301
|
+
minVersion: "12.0.0",
|
|
302
|
+
version: "22.3.0",
|
|
303
|
+
ngImport: i0,
|
|
304
|
+
type: NbFirebaseGoogleStrategy,
|
|
305
|
+
decorators: [{
|
|
306
|
+
type: Service,
|
|
307
|
+
args: [{ autoProvided: false }]
|
|
308
|
+
}]
|
|
309
|
+
});
|
|
310
|
+
var NbFirebaseFacebookStrategy = class NbFirebaseFacebookStrategy extends NbFirebaseBaseStrategy {
|
|
311
|
+
constructor() {
|
|
312
|
+
super(...arguments);
|
|
313
|
+
this.defaultOptions = new NbFirebaseIdentityProviderStrategyOptions();
|
|
314
|
+
}
|
|
315
|
+
static setup(options) {
|
|
316
|
+
return [NbFirebaseFacebookStrategy, options];
|
|
317
|
+
}
|
|
318
|
+
authenticate(_data) {
|
|
319
|
+
const module = "authenticate";
|
|
320
|
+
const provider = new FacebookAuthProvider();
|
|
321
|
+
this.getOption("scopes")?.forEach((scope) => provider.addScope(scope));
|
|
322
|
+
provider.setCustomParameters(this.getOption("customParameters") ?? {});
|
|
323
|
+
return from(signInWithPopup(this.auth, provider)).pipe(switchMap((res) => this.processSuccess(res, module)), catchError((error) => this.processFailure(error, module)));
|
|
324
|
+
}
|
|
325
|
+
static {
|
|
326
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
327
|
+
minVersion: "12.0.0",
|
|
328
|
+
version: "22.3.0",
|
|
329
|
+
ngImport: i0,
|
|
330
|
+
type: NbFirebaseFacebookStrategy,
|
|
331
|
+
deps: [],
|
|
332
|
+
target: i0.ɵɵFactoryTarget.Service
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
static {
|
|
336
|
+
this.ɵprov = i0.ɵɵngDeclareService({
|
|
337
|
+
minVersion: "22.0.0",
|
|
338
|
+
version: "22.3.0",
|
|
339
|
+
ngImport: i0,
|
|
340
|
+
type: NbFirebaseFacebookStrategy,
|
|
341
|
+
autoProvided: false
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
346
|
+
minVersion: "12.0.0",
|
|
347
|
+
version: "22.3.0",
|
|
348
|
+
ngImport: i0,
|
|
349
|
+
type: NbFirebaseFacebookStrategy,
|
|
350
|
+
decorators: [{
|
|
351
|
+
type: Service,
|
|
352
|
+
args: [{ autoProvided: false }]
|
|
353
|
+
}]
|
|
354
|
+
});
|
|
355
|
+
var NbFirebaseTwitterStrategy = class NbFirebaseTwitterStrategy extends NbFirebaseBaseStrategy {
|
|
356
|
+
constructor() {
|
|
357
|
+
super(...arguments);
|
|
358
|
+
this.defaultOptions = new NbFirebaseIdentityProviderStrategyOptions();
|
|
359
|
+
}
|
|
360
|
+
static setup(options) {
|
|
361
|
+
return [NbFirebaseTwitterStrategy, options];
|
|
362
|
+
}
|
|
363
|
+
authenticate(_data) {
|
|
364
|
+
const module = "authenticate";
|
|
365
|
+
const provider = new TwitterAuthProvider();
|
|
366
|
+
provider.setCustomParameters(this.getOption("customParameters") ?? {});
|
|
367
|
+
return from(signInWithPopup(this.auth, provider)).pipe(switchMap((res) => this.processSuccess(res, module)), catchError((error) => this.processFailure(error, module)));
|
|
368
|
+
}
|
|
369
|
+
static {
|
|
370
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
371
|
+
minVersion: "12.0.0",
|
|
372
|
+
version: "22.3.0",
|
|
373
|
+
ngImport: i0,
|
|
374
|
+
type: NbFirebaseTwitterStrategy,
|
|
375
|
+
deps: [],
|
|
376
|
+
target: i0.ɵɵFactoryTarget.Service
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
static {
|
|
380
|
+
this.ɵprov = i0.ɵɵngDeclareService({
|
|
381
|
+
minVersion: "22.0.0",
|
|
382
|
+
version: "22.3.0",
|
|
383
|
+
ngImport: i0,
|
|
384
|
+
type: NbFirebaseTwitterStrategy,
|
|
385
|
+
autoProvided: false
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
390
|
+
minVersion: "12.0.0",
|
|
391
|
+
version: "22.3.0",
|
|
392
|
+
ngImport: i0,
|
|
393
|
+
type: NbFirebaseTwitterStrategy,
|
|
394
|
+
decorators: [{
|
|
395
|
+
type: Service,
|
|
396
|
+
args: [{ autoProvided: false }]
|
|
397
|
+
}]
|
|
398
|
+
});
|
|
399
|
+
const NbFirebaseTwitteStrategy = NbFirebaseTwitterStrategy;
|
|
400
|
+
function provideNbFirebaseAuth() {
|
|
401
|
+
return makeEnvironmentProviders([
|
|
402
|
+
NbFirebasePasswordStrategy,
|
|
403
|
+
NbFirebaseGoogleStrategy,
|
|
404
|
+
NbFirebaseFacebookStrategy,
|
|
405
|
+
NbFirebaseTwitterStrategy
|
|
406
|
+
]);
|
|
407
|
+
}
|
|
408
|
+
var NbFirebaseAuthModule = class NbFirebaseAuthModule {
|
|
409
|
+
static {
|
|
410
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
411
|
+
minVersion: "12.0.0",
|
|
412
|
+
version: "22.3.0",
|
|
413
|
+
ngImport: i0,
|
|
414
|
+
type: NbFirebaseAuthModule,
|
|
415
|
+
deps: [],
|
|
416
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
static {
|
|
420
|
+
this.ɵmod = i0.ɵɵngDeclareNgModule({
|
|
421
|
+
minVersion: "14.0.0",
|
|
422
|
+
version: "22.3.0",
|
|
423
|
+
ngImport: i0,
|
|
424
|
+
type: NbFirebaseAuthModule
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
static {
|
|
428
|
+
this.ɵinj = i0.ɵɵngDeclareInjector({
|
|
429
|
+
minVersion: "12.0.0",
|
|
430
|
+
version: "22.3.0",
|
|
431
|
+
ngImport: i0,
|
|
432
|
+
type: NbFirebaseAuthModule,
|
|
433
|
+
providers: [provideNbFirebaseAuth()]
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
438
|
+
minVersion: "12.0.0",
|
|
439
|
+
version: "22.3.0",
|
|
440
|
+
ngImport: i0,
|
|
441
|
+
type: NbFirebaseAuthModule,
|
|
442
|
+
decorators: [{
|
|
443
|
+
type: NgModule,
|
|
444
|
+
args: [{ providers: [provideNbFirebaseAuth()] }]
|
|
445
|
+
}]
|
|
446
|
+
});
|
|
447
|
+
export { NbFirebaseAuthModule, NbFirebaseBaseStrategy, NbFirebaseFacebookStrategy, NbFirebaseGoogleStrategy, NbFirebaseIdentityProviderStrategyOptions, NbFirebasePasswordStrategy, NbFirebasePasswordStrategyOptions, NbFirebaseTwitteStrategy, NbFirebaseTwitterStrategy, firebasePasswordStrategyOptions, provideNbFirebaseAuth };
|
|
448
|
+
|
|
449
|
+
//# sourceMappingURL=liquid-js-lyr-firebase-auth.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liquid-js-lyr-firebase-auth.mjs","names":["observableOf"],"sources":["../../../packages/firebase-auth/src/strategies/base/firebase-base.strategy.ts","../../../packages/firebase-auth/src/strategies/password/firebase-password-strategy.options.ts","../../../packages/firebase-auth/src/strategies/password/firebase-password.strategy.ts","../../../packages/firebase-auth/src/strategies/base/firebase-identity-provider-strategy.options.ts","../../../packages/firebase-auth/src/strategies/google/firebase-google.strategy.ts","../../../packages/firebase-auth/src/strategies/facebook/firebase-facebook.strategy.ts","../../../packages/firebase-auth/src/strategies/twitter/firebase-twitter.strategy.ts","../../../packages/firebase-auth/src/firebase-auth.module.ts"],"sourcesContent":["import { inject, Service } from '@angular/core'\nimport { Auth } from '@angular/fire/auth'\nimport { signOut, type User, type UserCredential } from 'firebase/auth'\nimport { Observable, of as observableOf, from } from 'rxjs'\nimport { catchError, map, switchMap } from 'rxjs/operators'\nimport {\n getDeepFromObject,\n NbAuthResult,\n NbAuthIllegalTokenError,\n NbAuthStrategy,\n NbAuthStrategyOptions,\n NbPasswordStrategyMessage,\n NbPasswordStrategyModule\n} from '@liquid-js/lyr-auth'\n\n/** The options of every Firebase strategy: the getters of its errors and messages. */\ntype NbFirebaseStrategyOptions = NbAuthStrategyOptions & {\n errors?: NbPasswordStrategyMessage\n messages?: NbPasswordStrategyMessage\n}\n\n/** Whether a module's option is its options, rather than a flag. */\nfunction isModuleOptions(value: unknown): value is NbPasswordStrategyModule {\n return typeof value === 'object' && value !== null\n}\n\n/**\n * The base of the Firebase strategies. `O` is the strategy's options class; each names its modules (actions) its own\n * way, such as `login` and `authenticate`.\n */\n@Service({ autoProvided: false })\nexport abstract class NbFirebaseBaseStrategy<O extends NbFirebaseStrategyOptions = NbFirebaseStrategyOptions>\n extends NbAuthStrategy<O> {\n protected readonly auth = inject(Auth)\n\n logout(): Observable<NbAuthResult> {\n const module = 'logout'\n return from(signOut(this.auth)).pipe(\n map(() => {\n const options = this.moduleOptions(module)\n return new NbAuthResult(true, undefined, options.redirect?.success, [], options.defaultMessages)\n }),\n catchError((error) => this.processFailure(error, module))\n )\n }\n\n register(_data?: unknown): Observable<NbAuthResult> {\n throw new Error(`'register' is not supported by '${this.constructor.name}', use 'authenticate'.`)\n }\n\n requestPassword(_data?: unknown): Observable<NbAuthResult> {\n throw new Error(`'requestPassword' is not supported by '${this.constructor.name}', use 'authenticate'.`)\n }\n\n resetPassword(_data?: unknown): Observable<NbAuthResult> {\n throw new Error(`'resetPassword' is not supported by '${this.constructor.name}', use 'authenticate'.`)\n }\n\n /**\n * Refreshes the Firebase ID token of the signed-in user. Firebase ID tokens expire after an hour, so every\n * strategy needs this for `isAuthenticatedOrRefresh()`.\n */\n refreshToken(_data?: unknown): Observable<NbAuthResult> {\n const module = 'refreshToken'\n return from(this.auth.authStateReady()).pipe(\n map(() => this.auth.currentUser),\n switchMap((user) => {\n if (user == null) {\n return observableOf(\n new NbAuthResult(false, undefined, this.moduleOptions(module).redirect?.failure, [\n \"There is no logged in user so refresh of id token isn't possible\"\n ])\n )\n }\n return this.refreshIdToken(user, module)\n })\n )\n }\n\n /** The options of a module (action), such as `login`: its redirects and default messages. */\n protected moduleOptions(module: string): NbPasswordStrategyModule {\n const options = getDeepFromObject(this.options, module)\n return isModuleOptions(options) ? options : {}\n }\n\n protected processFailure(error: unknown, module: string): Observable<NbAuthResult> {\n const errorMessages = new Array<string>()\n\n const options = this.options\n const getter = options?.errors?.getter\n if (error instanceof NbAuthIllegalTokenError) {\n errorMessages.push(error.message)\n } else if (options && getter) {\n errorMessages.push(...getter(module, error, options))\n }\n\n return observableOf(\n new NbAuthResult(false, error, this.moduleOptions(module).redirect?.failure, errorMessages, [])\n )\n }\n\n protected processSuccess(res: UserCredential, module: string): Observable<NbAuthResult<UserCredential>> {\n const options = this.options\n const getter = options?.messages?.getter\n return from(res.user.getIdToken()).pipe(\n map((token) => new NbAuthResult(\n true,\n res,\n this.moduleOptions(module).redirect?.success,\n [],\n options && getter ? getter(module, res, options) : undefined,\n this.createToken(token)\n ))\n )\n }\n\n protected refreshIdToken(user: User, module: string): Observable<NbAuthResult> {\n return from(user.getIdToken(true)).pipe(\n map((token) => {\n const options = this.moduleOptions(module)\n return new NbAuthResult(\n true,\n undefined,\n options.redirect?.success,\n [],\n options.defaultMessages,\n this.createToken(token)\n )\n }),\n catchError((error) => this.processFailure(error, module))\n )\n }\n}\n","import {\n getDeepFromObject,\n nbAuthMessages,\n NbAuthJWTToken,\n NbAuthStrategyOptions,\n NbPasswordStrategyMessage,\n NbPasswordStrategyModule,\n NbPasswordStrategyReset,\n NbStrategyToken\n} from '@liquid-js/lyr-auth'\n\n/**\n * The options a getter is called with: the defaults merged with the configured ones, so the getter's key is set.\n */\ntype NbFirebasePasswordStrategyOptionsWithKey<K extends 'errors' | 'messages'> = NbFirebasePasswordStrategyOptions\n & Record<K, { key: string }>\n\nexport class NbFirebasePasswordStrategyOptions extends NbAuthStrategyOptions {\n override token?: NbStrategyToken = {\n class: NbAuthJWTToken\n }\n register?: boolean | NbPasswordStrategyModule = {\n redirect: {\n success: '/',\n failure: null\n },\n defaultErrors: ['Something went wrong, please try again.'],\n defaultMessages: ['You have been successfully registered.']\n }\n login?: boolean | NbPasswordStrategyModule = {\n redirect: {\n success: '/',\n failure: null\n },\n defaultErrors: ['Login/Email combination is not correct, please try again.'],\n defaultMessages: ['You have been successfully logged in.']\n }\n logout?: boolean | NbPasswordStrategyModule = {\n redirect: {\n success: '/',\n failure: null\n },\n defaultErrors: ['Something went wrong, please try again.'],\n defaultMessages: ['You have been successfully logged out.']\n }\n refreshToken?: boolean | NbPasswordStrategyModule = {\n redirect: {\n success: null,\n failure: null\n },\n defaultErrors: ['Something went wrong, please try again.'],\n defaultMessages: ['Your token has been successfully refreshed.']\n }\n requestPassword?: boolean | NbPasswordStrategyModule = {\n redirect: {\n success: '/',\n failure: null\n },\n defaultErrors: ['Something went wrong, please try again.'],\n defaultMessages: ['Reset password instructions have been sent to your email.']\n }\n resetPassword?: boolean | NbPasswordStrategyReset = {\n redirect: {\n success: '/',\n failure: null\n },\n // The query parameter of the reset link that holds Firebase's code.\n resetPasswordTokenKey: 'oobCode',\n defaultErrors: ['Something went wrong, please try again.'],\n defaultMessages: ['Your password has been successfully changed.']\n }\n errors?: NbPasswordStrategyMessage = {\n key: 'message',\n getter: (module: string, res: unknown, options: NbFirebasePasswordStrategyOptionsWithKey<'errors'>) =>\n nbAuthMessages(getDeepFromObject(res, options.errors.key, getDeepFromObject(options, `${module}.defaultErrors`)))\n }\n messages?: NbPasswordStrategyMessage = {\n key: 'messages',\n // Firebase's sign-in calls answer with a `UserCredential`, which holds no messages: these are the module's\n // defaults.\n getter: (module: string, _res: unknown, options: NbFirebasePasswordStrategyOptionsWithKey<'messages'>) =>\n nbAuthMessages(getDeepFromObject(options, `${module}.defaultMessages`))\n }\n}\n\nexport const firebasePasswordStrategyOptions: NbFirebasePasswordStrategyOptions =\n new NbFirebasePasswordStrategyOptions()\n","import { inject, Service } from '@angular/core'\nimport { ActivatedRoute } from '@angular/router'\nimport {\n confirmPasswordReset,\n createUserWithEmailAndPassword,\n sendPasswordResetEmail,\n signInWithEmailAndPassword,\n updatePassword,\n type User\n} from 'firebase/auth'\nimport { Observable, from } from 'rxjs'\nimport { catchError, map, switchMap } from 'rxjs/operators'\nimport {\n NbAuthCredentials,\n NbAuthStrategyOptions,\n NbAuthStrategyClass,\n NbAuthResult\n} from '@liquid-js/lyr-auth'\n\nimport { NbFirebaseBaseStrategy } from '../base/firebase-base.strategy'\nimport {\n firebasePasswordStrategyOptions,\n NbFirebasePasswordStrategyOptions\n} from './firebase-password-strategy.options'\n\n@Service({ autoProvided: false })\nexport class NbFirebasePasswordStrategy extends NbFirebaseBaseStrategy<NbFirebasePasswordStrategyOptions> {\n protected override defaultOptions: NbFirebasePasswordStrategyOptions = firebasePasswordStrategyOptions\n private readonly route = inject(ActivatedRoute)\n\n static setup(options: NbFirebasePasswordStrategyOptions): [NbAuthStrategyClass, NbAuthStrategyOptions] {\n return [NbFirebasePasswordStrategy, options]\n }\n\n authenticate({ email, password }: Required<Pick<NbAuthCredentials, 'email' | 'password'>>): Observable<NbAuthResult> {\n const module = 'login'\n return from(signInWithEmailAndPassword(this.auth, email, password)).pipe(\n switchMap((res) => this.processSuccess(res, module)),\n catchError((error) => this.processFailure(error, module))\n )\n }\n\n override register({\n email,\n password\n }: Required<Pick<NbAuthCredentials, 'email' | 'password'>>): Observable<NbAuthResult> {\n const module = 'register'\n return from(createUserWithEmailAndPassword(this.auth, email, password)).pipe(\n switchMap((res) => this.processSuccess(res, module)),\n catchError((error) => this.processFailure(error, module))\n )\n }\n\n override requestPassword({ email }: Required<Pick<NbAuthCredentials, 'email'>>): Observable<NbAuthResult> {\n const module = 'requestPassword'\n return from(sendPasswordResetEmail(this.auth, email)).pipe(\n map(() => new NbAuthResult(\n true,\n undefined,\n this.getOption(`${module}.redirect.success`),\n [],\n this.getOption(`${module}.defaultMessages`)\n )),\n catchError((error) => this.processFailure(error, module))\n )\n }\n\n /**\n * Sets the new password with the code of Firebase's password reset email. The link in the email brings the user to\n * the reset password page with the code in the query, under the options' `resetPasswordTokenKey` (Firebase's\n * `oobCode`); a `code` in the data is used instead when it's given.\n */\n override resetPassword({ code, password }: { code?: string, password: string }): Observable<NbAuthResult> {\n const module = 'resetPassword'\n const codeKey = this.getOption(`${module}.resetPasswordTokenKey`) ?? 'oobCode'\n const queryCode: unknown = this.route.snapshot.queryParams[codeKey]\n const resetCode = code ?? (typeof queryCode === 'string' ? queryCode : undefined)\n if (!resetCode) {\n return this.processFailure(new Error(`No password reset code in the page's \"${codeKey}\" query.`), module)\n }\n return from(this.confirmPasswordReset(resetCode, password)).pipe(\n map(() => new NbAuthResult(\n true,\n undefined,\n this.getOption(`${module}.redirect.success`),\n [],\n this.getOption(`${module}.defaultMessages`)\n )),\n catchError((error) => this.processFailure(error, module))\n )\n }\n\n /** Firebase's confirmPasswordReset, for the strategy's Auth. */\n protected confirmPasswordReset(code: string, password: string): Promise<void> {\n return confirmPasswordReset(this.auth, code, password)\n }\n\n protected updatePassword(user: User, password: string, module: string) {\n return from(updatePassword(user, password)).pipe(\n map((token) => {\n const options = this.moduleOptions(module)\n return new NbAuthResult(\n true,\n undefined,\n options.redirect?.success,\n [],\n options.defaultMessages,\n this.createToken(token)\n )\n }),\n catchError((error) => this.processFailure(error, module))\n )\n }\n}\n","import {\n getDeepFromObject,\n nbAuthMessages,\n NbPasswordStrategyMessage,\n NbPasswordStrategyModule,\n NbAuthJWTToken,\n NbAuthStrategyOptions,\n NbStrategyToken\n} from '@liquid-js/lyr-auth'\n\nexport class NbFirebaseIdentityProviderStrategyOptions extends NbAuthStrategyOptions {\n override token?: NbStrategyToken = {\n class: NbAuthJWTToken\n }\n logout?: boolean | NbPasswordStrategyModule = {\n redirect: {\n success: '/',\n failure: null\n },\n defaultErrors: ['Something went wrong, please try again.'],\n defaultMessages: ['You have been successfully logged out.']\n }\n authenticate?: boolean | NbPasswordStrategyModule = {\n redirect: {\n success: '/',\n failure: null\n },\n defaultErrors: ['Something went wrong, please try again.'],\n defaultMessages: ['You have been successfully authenticated.']\n }\n refreshToken?: boolean | NbPasswordStrategyModule = {\n redirect: {\n success: null,\n failure: null\n },\n defaultErrors: ['Something went wrong, please try again.'],\n defaultMessages: ['Your token has been successfully refreshed.']\n }\n errors?: NbPasswordStrategyMessage = {\n key: 'message',\n getter: (module: string, _res: unknown, options: NbFirebaseIdentityProviderStrategyOptions) =>\n nbAuthMessages(getDeepFromObject(options, `${module}.defaultErrors`))\n }\n messages?: NbPasswordStrategyMessage = {\n key: 'message',\n getter: (module: string, _res: unknown, options: NbFirebaseIdentityProviderStrategyOptions) =>\n nbAuthMessages(getDeepFromObject(options, `${module}.defaultMessages`))\n }\n scopes?: string[] = []\n customParameters?: { [key: string]: string } = {}\n};\n","import { Service } from '@angular/core'\nimport { from, Observable } from 'rxjs'\nimport { catchError, switchMap } from 'rxjs/operators'\nimport { NbAuthStrategyClass, NbAuthResult, NbAuthStrategyOptions } from '@liquid-js/lyr-auth'\n\nimport { GoogleAuthProvider, signInWithPopup } from 'firebase/auth'\nimport { NbFirebaseBaseStrategy } from '../base/firebase-base.strategy'\nimport { NbFirebaseIdentityProviderStrategyOptions } from '../base/firebase-identity-provider-strategy.options'\n\n@Service({ autoProvided: false })\nexport class NbFirebaseGoogleStrategy extends NbFirebaseBaseStrategy<NbFirebaseIdentityProviderStrategyOptions> {\n protected override defaultOptions: NbFirebaseIdentityProviderStrategyOptions =\n new NbFirebaseIdentityProviderStrategyOptions()\n\n static setup(options: NbFirebaseIdentityProviderStrategyOptions): [NbAuthStrategyClass, NbAuthStrategyOptions] {\n return [NbFirebaseGoogleStrategy, options]\n }\n\n authenticate(_data?: unknown): Observable<NbAuthResult> {\n const module = 'authenticate'\n const provider = new GoogleAuthProvider()\n this.getOption('scopes')?.forEach((scope) => provider.addScope(scope))\n provider.setCustomParameters(this.getOption('customParameters') ?? {})\n\n return from(signInWithPopup(this.auth, provider)).pipe(\n switchMap((res) => this.processSuccess(res, module)),\n catchError((error) => this.processFailure(error, module))\n )\n }\n}\n","import { Service } from '@angular/core'\nimport { NbAuthResult, NbAuthStrategyClass, NbAuthStrategyOptions } from '@liquid-js/lyr-auth'\nimport { from, Observable } from 'rxjs'\nimport { catchError, switchMap } from 'rxjs/operators'\n\nimport { FacebookAuthProvider, signInWithPopup } from 'firebase/auth'\nimport { NbFirebaseBaseStrategy } from '../base/firebase-base.strategy'\nimport { NbFirebaseIdentityProviderStrategyOptions } from '../base/firebase-identity-provider-strategy.options'\n\n@Service({ autoProvided: false })\nexport class NbFirebaseFacebookStrategy extends NbFirebaseBaseStrategy<NbFirebaseIdentityProviderStrategyOptions> {\n protected override defaultOptions: NbFirebaseIdentityProviderStrategyOptions =\n new NbFirebaseIdentityProviderStrategyOptions()\n\n static setup(options: NbFirebaseIdentityProviderStrategyOptions): [NbAuthStrategyClass, NbAuthStrategyOptions] {\n return [NbFirebaseFacebookStrategy, options]\n }\n\n authenticate(_data?: unknown): Observable<NbAuthResult> {\n const module = 'authenticate'\n const provider = new FacebookAuthProvider()\n this.getOption('scopes')?.forEach((scope) => provider.addScope(scope))\n provider.setCustomParameters(this.getOption('customParameters') ?? {})\n\n return from(signInWithPopup(this.auth, provider)).pipe(\n switchMap((res) => this.processSuccess(res, module)),\n catchError((error) => this.processFailure(error, module))\n )\n }\n}\n","import { Service } from '@angular/core'\nimport { Observable, from } from 'rxjs'\nimport { catchError, switchMap } from 'rxjs/operators'\nimport { NbAuthStrategyClass, NbAuthResult, NbAuthStrategyOptions } from '@liquid-js/lyr-auth'\n\nimport { TwitterAuthProvider, signInWithPopup } from 'firebase/auth'\nimport { NbFirebaseBaseStrategy } from '../base/firebase-base.strategy'\nimport { NbFirebaseIdentityProviderStrategyOptions } from '../base/firebase-identity-provider-strategy.options'\n\n@Service({ autoProvided: false })\nexport class NbFirebaseTwitterStrategy extends NbFirebaseBaseStrategy<NbFirebaseIdentityProviderStrategyOptions> {\n protected override defaultOptions: NbFirebaseIdentityProviderStrategyOptions =\n new NbFirebaseIdentityProviderStrategyOptions()\n\n static setup(options: NbFirebaseIdentityProviderStrategyOptions): [NbAuthStrategyClass, NbAuthStrategyOptions] {\n return [NbFirebaseTwitterStrategy, options]\n }\n\n authenticate(_data?: unknown): Observable<NbAuthResult> {\n const module = 'authenticate'\n const provider = new TwitterAuthProvider()\n provider.setCustomParameters(this.getOption('customParameters') ?? {})\n\n return from(signInWithPopup(this.auth, provider)).pipe(\n switchMap((res) => this.processSuccess(res, module)),\n catchError((error) => this.processFailure(error, module))\n )\n }\n}\n\n/** @deprecated The old, misspelt name of `NbFirebaseTwitterStrategy`. */\nexport const NbFirebaseTwitteStrategy = NbFirebaseTwitterStrategy\n/** @deprecated The old, misspelt name of `NbFirebaseTwitterStrategy`. */\n// The alias is a value and a type, as the class it names is.\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type NbFirebaseTwitteStrategy = NbFirebaseTwitterStrategy\n","import { NgModule, EnvironmentProviders, makeEnvironmentProviders } from '@angular/core'\n\nimport { NbFirebasePasswordStrategy } from './strategies/password/firebase-password.strategy'\nimport { NbFirebaseGoogleStrategy } from './strategies/google/firebase-google.strategy'\nimport { NbFirebaseFacebookStrategy } from './strategies/facebook/firebase-facebook.strategy'\nimport { NbFirebaseTwitterStrategy } from './strategies/twitter/firebase-twitter.strategy'\n\n/**\n * Provides the Firebase auth strategies, in place of importing `NbFirebaseAuthModule`.\n */\nexport function provideNbFirebaseAuth(): EnvironmentProviders {\n return makeEnvironmentProviders([\n NbFirebasePasswordStrategy,\n NbFirebaseGoogleStrategy,\n NbFirebaseFacebookStrategy,\n NbFirebaseTwitterStrategy\n ])\n}\n\n@NgModule({\n providers: [provideNbFirebaseAuth()]\n})\nexport class NbFirebaseAuthModule { }\n"],"mappings":";;;;;;;;AAsBA,SAAS,gBAAgB,OAAc;CACnC,OAAO,OAAO,UAAU,YAAY,UAAU;AAClD;AAOA,IAAsB,yBAAtB,MAAsB,+BACV,eAAiB;CAF7B,cAAA;;EAGuB,KAAA,OAAO,OAAO,IAAI;CAmGxC;CAjGG,SAAM;EACF,MAAM,SAAS;EACf,OAAO,KAAK,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,KAC5B,UAAS;GACL,MAAM,UAAU,KAAK,cAAc,MAAM;GACzC,OAAO,IAAI,aAAa,MAAM,QAAW,QAAQ,UAAU,SAAS,CAAA,GAAI,QAAQ,eAAe;EACnG,CAAC,GACD,YAAY,UAAU,KAAK,eAAe,OAAO,MAAM,CAAC,CAAC;CAEjE;CAEA,SAAS,OAAe;EACpB,MAAM,IAAI,MAAM,mCAAmC,KAAK,YAAY,KAAI,uBAAwB;CACpG;CAEA,gBAAgB,OAAe;EAC3B,MAAM,IAAI,MAAM,0CAA0C,KAAK,YAAY,KAAI,uBAAwB;CAC3G;CAEA,cAAc,OAAe;EACzB,MAAM,IAAI,MAAM,wCAAwC,KAAK,YAAY,KAAI,uBAAwB;CACzG;CAMA,aAAa,OAAe;EACxB,MAAM,SAAS;EACf,OAAO,KAAK,KAAK,KAAK,eAAc,CAAE,CAAC,CAAC,KACpC,UAAU,KAAK,KAAK,WAAW,GAC/B,WAAW,SAAQ;GACf,IAAI,QAAQ,MACR,OAAOA,GACH,IAAI,aAAa,OAAO,QAAW,KAAK,cAAc,MAAM,CAAC,CAAC,UAAU,SAAS,CAC7E,kEACH,CAAA,CAAC;GAGV,OAAO,KAAK,eAAe,MAAM,MAAM;EAC3C,CAAC,CAAC;CAEV;CAGU,cAAc,QAAc;EAClC,MAAM,UAAU,kBAAk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,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAApB;EAAA,KAAA,OAAA,GAAA,oBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;EAAoB,CAAA;CAAA;CAApB;EAAA,KAAA,OAAA,GAAA,oBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAoB,WAFlB,CAAC,sBAAqB,CAAE;EAAC,CAAA;CAAA;;AAE3B,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAoB,YAAA,CAAA;EAHhC,MAAA;EAAS,MAAA,CAAA,EACN,WAAW,CAAC,sBAAqB,CAAE,EACtC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liquid-js/lyr-firebase-auth",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
|
|
3
|
+
"description": "Firebase auth strategies for Lyra",
|
|
4
|
+
"bugs": {
|
|
5
|
+
"url": "https://github.com/Liquid-JS/lyra/issues"
|
|
6
|
+
},
|
|
7
|
+
"version": "22.0.0-alpha.0",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"author": "HitkoDev <development@hitko.si>",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/Liquid-JS/lyra.git"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/Liquid-JS/lyra/tree/master/packages/firebase-auth#readme",
|
|
16
|
+
"keywords": [
|
|
17
|
+
"angular",
|
|
18
|
+
"typescript",
|
|
19
|
+
"lyra",
|
|
20
|
+
"ui",
|
|
21
|
+
"components",
|
|
22
|
+
"auth",
|
|
23
|
+
"firebase"
|
|
24
|
+
],
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"@angular/core": "^22.0.0",
|
|
27
|
+
"@angular/fire": "^22.0.0-rc.1",
|
|
28
|
+
"@angular/router": "^22.0.0",
|
|
29
|
+
"@liquid-js/lyr-auth": "^22.0.0",
|
|
30
|
+
"firebase": "^13.4.0",
|
|
31
|
+
"rxjs": "^6.5.3 || ^7.4.0"
|
|
32
|
+
},
|
|
33
|
+
"sideEffects": false,
|
|
34
|
+
"module": "fesm2022/liquid-js-lyr-firebase-auth.mjs",
|
|
35
|
+
"typings": "types/liquid-js-lyr-firebase-auth.d.ts",
|
|
36
|
+
"exports": {
|
|
37
|
+
"./package.json": {
|
|
38
|
+
"default": "./package.json"
|
|
39
|
+
},
|
|
40
|
+
".": {
|
|
41
|
+
"types": "./types/liquid-js-lyr-firebase-auth.d.ts",
|
|
42
|
+
"default": "./fesm2022/liquid-js-lyr-firebase-auth.mjs"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"tslib": "^2.9.1"
|
|
47
|
+
}
|
|
6
48
|
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
import { Auth } from "@angular/fire/auth";
|
|
5
|
+
import { User, UserCredential } from "firebase/auth";
|
|
6
|
+
import { Observable } from "rxjs";
|
|
7
|
+
import { NbAuthCredentials, NbAuthResult, NbAuthStrategy, NbAuthStrategyClass, NbAuthStrategyOptions, NbPasswordStrategyMessage, NbPasswordStrategyModule, NbPasswordStrategyReset, NbStrategyToken } from "@liquid-js/lyr-auth";
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
import { EnvironmentProviders } from "@angular/core";
|
|
10
|
+
/** The options of every Firebase strategy: the getters of its errors and messages. */
|
|
11
|
+
type NbFirebaseStrategyOptions = NbAuthStrategyOptions & {
|
|
12
|
+
errors?: NbPasswordStrategyMessage;
|
|
13
|
+
messages?: NbPasswordStrategyMessage;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The base of the Firebase strategies. `O` is the strategy's options class; each names its modules (actions) its own
|
|
17
|
+
* way, such as `login` and `authenticate`.
|
|
18
|
+
*/
|
|
19
|
+
export declare abstract class NbFirebaseBaseStrategy<O extends NbFirebaseStrategyOptions = NbFirebaseStrategyOptions> extends NbAuthStrategy<O> {
|
|
20
|
+
protected readonly auth: Auth;
|
|
21
|
+
logout(): Observable<NbAuthResult>;
|
|
22
|
+
register(_data?: unknown): Observable<NbAuthResult>;
|
|
23
|
+
requestPassword(_data?: unknown): Observable<NbAuthResult>;
|
|
24
|
+
resetPassword(_data?: unknown): Observable<NbAuthResult>;
|
|
25
|
+
/**
|
|
26
|
+
* Refreshes the Firebase ID token of the signed-in user. Firebase ID tokens expire after an hour, so every
|
|
27
|
+
* strategy needs this for `isAuthenticatedOrRefresh()`.
|
|
28
|
+
*/
|
|
29
|
+
refreshToken(_data?: unknown): Observable<NbAuthResult>;
|
|
30
|
+
/** The options of a module (action), such as `login`: its redirects and default messages. */
|
|
31
|
+
protected moduleOptions(module: string): NbPasswordStrategyModule;
|
|
32
|
+
protected processFailure(error: unknown, module: string): Observable<NbAuthResult>;
|
|
33
|
+
protected processSuccess(res: UserCredential, module: string): Observable<NbAuthResult<UserCredential>>;
|
|
34
|
+
protected refreshIdToken(user: User, module: string): Observable<NbAuthResult>;
|
|
35
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NbFirebaseBaseStrategy<any>, never>;
|
|
36
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
37
|
+
}
|
|
38
|
+
export declare class NbFirebasePasswordStrategyOptions extends NbAuthStrategyOptions {
|
|
39
|
+
token?: NbStrategyToken;
|
|
40
|
+
register?: boolean | NbPasswordStrategyModule;
|
|
41
|
+
login?: boolean | NbPasswordStrategyModule;
|
|
42
|
+
logout?: boolean | NbPasswordStrategyModule;
|
|
43
|
+
refreshToken?: boolean | NbPasswordStrategyModule;
|
|
44
|
+
requestPassword?: boolean | NbPasswordStrategyModule;
|
|
45
|
+
resetPassword?: boolean | NbPasswordStrategyReset;
|
|
46
|
+
errors?: NbPasswordStrategyMessage;
|
|
47
|
+
messages?: NbPasswordStrategyMessage;
|
|
48
|
+
}
|
|
49
|
+
export declare const firebasePasswordStrategyOptions: NbFirebasePasswordStrategyOptions;
|
|
50
|
+
export declare class NbFirebasePasswordStrategy extends NbFirebaseBaseStrategy<NbFirebasePasswordStrategyOptions> {
|
|
51
|
+
protected defaultOptions: NbFirebasePasswordStrategyOptions;
|
|
52
|
+
private readonly route;
|
|
53
|
+
static setup(options: NbFirebasePasswordStrategyOptions): [NbAuthStrategyClass, NbAuthStrategyOptions];
|
|
54
|
+
authenticate({ email, password }: Required<Pick<NbAuthCredentials, 'email' | 'password'>>): Observable<NbAuthResult>;
|
|
55
|
+
register({ email, password }: Required<Pick<NbAuthCredentials, 'email' | 'password'>>): Observable<NbAuthResult>;
|
|
56
|
+
requestPassword({ email }: Required<Pick<NbAuthCredentials, 'email'>>): Observable<NbAuthResult>;
|
|
57
|
+
/**
|
|
58
|
+
* Sets the new password with the code of Firebase's password reset email. The link in the email brings the user to
|
|
59
|
+
* the reset password page with the code in the query, under the options' `resetPasswordTokenKey` (Firebase's
|
|
60
|
+
* `oobCode`); a `code` in the data is used instead when it's given.
|
|
61
|
+
*/
|
|
62
|
+
resetPassword({ code, password }: {
|
|
63
|
+
code?: string;
|
|
64
|
+
password: string;
|
|
65
|
+
}): Observable<NbAuthResult>;
|
|
66
|
+
/** Firebase's confirmPasswordReset, for the strategy's Auth. */
|
|
67
|
+
protected confirmPasswordReset(code: string, password: string): Promise<void>;
|
|
68
|
+
protected updatePassword(user: User, password: string, module: string): Observable<NbAuthResult<unknown> | NbAuthResult<undefined>>;
|
|
69
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NbFirebasePasswordStrategy, never>;
|
|
70
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
71
|
+
}
|
|
72
|
+
export declare class NbFirebaseIdentityProviderStrategyOptions extends NbAuthStrategyOptions {
|
|
73
|
+
token?: NbStrategyToken;
|
|
74
|
+
logout?: boolean | NbPasswordStrategyModule;
|
|
75
|
+
authenticate?: boolean | NbPasswordStrategyModule;
|
|
76
|
+
refreshToken?: boolean | NbPasswordStrategyModule;
|
|
77
|
+
errors?: NbPasswordStrategyMessage;
|
|
78
|
+
messages?: NbPasswordStrategyMessage;
|
|
79
|
+
scopes?: string[];
|
|
80
|
+
customParameters?: {
|
|
81
|
+
[key: string]: string;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export declare class NbFirebaseGoogleStrategy extends NbFirebaseBaseStrategy<NbFirebaseIdentityProviderStrategyOptions> {
|
|
85
|
+
protected defaultOptions: NbFirebaseIdentityProviderStrategyOptions;
|
|
86
|
+
static setup(options: NbFirebaseIdentityProviderStrategyOptions): [NbAuthStrategyClass, NbAuthStrategyOptions];
|
|
87
|
+
authenticate(_data?: unknown): Observable<NbAuthResult>;
|
|
88
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NbFirebaseGoogleStrategy, never>;
|
|
89
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
90
|
+
}
|
|
91
|
+
export declare class NbFirebaseFacebookStrategy extends NbFirebaseBaseStrategy<NbFirebaseIdentityProviderStrategyOptions> {
|
|
92
|
+
protected defaultOptions: NbFirebaseIdentityProviderStrategyOptions;
|
|
93
|
+
static setup(options: NbFirebaseIdentityProviderStrategyOptions): [NbAuthStrategyClass, NbAuthStrategyOptions];
|
|
94
|
+
authenticate(_data?: unknown): Observable<NbAuthResult>;
|
|
95
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NbFirebaseFacebookStrategy, never>;
|
|
96
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
97
|
+
}
|
|
98
|
+
export declare class NbFirebaseTwitterStrategy extends NbFirebaseBaseStrategy<NbFirebaseIdentityProviderStrategyOptions> {
|
|
99
|
+
protected defaultOptions: NbFirebaseIdentityProviderStrategyOptions;
|
|
100
|
+
static setup(options: NbFirebaseIdentityProviderStrategyOptions): [NbAuthStrategyClass, NbAuthStrategyOptions];
|
|
101
|
+
authenticate(_data?: unknown): Observable<NbAuthResult>;
|
|
102
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NbFirebaseTwitterStrategy, never>;
|
|
103
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
104
|
+
}
|
|
105
|
+
/** @deprecated The old, misspelt name of `NbFirebaseTwitterStrategy`. */
|
|
106
|
+
export declare const NbFirebaseTwitteStrategy: typeof NbFirebaseTwitterStrategy;
|
|
107
|
+
/** @deprecated The old, misspelt name of `NbFirebaseTwitterStrategy`. */
|
|
108
|
+
export type NbFirebaseTwitteStrategy = NbFirebaseTwitterStrategy;
|
|
109
|
+
/**
|
|
110
|
+
* Provides the Firebase auth strategies, in place of importing `NbFirebaseAuthModule`.
|
|
111
|
+
*/
|
|
112
|
+
export declare function provideNbFirebaseAuth(): EnvironmentProviders;
|
|
113
|
+
export declare class NbFirebaseAuthModule {
|
|
114
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NbFirebaseAuthModule, never>;
|
|
115
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<NbFirebaseAuthModule, never, never, never>;
|
|
116
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<NbFirebaseAuthModule>;
|
|
117
|
+
}
|
|
118
|
+
export {};
|