@rtsee/auth 0.0.60 → 0.0.61
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/dist/auth/src/index.d.ts +3 -0
- package/dist/auth/src/index.d.ts.map +1 -0
- package/dist/auth/src/index.js +19 -0
- package/dist/auth/src/index.js.map +1 -0
- package/dist/auth/src/interfaces/AuthErrors.d.ts +12 -0
- package/dist/auth/src/interfaces/AuthErrors.d.ts.map +1 -0
- package/dist/auth/src/interfaces/AuthErrors.js +20 -0
- package/dist/auth/src/interfaces/AuthErrors.js.map +1 -0
- package/dist/auth/src/interfaces/AuthRequests.d.ts +10 -0
- package/dist/auth/src/interfaces/AuthRequests.d.ts.map +1 -0
- package/dist/auth/src/interfaces/AuthRequests.js +3 -0
- package/dist/auth/src/interfaces/AuthRequests.js.map +1 -0
- package/dist/auth/src/interfaces/AuthResponses.d.ts +10 -0
- package/dist/auth/src/interfaces/AuthResponses.d.ts.map +1 -0
- package/dist/auth/src/interfaces/AuthResponses.js +3 -0
- package/dist/auth/src/interfaces/AuthResponses.js.map +1 -0
- package/dist/auth/src/interfaces/AuthUser.d.ts +5 -0
- package/dist/auth/src/interfaces/AuthUser.d.ts.map +1 -0
- package/dist/auth/src/interfaces/AuthUser.js +3 -0
- package/dist/auth/src/interfaces/AuthUser.js.map +1 -0
- package/dist/auth/src/interfaces/RTSeeAuthOptions.d.ts +19 -0
- package/dist/auth/src/interfaces/RTSeeAuthOptions.d.ts.map +1 -0
- package/dist/auth/src/interfaces/RTSeeAuthOptions.js +18 -0
- package/dist/auth/src/interfaces/RTSeeAuthOptions.js.map +1 -0
- package/dist/auth/src/interfaces/index.d.ts +6 -0
- package/dist/auth/src/interfaces/index.d.ts.map +1 -0
- package/dist/auth/src/interfaces/index.js +22 -0
- package/dist/auth/src/interfaces/index.js.map +1 -0
- package/dist/auth/src/models/RTSeeAuth.d.ts +19 -0
- package/dist/auth/src/models/RTSeeAuth.d.ts.map +1 -0
- package/dist/auth/src/models/RTSeeAuth.js +48 -0
- package/dist/auth/src/models/RTSeeAuth.js.map +1 -0
- package/dist/auth/src/models/RTSeeAuthUser.d.ts +13 -0
- package/dist/auth/src/models/RTSeeAuthUser.d.ts.map +1 -0
- package/dist/auth/src/models/RTSeeAuthUser.js +58 -0
- package/dist/auth/src/models/RTSeeAuthUser.js.map +1 -0
- package/dist/auth/src/models/index.d.ts +3 -0
- package/dist/auth/src/models/index.d.ts.map +1 -0
- package/dist/auth/src/models/index.js +19 -0
- package/dist/auth/src/models/index.js.map +1 -0
- package/dist/auth/src/models/strategies/index.d.ts +2 -0
- package/dist/auth/src/models/strategies/index.d.ts.map +1 -0
- package/dist/auth/src/models/strategies/index.js +18 -0
- package/dist/auth/src/models/strategies/index.js.map +1 -0
- package/dist/auth/src/models/strategies/jwt-strategy.d.ts +4 -0
- package/dist/auth/src/models/strategies/jwt-strategy.d.ts.map +1 -0
- package/dist/auth/src/models/strategies/jwt-strategy.js +4 -0
- package/dist/auth/src/models/strategies/jwt-strategy.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./models"), exports);
|
|
18
|
+
__exportStar(require("./interfaces"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,+CAA6B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum AuthErrorsCodes {
|
|
2
|
+
USER_ALREADY_EXISTS = "user-already-exists",
|
|
3
|
+
NO_USER_OR_WRONG_PASSWORD = "no-user-or-wrong-password"
|
|
4
|
+
}
|
|
5
|
+
export interface IAuthError {
|
|
6
|
+
text: string;
|
|
7
|
+
recommendation: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const authErrorMessages: {
|
|
10
|
+
[key in AuthErrorsCodes]: IAuthError;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=AuthErrors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthErrors.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/AuthErrors.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,mBAAmB,wBAAwB;IAC3C,yBAAyB,8BAA8B;CACxD;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,iBAAiB,EAAE;KAAE,GAAG,IAAI,eAAe,GAAG,UAAU;CASpE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.authErrorMessages = exports.AuthErrorsCodes = void 0;
|
|
5
|
+
var AuthErrorsCodes;
|
|
6
|
+
(function (AuthErrorsCodes) {
|
|
7
|
+
AuthErrorsCodes["USER_ALREADY_EXISTS"] = "user-already-exists";
|
|
8
|
+
AuthErrorsCodes["NO_USER_OR_WRONG_PASSWORD"] = "no-user-or-wrong-password";
|
|
9
|
+
})(AuthErrorsCodes || (exports.AuthErrorsCodes = AuthErrorsCodes = {}));
|
|
10
|
+
exports.authErrorMessages = (_a = {},
|
|
11
|
+
_a[AuthErrorsCodes.USER_ALREADY_EXISTS] = {
|
|
12
|
+
text: 'User with such email already exists.',
|
|
13
|
+
recommendation: 'You can try out the forgot password form!'
|
|
14
|
+
},
|
|
15
|
+
_a[AuthErrorsCodes.NO_USER_OR_WRONG_PASSWORD] = {
|
|
16
|
+
text: 'User with such email and password combination does not exist.',
|
|
17
|
+
recommendation: 'Try out the forgot password form or sign up!'
|
|
18
|
+
},
|
|
19
|
+
_a);
|
|
20
|
+
//# sourceMappingURL=AuthErrors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthErrors.js","sourceRoot":"","sources":["../../../../src/interfaces/AuthErrors.ts"],"names":[],"mappings":";;;;AAAA,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,8DAA2C,CAAA;IAC3C,0EAAuD,CAAA;AACzD,CAAC,EAHW,eAAe,+BAAf,eAAe,QAG1B;AAOY,QAAA,iBAAiB;IAC5B,GAAC,eAAe,CAAC,mBAAmB,IAAG;QACrC,IAAI,EAAE,sCAAsC;QAC5C,cAAc,EAAE,2CAA2C;KAC5D;IACD,GAAC,eAAe,CAAC,yBAAyB,IAAG;QAC3C,IAAI,EAAE,+DAA+D;QACrE,cAAc,EAAE,8CAA8C;KAC/D;QACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthRequests.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/AuthRequests.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthRequests.js","sourceRoot":"","sources":["../../../../src/interfaces/AuthRequests.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IRTSeeAuthUser } from "@rtsee/auth";
|
|
2
|
+
export interface IRTSeeSignInResponse<T = any> {
|
|
3
|
+
user: IRTSeeAuthUser<T>;
|
|
4
|
+
token: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IRTSeeSignUpResponse {
|
|
7
|
+
token: string;
|
|
8
|
+
success: boolean;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=AuthResponses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthResponses.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/AuthResponses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,WAAW,oBAAoB,CAAC,CAAC,GAAG,GAAG;IAC3C,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthResponses.js","sourceRoot":"","sources":["../../../../src/interfaces/AuthResponses.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthUser.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/AuthUser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,KAAK,CAAC,CAAC,CAAC;IACvD,IAAI,CAAC,EAAE,CAAC,CAAC;CACV"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthUser.js","sourceRoot":"","sources":["../../../../src/interfaces/AuthUser.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IRTSeeAuthUser } from "@rtsee/auth";
|
|
2
|
+
export declare enum AuthEndpointsKeys {
|
|
3
|
+
SIGN_IN = "signIn",
|
|
4
|
+
SIGN_UP = "signUp",
|
|
5
|
+
FORGOT_PASSWORD = "forgotPassword",
|
|
6
|
+
RESET_PASSWORD = "resetPassword"
|
|
7
|
+
}
|
|
8
|
+
export interface IRTSeeAuthOptions<T = any> {
|
|
9
|
+
baseUrl: string;
|
|
10
|
+
endpoints?: {
|
|
11
|
+
[key in AuthEndpointsKeys]: string;
|
|
12
|
+
};
|
|
13
|
+
defaultPostLoginRoute?: string[];
|
|
14
|
+
onSignedIn(user: IRTSeeAuthUser<T>, token: string): void;
|
|
15
|
+
}
|
|
16
|
+
export declare const DEFAULT_ENDPOINTS: {
|
|
17
|
+
[key in AuthEndpointsKeys]: string;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=RTSeeAuthOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RTSeeAuthOptions.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/RTSeeAuthOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAuB,MAAM,aAAa,CAAC;AAEjE,oBAAY,iBAAiB;IAC3B,OAAO,WAAW;IAClB,OAAO,WAAW;IAClB,eAAe,mBAAmB;IAClC,cAAc,kBAAkB;CACjC;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,GAAG;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE;SAAG,GAAG,IAAI,iBAAiB,GAAG,MAAM;KAAG,CAAA;IACnD,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IAEjC,UAAU,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1D;AAED,eAAO,MAAM,iBAAiB,EAAE;KAAG,GAAG,IAAI,iBAAiB,GAAG,MAAM;CAKnE,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.DEFAULT_ENDPOINTS = exports.AuthEndpointsKeys = void 0;
|
|
5
|
+
var AuthEndpointsKeys;
|
|
6
|
+
(function (AuthEndpointsKeys) {
|
|
7
|
+
AuthEndpointsKeys["SIGN_IN"] = "signIn";
|
|
8
|
+
AuthEndpointsKeys["SIGN_UP"] = "signUp";
|
|
9
|
+
AuthEndpointsKeys["FORGOT_PASSWORD"] = "forgotPassword";
|
|
10
|
+
AuthEndpointsKeys["RESET_PASSWORD"] = "resetPassword";
|
|
11
|
+
})(AuthEndpointsKeys || (exports.AuthEndpointsKeys = AuthEndpointsKeys = {}));
|
|
12
|
+
exports.DEFAULT_ENDPOINTS = (_a = {},
|
|
13
|
+
_a[AuthEndpointsKeys.SIGN_IN] = 'auth/sign-in',
|
|
14
|
+
_a[AuthEndpointsKeys.SIGN_UP] = 'auth/sign-up',
|
|
15
|
+
_a[AuthEndpointsKeys.FORGOT_PASSWORD] = 'auth/forgot-password',
|
|
16
|
+
_a[AuthEndpointsKeys.RESET_PASSWORD] = 'auth/reset-password',
|
|
17
|
+
_a);
|
|
18
|
+
//# sourceMappingURL=RTSeeAuthOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RTSeeAuthOptions.js","sourceRoot":"","sources":["../../../../src/interfaces/RTSeeAuthOptions.ts"],"names":[],"mappings":";;;;AAEA,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC3B,uCAAkB,CAAA;IAClB,uCAAkB,CAAA;IAClB,uDAAkC,CAAA;IAClC,qDAAgC,CAAA;AAClC,CAAC,EALW,iBAAiB,iCAAjB,iBAAiB,QAK5B;AAUY,QAAA,iBAAiB;IAC5B,GAAC,iBAAiB,CAAC,OAAO,IAAG,cAAc;IAC3C,GAAC,iBAAiB,CAAC,OAAO,IAAG,cAAc;IAC3C,GAAC,iBAAiB,CAAC,eAAe,IAAG,sBAAsB;IAC3D,GAAC,iBAAiB,CAAC,cAAc,IAAG,qBAAqB;QAC1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./RTSeeAuthOptions"), exports);
|
|
18
|
+
__exportStar(require("./AuthResponses"), exports);
|
|
19
|
+
__exportStar(require("./AuthRequests"), exports);
|
|
20
|
+
__exportStar(require("./AuthUser"), exports);
|
|
21
|
+
__exportStar(require("./AuthErrors"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,kDAAgC;AAChC,iDAA+B;AAC/B,6CAA2B;AAC3B,+CAA6B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AuthEndpointsKeys, IRTSeeAuthOptions, IRTSeeAuthUser, IRTSeeSignInResponse, RTSeeAuthUser } from '@rtsee/auth';
|
|
2
|
+
export declare const LS_TOKEN_LABEL: string;
|
|
3
|
+
export declare const LS_USER_LABEL: string;
|
|
4
|
+
export declare class RTSeeAuth<T = any> implements IRTSeeAuthOptions<T> {
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
endpoints: {
|
|
7
|
+
[key in AuthEndpointsKeys]: string;
|
|
8
|
+
};
|
|
9
|
+
defaultPostLoginRoute: string[];
|
|
10
|
+
onSignedIn: (user: IRTSeeAuthUser<T>, token: string) => void;
|
|
11
|
+
user: RTSeeAuthUser<T> | null;
|
|
12
|
+
token: string | null;
|
|
13
|
+
constructor(options: IRTSeeAuthOptions<T>);
|
|
14
|
+
authenticate(response: IRTSeeSignInResponse<T>): void;
|
|
15
|
+
saveToBrowser(): void;
|
|
16
|
+
readFromBrowser(): void;
|
|
17
|
+
logOut(): void;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=RTSeeAuth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RTSeeAuth.d.ts","sourceRoot":"","sources":["../../../../src/models/RTSeeAuth.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAEjB,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,aAAa,EACd,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,cAAc,EAAE,MAAsB,CAAC;AACpD,eAAO,MAAM,aAAa,EAAE,MAAqB,CAAC;AAElD,qBAAa,SAAS,CAAC,CAAC,GAAG,GAAG,CAAE,YAAW,iBAAiB,CAAC,CAAC,CAAC;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE;SAAG,GAAG,IAAI,iBAAiB,GAAG,MAAM;KAAG,CAAC;IACnD,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,UAAU,EAAE,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7D,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAAQ;IACrC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAQ;gBAEhB,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC;IASzC,YAAY,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAQ9C,aAAa,IAAI,IAAI;IASrB,eAAe,IAAI,IAAI;IAUvB,MAAM;CAOP"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RTSeeAuth = exports.LS_USER_LABEL = exports.LS_TOKEN_LABEL = void 0;
|
|
4
|
+
var auth_1 = require("@rtsee/auth");
|
|
5
|
+
exports.LS_TOKEN_LABEL = 'rtsee-token';
|
|
6
|
+
exports.LS_USER_LABEL = 'rtsee-user';
|
|
7
|
+
var RTSeeAuth = /** @class */ (function () {
|
|
8
|
+
function RTSeeAuth(options) {
|
|
9
|
+
this.user = null;
|
|
10
|
+
this.token = null;
|
|
11
|
+
this.baseUrl = options.baseUrl;
|
|
12
|
+
this.endpoints = options.endpoints || auth_1.DEFAULT_ENDPOINTS;
|
|
13
|
+
this.defaultPostLoginRoute = options.defaultPostLoginRoute || ['/'];
|
|
14
|
+
this.onSignedIn = options.onSignedIn;
|
|
15
|
+
this.readFromBrowser();
|
|
16
|
+
}
|
|
17
|
+
RTSeeAuth.prototype.authenticate = function (response) {
|
|
18
|
+
this.user = new auth_1.RTSeeAuthUser(response.user);
|
|
19
|
+
this.token = response.token;
|
|
20
|
+
this.onSignedIn(this.user, this.token);
|
|
21
|
+
this.saveToBrowser();
|
|
22
|
+
};
|
|
23
|
+
RTSeeAuth.prototype.saveToBrowser = function () {
|
|
24
|
+
if (!this.token || !this.user) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
localStorage.setItem(exports.LS_TOKEN_LABEL, this.token);
|
|
28
|
+
localStorage.setItem(exports.LS_USER_LABEL, JSON.stringify(this.user.toJSON()));
|
|
29
|
+
};
|
|
30
|
+
RTSeeAuth.prototype.readFromBrowser = function () {
|
|
31
|
+
var userData = localStorage.getItem(exports.LS_USER_LABEL);
|
|
32
|
+
var token = localStorage.getItem(exports.LS_TOKEN_LABEL);
|
|
33
|
+
if (!userData || !token) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
var user = JSON.parse(userData);
|
|
37
|
+
this.authenticate({ user: user, token: token });
|
|
38
|
+
};
|
|
39
|
+
RTSeeAuth.prototype.logOut = function () {
|
|
40
|
+
this.user = null;
|
|
41
|
+
this.token = null;
|
|
42
|
+
localStorage.removeItem(exports.LS_USER_LABEL);
|
|
43
|
+
localStorage.removeItem(exports.LS_TOKEN_LABEL);
|
|
44
|
+
};
|
|
45
|
+
return RTSeeAuth;
|
|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E,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC1E,CAAC;IAED,mCAAe,GAAf;QACE,IAAM,QAAQ,GAAkB,YAAY,CAAC,OAAO,CAAC,qBAAa,CAAC,CAAC;QACpE,IAAM,KAAK,GAAW,YAAY,CAAC,OAAO,CAAC,sBAAc,CAAC,CAAC;QAE3D,IAAI,CAAC,QAAQ,IAAI,CAAC,KAAK,EAAE,CAAC;YAAC,OAAO;QAAC,CAAC;QAEpC,IAAM,IAAI,GAAsB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAsB,CAAC;QAC1E,IAAI,CAAC,YAAY,CAAC,EAAC,IAAI,MAAA,EAAE,KAAK,OAAA,EAAC,CAAC,CAAA;IAClC,CAAC;IAED,0BAAM,GAAN;QACE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAElB,YAAY,CAAC,UAAU,CAAC,qBAAa,CAAC,CAAC;QACvC,YAAY,CAAC,UAAU,CAAC,sBAAc,CAAC,CAAC;IAC1C,CAAC;IACH,gBAAC;AAAD,CAAC,AAnDD,IAmDC;AAnDY,8BAAS"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IRTSeeAuthUser } from "@rtsee/auth";
|
|
2
|
+
export declare class RTSeeAuthUser<T> implements IRTSeeAuthUser<T> {
|
|
3
|
+
clientId: string;
|
|
4
|
+
name: string | null;
|
|
5
|
+
imageUrl: string | null;
|
|
6
|
+
url: string | null;
|
|
7
|
+
sessionId: string | null;
|
|
8
|
+
isAnonymous: boolean;
|
|
9
|
+
data?: T;
|
|
10
|
+
constructor(options: IRTSeeAuthUser<T>);
|
|
11
|
+
toJSON(): IRTSeeAuthUser<T>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=RTSeeAuthUser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RTSeeAuthUser.d.ts","sourceRoot":"","sources":["../../../../src/models/RTSeeAuthUser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAE3C,qBAAa,aAAa,CAAC,CAAC,CAAE,YAAW,cAAc,CAAC,CAAC,CAAC;IACxD,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC3B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC/B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAQ;IAChC,WAAW,EAAE,OAAO,CAAS;IAE7B,IAAI,CAAC,EAAE,CAAC,CAAC;gBAEG,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;IAWtC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;CA+B5B"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RTSeeAuthUser = void 0;
|
|
4
|
+
var RTSeeAuthUser = /** @class */ (function () {
|
|
5
|
+
function RTSeeAuthUser(options) {
|
|
6
|
+
this.name = null;
|
|
7
|
+
this.imageUrl = null;
|
|
8
|
+
this.url = null;
|
|
9
|
+
this.sessionId = null;
|
|
10
|
+
this.isAnonymous = false;
|
|
11
|
+
this.clientId = options.clientId;
|
|
12
|
+
if (options.name) {
|
|
13
|
+
this.name = options.name;
|
|
14
|
+
}
|
|
15
|
+
if (options.imageUrl) {
|
|
16
|
+
this.imageUrl = options.imageUrl;
|
|
17
|
+
}
|
|
18
|
+
if (options.url) {
|
|
19
|
+
this.url = options.url;
|
|
20
|
+
}
|
|
21
|
+
if (options.sessionId) {
|
|
22
|
+
this.sessionId = options.sessionId;
|
|
23
|
+
}
|
|
24
|
+
if (options.isAnonymous) {
|
|
25
|
+
this.isAnonymous = options.isAnonymous;
|
|
26
|
+
}
|
|
27
|
+
if (options.data) {
|
|
28
|
+
this.data = options.data;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
RTSeeAuthUser.prototype.toJSON = function () {
|
|
32
|
+
var userInfo = {
|
|
33
|
+
clientId: this.clientId,
|
|
34
|
+
};
|
|
35
|
+
if (this.name) {
|
|
36
|
+
userInfo.name = this.name;
|
|
37
|
+
}
|
|
38
|
+
if (this.imageUrl) {
|
|
39
|
+
userInfo.imageUrl = this.imageUrl;
|
|
40
|
+
}
|
|
41
|
+
if (this.url) {
|
|
42
|
+
userInfo.url = this.url;
|
|
43
|
+
}
|
|
44
|
+
if (this.sessionId) {
|
|
45
|
+
userInfo.sessionId = this.sessionId;
|
|
46
|
+
}
|
|
47
|
+
if (this.isAnonymous) {
|
|
48
|
+
userInfo.isAnonymous = this.isAnonymous;
|
|
49
|
+
}
|
|
50
|
+
if (this.data) {
|
|
51
|
+
userInfo.data = this.data;
|
|
52
|
+
}
|
|
53
|
+
return userInfo;
|
|
54
|
+
};
|
|
55
|
+
return RTSeeAuthUser;
|
|
56
|
+
}());
|
|
57
|
+
exports.RTSeeAuthUser = RTSeeAuthUser;
|
|
58
|
+
//# sourceMappingURL=RTSeeAuthUser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RTSeeAuthUser.js","sourceRoot":"","sources":["../../../../src/models/RTSeeAuthUser.ts"],"names":[],"mappings":";;;AAEA;IAUE,uBAAY,OAA0B;QARtC,SAAI,GAAkB,IAAI,CAAC;QAC3B,aAAQ,GAAkB,IAAI,CAAC;QAC/B,QAAG,GAAkB,IAAI,CAAC;QAC1B,cAAS,GAAkB,IAAI,CAAC;QAChC,gBAAW,GAAY,KAAK,CAAC;QAK3B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QAEjC,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YAAC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAA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CAAC,IAAI,EAAE,CAAC;YACd,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;QAC3B,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IACH,oBAAC;AAAD,CAAC,AApDD,IAoDC;AApDY,sCAAa"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./RTSeeAuth"), exports);
|
|
18
|
+
__exportStar(require("./RTSeeAuthUser"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,kDAAgC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/models/strategies/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./jwt-strategy"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/models/strategies/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt-strategy.d.ts","sourceRoot":"","sources":["../../../../../src/models/strategies/jwt-strategy.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;CAGrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt-strategy.js","sourceRoot":"","sources":["../../../../../src/models/strategies/jwt-strategy.ts"],"names":[],"mappings":";AAAA,yEAAyE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rtsee/auth",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.61",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "dist/auth/src/index",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "468df28ddef4b2daa3f7780c7f4efeb3fea9365c"
|
|
45
45
|
}
|