@loopback/authentication 4.2.1 → 4.2.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/CHANGELOG.md +32 -0
- package/dist/authentication.component.js +17 -13
- package/dist/authentication.component.js.map +1 -1
- package/dist/decorators/authenticate.decorator.js +1 -0
- package/dist/decorators/authenticate.decorator.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/keys.d.ts +2 -1
- package/dist/keys.js +1 -0
- package/dist/keys.js.map +1 -1
- package/dist/providers/auth-action.provider.d.ts +0 -1
- package/dist/providers/auth-action.provider.js +65 -61
- package/dist/providers/auth-action.provider.js.map +1 -1
- package/dist/providers/auth-metadata.provider.js +32 -28
- package/dist/providers/auth-metadata.provider.js.map +1 -1
- package/dist/providers/auth-strategy.provider.js +36 -32
- package/dist/providers/auth-strategy.provider.js.map +1 -1
- package/dist/services/index.js +4 -0
- package/dist/services/index.js.map +1 -1
- package/dist/types.d.ts +2 -3
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/package.json +17 -17
- package/src/keys.ts +2 -2
- package/src/types.ts +2 -1
- package/index.d.ts +0 -6
- package/index.js +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,38 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.2.5](https://github.com/strongloop/loopback-next/compare/@loopback/authentication@4.2.4...@loopback/authentication@4.2.5) (2020-05-20)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @loopback/authentication
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [4.2.4](https://github.com/strongloop/loopback-next/compare/@loopback/authentication@4.2.3...@loopback/authentication@4.2.4) (2020-05-19)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @loopback/authentication
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [4.2.3](https://github.com/strongloop/loopback-next/compare/@loopback/authentication@4.2.2...@loopback/authentication@4.2.3) (2020-05-07)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @loopback/authentication
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [4.2.2](https://github.com/strongloop/loopback-next/compare/@loopback/authentication@4.2.1...@loopback/authentication@4.2.2) (2020-04-29)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @loopback/authentication
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
6
38
|
## [4.2.1](https://github.com/strongloop/loopback-next/compare/@loopback/authentication@4.2.0...@loopback/authentication@4.2.1) (2020-04-23)
|
|
7
39
|
|
|
8
40
|
**Note:** Version bump only for package @loopback/authentication
|
|
@@ -4,22 +4,26 @@
|
|
|
4
4
|
// This file is licensed under the MIT License.
|
|
5
5
|
// License text available at https://opensource.org/licenses/MIT
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.AuthenticationComponent = void 0;
|
|
7
8
|
const tslib_1 = require("tslib");
|
|
8
9
|
const core_1 = require("@loopback/core");
|
|
9
10
|
const keys_1 = require("./keys");
|
|
10
11
|
const providers_1 = require("./providers");
|
|
11
|
-
let AuthenticationComponent = class
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
let AuthenticationComponent = /** @class */ (() => {
|
|
13
|
+
let AuthenticationComponent = class AuthenticationComponent {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.providers = {
|
|
16
|
+
[keys_1.AuthenticationBindings.AUTH_ACTION.key]: providers_1.AuthenticateActionProvider,
|
|
17
|
+
[keys_1.AuthenticationBindings.STRATEGY.key]: providers_1.AuthenticationStrategyProvider,
|
|
18
|
+
[keys_1.AuthenticationBindings.METADATA.key]: providers_1.AuthMetadataProvider,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
AuthenticationComponent = tslib_1.__decorate([
|
|
23
|
+
core_1.bind({ tags: { [core_1.ContextTags.KEY]: keys_1.AuthenticationBindings.COMPONENT } }),
|
|
24
|
+
tslib_1.__metadata("design:paramtypes", [])
|
|
25
|
+
], AuthenticationComponent);
|
|
26
|
+
return AuthenticationComponent;
|
|
27
|
+
})();
|
|
24
28
|
exports.AuthenticationComponent = AuthenticationComponent;
|
|
25
29
|
//# sourceMappingURL=authentication.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.component.js","sourceRoot":"","sources":["../src/authentication.component.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,wCAAwC;AACxC,+CAA+C;AAC/C,gEAAgE
|
|
1
|
+
{"version":3,"file":"authentication.component.js","sourceRoot":"","sources":["../src/authentication.component.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,wCAAwC;AACxC,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,yCAAyE;AACzE,iCAA8C;AAC9C,2CAIqB;AAGrB;IAAA,IAAa,uBAAuB,GAApC,MAAa,uBAAuB;QAGlC;YACE,IAAI,CAAC,SAAS,GAAG;gBACf,CAAC,6BAAsB,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,sCAA0B;gBACpE,CAAC,6BAAsB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,0CAA8B;gBACrE,CAAC,6BAAsB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,gCAAoB;aAC5D,CAAC;QACJ,CAAC;KACF,CAAA;IAVY,uBAAuB;QADnC,WAAI,CAAC,EAAC,IAAI,EAAE,EAAC,CAAC,kBAAW,CAAC,GAAG,CAAC,EAAE,6BAAsB,CAAC,SAAS,EAAC,EAAC,CAAC;;OACvD,uBAAuB,CAUnC;IAAD,8BAAC;KAAA;AAVY,0DAAuB"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// This file is licensed under the MIT License.
|
|
5
5
|
// License text available at https://opensource.org/licenses/MIT
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.getAuthenticateMetadata = exports.authenticate = void 0;
|
|
7
8
|
const context_1 = require("@loopback/context");
|
|
8
9
|
const keys_1 = require("../keys");
|
|
9
10
|
class AuthenticateClassDecoratorFactory extends context_1.ClassDecoratorFactory {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.decorator.js","sourceRoot":"","sources":["../../src/decorators/authenticate.decorator.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,wCAAwC;AACxC,+CAA+C;AAC/C,gEAAgE
|
|
1
|
+
{"version":3,"file":"authenticate.decorator.js","sourceRoot":"","sources":["../../src/decorators/authenticate.decorator.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,wCAAwC;AACxC,+CAA+C;AAC/C,gEAAgE;;;AAEhE,+CAM2B;AAC3B,kCAIiB;AAGjB,MAAM,iCAAkC,SAAQ,+BAE/C;CAAG;AAEJ;;;;;;GAMG;AACH,SAAgB,YAAY,CAC1B,sBAAuD,EACvD,OAAgB;IAEhB,OAAO,SAAS,qCAAqC;IACnD,uBAAuB;IACvB,8DAA8D;IAC9D,MAAW,EACX,MAAe;IACf,6CAA6C;IAC7C,4DAA4D;IAC5D,8DAA8D;IAC9D,gBAA+C;QAE/C,IAAI,IAA4B,CAAC;QACjC,IAAI,OAAO,sBAAsB,KAAK,QAAQ,EAAE;YAC9C,IAAI,GAAG,sBAAsB,CAAC;SAC/B;aAAM;YACL,IAAI,GAAG,EAAC,QAAQ,EAAE,sBAAsB,EAAE,OAAO,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,EAAC,CAAC;SACnE;QACD,IAAI,MAAM,IAAI,gBAAgB,EAAE;YAC9B,SAAS;YACT,OAAO,gCAAsB,CAAC,eAAe,CAC3C,kCAA2B,EAC3B,IAAI,EACJ,EAAC,aAAa,EAAE,eAAe,EAAC,CACjC,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC;SACrC;QACD,IAAI,OAAO,MAAM,KAAK,UAAU,IAAI,CAAC,MAAM,IAAI,CAAC,gBAAgB,EAAE;YAChE,QAAQ;YACR,OAAO,iCAAiC,CAAC,eAAe,CACtD,wCAAiC,EACjC,IAAI,EACJ,EAAC,aAAa,EAAE,eAAe,EAAC,CACjC,CAAC,MAAM,CAAC,CAAC;SACX;QACD,2BAA2B;QAC3B,MAAM,IAAI,KAAK,CACb,2CAA2C;YACzC,0BAAgB,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,CAAC,CACnE,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AA1CD,oCA0CC;AAED,WAAiB,YAAY;IAC3B;;OAEG;IACU,iBAAI,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,EAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAC,CAAC,CAAC;AACrE,CAAC,EALgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAK5B;AAED;;;;;GAKG;AACH,SAAgB,uBAAuB,CACrC,WAA4B,EAC5B,UAAkB;IAElB,2BAA2B;IAC3B,IAAI,QAAQ,GAAG,2BAAiB,CAAC,iBAAiB,CAChD,yCAAkC,EAClC,WAAW,CAAC,SAAS,EACrB,UAAU,CACX,CAAC;IACF,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC9B,+CAA+C;IAC/C,QAAQ,GAAG,2BAAiB,CAAC,gBAAgB,CAC3C,wCAAiC,EACjC,WAAW,CACZ,CAAC;IACF,OAAO,QAAQ,CAAC;AAClB,CAAC;AAjBD,0DAiBC"}
|
package/dist/index.js
CHANGED
|
@@ -25,5 +25,6 @@ tslib_1.__exportStar(require("./authentication.component"), exports);
|
|
|
25
25
|
tslib_1.__exportStar(require("./decorators"), exports);
|
|
26
26
|
tslib_1.__exportStar(require("./keys"), exports);
|
|
27
27
|
tslib_1.__exportStar(require("./providers"), exports);
|
|
28
|
+
tslib_1.__exportStar(require("./services"), exports);
|
|
28
29
|
tslib_1.__exportStar(require("./types"), exports);
|
|
29
30
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,wCAAwC;AACxC,+CAA+C;AAC/C,gEAAgE;;;AAEhE;;;;;;;;;;;;;;;GAeG;AAEH,qEAA2C;AAC3C,uDAA6B;AAC7B,iDAAuB;AACvB,sDAA4B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,wCAAwC;AACxC,+CAA+C;AAC/C,gEAAgE;;;AAEhE;;;;;;;;;;;;;;;GAeG;AAEH,qEAA2C;AAC3C,uDAA6B;AAC7B,iDAAuB;AACvB,sDAA4B;AAC5B,qDAA2B;AAC3B,kDAAwB"}
|
package/dist/keys.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BindingKey } from '@loopback/context';
|
|
2
2
|
import { MetadataAccessor } from '@loopback/metadata';
|
|
3
|
+
import { UserProfile } from '@loopback/security';
|
|
3
4
|
import { AuthenticationComponent } from './authentication.component';
|
|
4
5
|
import { AuthenticateFn, AuthenticationMetadata, AuthenticationStrategy, UserProfileFactory } from './types';
|
|
5
6
|
/**
|
|
@@ -86,7 +87,7 @@ export declare namespace AuthenticationBindings {
|
|
|
86
87
|
*/
|
|
87
88
|
const METADATA: BindingKey<AuthenticationMetadata | undefined>;
|
|
88
89
|
const AUTHENTICATION_STRATEGY_EXTENSION_POINT_NAME = "authentication.strategies";
|
|
89
|
-
const CURRENT_USER: BindingKey<
|
|
90
|
+
const CURRENT_USER: BindingKey<UserProfile>;
|
|
90
91
|
const AUTHENTICATION_REDIRECT_URL: BindingKey<string>;
|
|
91
92
|
const AUTHENTICATION_REDIRECT_STATUS: BindingKey<number>;
|
|
92
93
|
}
|
package/dist/keys.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// This file is licensed under the MIT License.
|
|
5
5
|
// License text available at https://opensource.org/licenses/MIT
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.AUTHENTICATION_METADATA_CLASS_KEY = exports.AUTHENTICATION_METADATA_KEY = exports.AUTHENTICATION_METADATA_METHOD_KEY = exports.AuthenticationBindings = void 0;
|
|
7
8
|
const context_1 = require("@loopback/context");
|
|
8
9
|
const metadata_1 = require("@loopback/metadata");
|
|
9
10
|
const security_1 = require("@loopback/security");
|
package/dist/keys.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,wCAAwC;AACxC,+CAA+C;AAC/C,gEAAgE
|
|
1
|
+
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,wCAAwC;AACxC,+CAA+C;AAC/C,gEAAgE;;;AAEhE,+CAA6C;AAC7C,iDAAoD;AACpD,iDAAiE;AASjE;;GAEG;AACH,IAAiB,sBAAsB,CA+GtC;AA/GD,WAAiB,sBAAsB;IACxB,gCAAS,GAAG,oBAAU,CAAC,MAAM,CACxC,oCAAoC,CACrC,CAAC;IAEF;;;;;;;;;;;OAWG;IACH,uDAAuD;IAC1C,2CAAoB,GAAG,oBAAU,CAAC,MAAM,CAEnD,mCAAmC,CAAC,CAAC;IAEvC;;;;;;;;;;OAUG;IACU,+BAAQ,GAAG,oBAAU,CAAC,MAAM,CACvC,yBAAyB,CAC1B,CAAC;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACU,kCAAW,GAAG,oBAAU,CAAC,MAAM,CAC1C,qCAAqC,CACtC,CAAC;IAEF;;;;;;;;;;;;;;;;;;;OAmBG;IACU,+BAAQ,GAAG,oBAAU,CAAC,MAAM,CACvC,kCAAkC,CACnC,CAAC;IAEW,mEAA4C,GACvD,2BAA2B,CAAC;IAE9B,oFAAoF;IACvE,mCAAY,GAA4B,2BAAgB,CAAC,IAAI,CAAC;IAE3E,+CAA+C;IAClC,kDAA2B,GAAG,oBAAU,CAAC,MAAM,CAC1D,6BAA6B,CAC9B,CAAC;IAEF,2FAA2F;IAC9E,qDAA8B,GAAG,oBAAU,CAAC,MAAM,CAC7D,gCAAgC,CACjC,CAAC;AACJ,CAAC,EA/GgB,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QA+GtC;AAED;;GAEG;AACU,QAAA,kCAAkC,GAAG,2BAAgB,CAAC,MAAM,CAGvE,uBAAuB,CAAC,CAAC;AAE3B;;GAEG;AACU,QAAA,2BAA2B,GAAG,0CAAkC,CAAC;AAE9E;;GAEG;AACU,QAAA,iCAAiC,GAAG,2BAAgB,CAAC,MAAM,CAGtE,sBAAsB,CAAC,CAAC"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// This file is licensed under the MIT License.
|
|
5
5
|
// License text available at https://opensource.org/licenses/MIT
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.AuthenticateActionProvider = void 0;
|
|
7
8
|
const tslib_1 = require("tslib");
|
|
8
9
|
const context_1 = require("@loopback/context");
|
|
9
10
|
const rest_1 = require("@loopback/rest");
|
|
@@ -14,69 +15,72 @@ const types_1 = require("../types");
|
|
|
14
15
|
* Provides the authentication action for a sequence
|
|
15
16
|
* @example `context.bind('authentication.actions.authenticate').toProvider(AuthenticateActionProvider)`
|
|
16
17
|
*/
|
|
17
|
-
let AuthenticateActionProvider = class
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @returns authenticateFn
|
|
34
|
-
*/
|
|
35
|
-
value() {
|
|
36
|
-
return request => this.action(request);
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* The implementation of authenticate() sequence action.
|
|
40
|
-
* @param request - The incoming request provided by the REST layer
|
|
41
|
-
*/
|
|
42
|
-
async action(request) {
|
|
43
|
-
const strategy = await this.getStrategy();
|
|
44
|
-
if (!strategy) {
|
|
45
|
-
// The invoked operation does not require authentication.
|
|
46
|
-
return undefined;
|
|
18
|
+
let AuthenticateActionProvider = /** @class */ (() => {
|
|
19
|
+
let AuthenticateActionProvider = class AuthenticateActionProvider {
|
|
20
|
+
constructor(
|
|
21
|
+
// The provider is instantiated for Sequence constructor,
|
|
22
|
+
// at which time we don't have information about the current
|
|
23
|
+
// route yet. This information is needed to determine
|
|
24
|
+
// what auth strategy should be used.
|
|
25
|
+
// To solve this, we are injecting a getter function that will
|
|
26
|
+
// defer resolution of the strategy until authenticate() action
|
|
27
|
+
// is executed.
|
|
28
|
+
getStrategy, setCurrentUser, setRedirectUrl, setRedirectStatus) {
|
|
29
|
+
this.getStrategy = getStrategy;
|
|
30
|
+
this.setCurrentUser = setCurrentUser;
|
|
31
|
+
this.setRedirectUrl = setRedirectUrl;
|
|
32
|
+
this.setRedirectStatus = setRedirectStatus;
|
|
47
33
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
// bind redirection url and status to the context
|
|
54
|
-
// controller should handle actual redirection
|
|
55
|
-
this.setRedirectUrl(redirectOptions.targetLocation);
|
|
56
|
-
this.setRedirectStatus(redirectOptions.statusCode);
|
|
34
|
+
/**
|
|
35
|
+
* @returns authenticateFn
|
|
36
|
+
*/
|
|
37
|
+
value() {
|
|
38
|
+
return request => this.action(request);
|
|
57
39
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
40
|
+
/**
|
|
41
|
+
* The implementation of authenticate() sequence action.
|
|
42
|
+
* @param request - The incoming request provided by the REST layer
|
|
43
|
+
*/
|
|
44
|
+
async action(request) {
|
|
45
|
+
const strategy = await this.getStrategy();
|
|
46
|
+
if (!strategy) {
|
|
47
|
+
// The invoked operation does not require authentication.
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
const authResponse = await strategy.authenticate(request);
|
|
51
|
+
let userProfile;
|
|
52
|
+
// response from `strategy.authenticate()` could return an object of type UserProfile or RedirectRoute
|
|
53
|
+
if (rest_1.RedirectRoute.isRedirectRoute(authResponse)) {
|
|
54
|
+
const redirectOptions = authResponse;
|
|
55
|
+
// bind redirection url and status to the context
|
|
56
|
+
// controller should handle actual redirection
|
|
57
|
+
this.setRedirectUrl(redirectOptions.targetLocation);
|
|
58
|
+
this.setRedirectStatus(redirectOptions.statusCode);
|
|
59
|
+
}
|
|
60
|
+
else if (authResponse) {
|
|
61
|
+
// if `strategy.authenticate()` returns an object of type UserProfile, set it as current user
|
|
62
|
+
userProfile = authResponse;
|
|
63
|
+
this.setCurrentUser(userProfile);
|
|
64
|
+
return userProfile;
|
|
65
|
+
}
|
|
66
|
+
else if (!authResponse) {
|
|
67
|
+
// important to throw a non-protocol-specific error here
|
|
68
|
+
const error = new Error(`User profile not returned from strategy's authenticate function`);
|
|
69
|
+
Object.assign(error, {
|
|
70
|
+
code: types_1.USER_PROFILE_NOT_FOUND,
|
|
71
|
+
});
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
63
74
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
};
|
|
74
|
-
AuthenticateActionProvider = tslib_1.__decorate([
|
|
75
|
-
tslib_1.__param(0, context_1.inject.getter(keys_1.AuthenticationBindings.STRATEGY)),
|
|
76
|
-
tslib_1.__param(1, context_1.inject.setter(security_1.SecurityBindings.USER)),
|
|
77
|
-
tslib_1.__param(2, context_1.inject.setter(keys_1.AuthenticationBindings.AUTHENTICATION_REDIRECT_URL)),
|
|
78
|
-
tslib_1.__param(3, context_1.inject.setter(keys_1.AuthenticationBindings.AUTHENTICATION_REDIRECT_STATUS)),
|
|
79
|
-
tslib_1.__metadata("design:paramtypes", [Function, Function, Function, Function])
|
|
80
|
-
], AuthenticateActionProvider);
|
|
75
|
+
};
|
|
76
|
+
AuthenticateActionProvider = tslib_1.__decorate([
|
|
77
|
+
tslib_1.__param(0, context_1.inject.getter(keys_1.AuthenticationBindings.STRATEGY)),
|
|
78
|
+
tslib_1.__param(1, context_1.inject.setter(security_1.SecurityBindings.USER)),
|
|
79
|
+
tslib_1.__param(2, context_1.inject.setter(keys_1.AuthenticationBindings.AUTHENTICATION_REDIRECT_URL)),
|
|
80
|
+
tslib_1.__param(3, context_1.inject.setter(keys_1.AuthenticationBindings.AUTHENTICATION_REDIRECT_STATUS)),
|
|
81
|
+
tslib_1.__metadata("design:paramtypes", [Function, Function, Function, Function])
|
|
82
|
+
], AuthenticateActionProvider);
|
|
83
|
+
return AuthenticateActionProvider;
|
|
84
|
+
})();
|
|
81
85
|
exports.AuthenticateActionProvider = AuthenticateActionProvider;
|
|
82
86
|
//# sourceMappingURL=auth-action.provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-action.provider.js","sourceRoot":"","sources":["../../src/providers/auth-action.provider.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,wCAAwC;AACxC,+CAA+C;AAC/C,gEAAgE
|
|
1
|
+
{"version":3,"file":"auth-action.provider.js","sourceRoot":"","sources":["../../src/providers/auth-action.provider.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,wCAAwC;AACxC,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,+CAAmE;AACnE,yCAAsD;AACtD,iDAAiE;AACjE,kCAA+C;AAC/C,oCAIkB;AAClB;;;GAGG;AACH;IAAA,IAAa,0BAA0B,GAAvC,MAAa,0BAA0B;QACrC;QACE,yDAAyD;QACzD,4DAA4D;QAC5D,qDAAqD;QACrD,qCAAqC;QACrC,8DAA8D;QAC9D,+DAA+D;QAC/D,eAAe;QAEN,WAA2C,EAE3C,cAAmC,EAEnC,cAA8B,EAE9B,iBAAiC;YANjC,gBAAW,GAAX,WAAW,CAAgC;YAE3C,mBAAc,GAAd,cAAc,CAAqB;YAEnC,mBAAc,GAAd,cAAc,CAAgB;YAE9B,sBAAiB,GAAjB,iBAAiB,CAAgB;QACzC,CAAC;QAEJ;;WAEG;QACH,KAAK;YACH,OAAO,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACzC,CAAC;QAED;;;WAGG;QACH,KAAK,CAAC,MAAM,CAAC,OAAgB;YAC3B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;YAC1C,IAAI,CAAC,QAAQ,EAAE;gBACb,yDAAyD;gBACzD,OAAO,SAAS,CAAC;aAClB;YAED,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;YAC1D,IAAI,WAAwB,CAAC;YAE7B,sGAAsG;YACtG,IAAI,oBAAa,CAAC,eAAe,CAAC,YAAY,CAAC,EAAE;gBAC/C,MAAM,eAAe,GAAG,YAAY,CAAC;gBACrC,iDAAiD;gBACjD,8CAA8C;gBAC9C,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;gBACpD,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;aACpD;iBAAM,IAAI,YAAY,EAAE;gBACvB,6FAA6F;gBAC7F,WAAW,GAAG,YAA2B,CAAC;gBAC1C,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;gBACjC,OAAO,WAAW,CAAC;aACpB;iBAAM,IAAI,CAAC,YAAY,EAAE;gBACxB,wDAAwD;gBACxD,MAAM,KAAK,GAAG,IAAI,KAAK,CACrB,iEAAiE,CAClE,CAAC;gBACF,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;oBACnB,IAAI,EAAE,8BAAsB;iBAC7B,CAAC,CAAC;gBACH,MAAM,KAAK,CAAC;aACb;QACH,CAAC;KACF,CAAA;IA/DY,0BAA0B;QASlC,mBAAA,gBAAM,CAAC,MAAM,CAAC,6BAAsB,CAAC,QAAQ,CAAC,CAAA;QAE9C,mBAAA,gBAAM,CAAC,MAAM,CAAC,2BAAgB,CAAC,IAAI,CAAC,CAAA;QAEpC,mBAAA,gBAAM,CAAC,MAAM,CAAC,6BAAsB,CAAC,2BAA2B,CAAC,CAAA;QAEjE,mBAAA,gBAAM,CAAC,MAAM,CAAC,6BAAsB,CAAC,8BAA8B,CAAC,CAAA;;OAf5D,0BAA0B,CA+DtC;IAAD,iCAAC;KAAA;AA/DY,gEAA0B"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// This file is licensed under the MIT License.
|
|
5
5
|
// License text available at https://opensource.org/licenses/MIT
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.AuthMetadataProvider = void 0;
|
|
7
8
|
const tslib_1 = require("tslib");
|
|
8
9
|
const context_1 = require("@loopback/context");
|
|
9
10
|
const core_1 = require("@loopback/core");
|
|
@@ -13,33 +14,36 @@ const keys_1 = require("../keys");
|
|
|
13
14
|
* Provides authentication metadata of a controller method
|
|
14
15
|
* @example `context.bind('authentication.operationMetadata').toProvider(AuthMetadataProvider)`
|
|
15
16
|
*/
|
|
16
|
-
let AuthMetadataProvider = class
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
tslib_1.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
17
|
+
let AuthMetadataProvider = /** @class */ (() => {
|
|
18
|
+
let AuthMetadataProvider = class AuthMetadataProvider {
|
|
19
|
+
constructor(controllerClass, methodName, options = {}) {
|
|
20
|
+
this.controllerClass = controllerClass;
|
|
21
|
+
this.methodName = methodName;
|
|
22
|
+
this.options = options;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @returns AuthenticationMetadata
|
|
26
|
+
*/
|
|
27
|
+
value() {
|
|
28
|
+
if (!this.controllerClass || !this.methodName)
|
|
29
|
+
return;
|
|
30
|
+
const metadata = decorators_1.getAuthenticateMetadata(this.controllerClass, this.methodName);
|
|
31
|
+
// Skip authentication if `skip` is `true`
|
|
32
|
+
if (metadata === null || metadata === void 0 ? void 0 : metadata.skip)
|
|
33
|
+
return undefined;
|
|
34
|
+
if (metadata)
|
|
35
|
+
return metadata;
|
|
36
|
+
// Fall back to default metadata
|
|
37
|
+
return this.options.defaultMetadata;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
AuthMetadataProvider = tslib_1.__decorate([
|
|
41
|
+
tslib_1.__param(0, context_1.inject(core_1.CoreBindings.CONTROLLER_CLASS, { optional: true })),
|
|
42
|
+
tslib_1.__param(1, context_1.inject(core_1.CoreBindings.CONTROLLER_METHOD_NAME, { optional: true })),
|
|
43
|
+
tslib_1.__param(2, context_1.config({ fromBinding: keys_1.AuthenticationBindings.COMPONENT })),
|
|
44
|
+
tslib_1.__metadata("design:paramtypes", [Object, String, Object])
|
|
45
|
+
], AuthMetadataProvider);
|
|
46
|
+
return AuthMetadataProvider;
|
|
47
|
+
})();
|
|
44
48
|
exports.AuthMetadataProvider = AuthMetadataProvider;
|
|
45
49
|
//# sourceMappingURL=auth-metadata.provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-metadata.provider.js","sourceRoot":"","sources":["../../src/providers/auth-metadata.provider.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,wCAAwC;AACxC,+CAA+C;AAC/C,gEAAgE
|
|
1
|
+
{"version":3,"file":"auth-metadata.provider.js","sourceRoot":"","sources":["../../src/providers/auth-metadata.provider.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,wCAAwC;AACxC,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,+CAAwE;AACxE,yCAA4C;AAC5C,8CAAsD;AACtD,kCAA+C;AAG/C;;;GAGG;AACH;IAAA,IAAa,oBAAoB,GAAjC,MAAa,oBAAoB;QAE/B,YAEmB,eAAgC,EAEhC,UAAkB,EAElB,UAAiC,EAAE;YAJnC,oBAAe,GAAf,eAAe,CAAiB;YAEhC,eAAU,GAAV,UAAU,CAAQ;YAElB,YAAO,GAAP,OAAO,CAA4B;QACnD,CAAC;QAEJ;;WAEG;QACH,KAAK;YACH,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,UAAU;gBAAE,OAAO;YACtD,MAAM,QAAQ,GAAG,oCAAuB,CACtC,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,UAAU,CAChB,CAAC;YACF,0CAA0C;YAC1C,IAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI;gBAAE,OAAO,SAAS,CAAC;YACrC,IAAI,QAAQ;gBAAE,OAAO,QAAQ,CAAC;YAC9B,gCAAgC;YAChC,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;QACtC,CAAC;KACF,CAAA;IA1BY,oBAAoB;QAG5B,mBAAA,gBAAM,CAAC,mBAAY,CAAC,gBAAgB,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAA;QAEvD,mBAAA,gBAAM,CAAC,mBAAY,CAAC,sBAAsB,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAA;QAE7D,mBAAA,gBAAM,CAAC,EAAC,WAAW,EAAE,6BAAsB,CAAC,SAAS,EAAC,CAAC,CAAA;;OAP/C,oBAAoB,CA0BhC;IAAD,2BAAC;KAAA;AA1BY,oDAAoB"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// This file is licensed under the MIT License.
|
|
5
5
|
// License text available at https://opensource.org/licenses/MIT
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.AuthenticationStrategyProvider = void 0;
|
|
7
8
|
const tslib_1 = require("tslib");
|
|
8
9
|
const context_1 = require("@loopback/context");
|
|
9
10
|
const core_1 = require("@loopback/core");
|
|
@@ -18,39 +19,42 @@ const types_1 = require("../types");
|
|
|
18
19
|
*
|
|
19
20
|
* @example `context.bind('authentication.strategy').toProvider(AuthenticationStrategyProvider)`
|
|
20
21
|
*/
|
|
21
|
-
let AuthenticationStrategyProvider = class
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
async value() {
|
|
27
|
-
if (!this.metadata) {
|
|
28
|
-
return undefined;
|
|
22
|
+
let AuthenticationStrategyProvider = /** @class */ (() => {
|
|
23
|
+
let AuthenticationStrategyProvider = class AuthenticationStrategyProvider {
|
|
24
|
+
constructor(authenticationStrategies, metadata) {
|
|
25
|
+
this.authenticationStrategies = authenticationStrategies;
|
|
26
|
+
this.metadata = metadata;
|
|
29
27
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
async value() {
|
|
29
|
+
if (!this.metadata) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
const name = this.metadata.strategy;
|
|
33
|
+
const strategy = await this.findAuthenticationStrategy(name);
|
|
34
|
+
if (!strategy) {
|
|
35
|
+
// important to throw a non-protocol-specific error here
|
|
36
|
+
const error = new Error(`The strategy '${name}' is not available.`);
|
|
37
|
+
Object.assign(error, {
|
|
38
|
+
code: types_1.AUTHENTICATION_STRATEGY_NOT_FOUND,
|
|
39
|
+
});
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
return strategy;
|
|
39
43
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
async findAuthenticationStrategy(name) {
|
|
45
|
+
const strategies = await this.authenticationStrategies();
|
|
46
|
+
const matchingAuthStrategy = strategies.find(a => a.name === name);
|
|
47
|
+
return matchingAuthStrategy;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
AuthenticationStrategyProvider = tslib_1.__decorate([
|
|
51
|
+
core_1.extensionPoint(keys_1.AuthenticationBindings.AUTHENTICATION_STRATEGY_EXTENSION_POINT_NAME, { scope: context_1.BindingScope.TRANSIENT }) //this needs to be transient, e.g. for request level context.
|
|
52
|
+
,
|
|
53
|
+
tslib_1.__param(0, core_1.extensions()),
|
|
54
|
+
tslib_1.__param(1, context_1.inject(keys_1.AuthenticationBindings.METADATA)),
|
|
55
|
+
tslib_1.__metadata("design:paramtypes", [Function, Object])
|
|
56
|
+
], AuthenticationStrategyProvider);
|
|
57
|
+
return AuthenticationStrategyProvider;
|
|
58
|
+
})();
|
|
55
59
|
exports.AuthenticationStrategyProvider = AuthenticationStrategyProvider;
|
|
56
60
|
//# sourceMappingURL=auth-strategy.provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-strategy.provider.js","sourceRoot":"","sources":["../../src/providers/auth-strategy.provider.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,wCAAwC;AACxC,+CAA+C;AAC/C,gEAAgE
|
|
1
|
+
{"version":3,"file":"auth-strategy.provider.js","sourceRoot":"","sources":["../../src/providers/auth-strategy.provider.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,wCAAwC;AACxC,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,+CAA+D;AAC/D,yCAAoE;AACpE,kCAA+C;AAC/C,oCAIkB;AAElB;;;;;;;;GAQG;AAKH;IAAA,IAAa,8BAA8B,GAA3C,MAAa,8BAA8B;QAEzC,YAEY,wBAA0D,EAE1D,QAAiC;YAFjC,6BAAwB,GAAxB,wBAAwB,CAAkC;YAE1D,aAAQ,GAAR,QAAQ,CAAyB;QAC1C,CAAC;QACJ,KAAK,CAAC,KAAK;YACT,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;gBAClB,OAAO,SAAS,CAAC;aAClB;YACD,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;YACpC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,CAAC;YAC7D,IAAI,CAAC,QAAQ,EAAE;gBACb,wDAAwD;gBACxD,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,iBAAiB,IAAI,qBAAqB,CAAC,CAAC;gBACpE,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;oBACnB,IAAI,EAAE,yCAAiC;iBACxC,CAAC,CAAC;gBACH,MAAM,KAAK,CAAC;aACb;YACD,OAAO,QAAQ,CAAC;QAClB,CAAC;QAED,KAAK,CAAC,0BAA0B,CAAC,IAAY;YAC3C,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,wBAAwB,EAAE,CAAC;YACzD,MAAM,oBAAoB,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;YACnE,OAAO,oBAAoB,CAAC;QAC9B,CAAC;KACF,CAAA;IA9BY,8BAA8B;QAJ1C,qBAAc,CACb,6BAAsB,CAAC,4CAA4C,EACnE,EAAC,KAAK,EAAE,sBAAY,CAAC,SAAS,EAAC,CAChC,CAAC,6DAA6D;;QAI1D,mBAAA,iBAAU,EAAE,CAAA;QAEZ,mBAAA,gBAAM,CAAC,6BAAsB,CAAC,QAAQ,CAAC,CAAA;;OAL/B,8BAA8B,CA8B1C;IAAD,qCAAC;KAAA;AA9BY,wEAA8B"}
|
package/dist/services/index.js
CHANGED
|
@@ -4,4 +4,8 @@
|
|
|
4
4
|
// This file is licensed under the MIT License.
|
|
5
5
|
// License text available at https://opensource.org/licenses/MIT
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
tslib_1.__exportStar(require("./token.service"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./user.service"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./user-identity.service"), exports);
|
|
7
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,wCAAwC;AACxC,+CAA+C;AAC/C,gEAAgE"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,wCAAwC;AACxC,+CAA+C;AAC/C,gEAAgE;;;AAEhE,0DAAgC;AAChC,yDAA+B;AAC/B,kEAAwC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { BindingTemplate, Constructor, Context } from '@loopback/core';
|
|
1
|
+
import { Binding, BindingTemplate, Constructor, Context } from '@loopback/core';
|
|
3
2
|
import { Request, RedirectRoute } from '@loopback/rest';
|
|
4
3
|
import { UserProfile } from '@loopback/security';
|
|
5
4
|
/**
|
|
@@ -83,7 +82,7 @@ export declare const USER_PROFILE_NOT_FOUND = "USER_PROFILE_NOT_FOUND";
|
|
|
83
82
|
* @param context - Context object
|
|
84
83
|
* @param strategyClass - Class for the authentication strategy
|
|
85
84
|
*/
|
|
86
|
-
export declare function registerAuthenticationStrategy(context: Context, strategyClass: Constructor<AuthenticationStrategy>):
|
|
85
|
+
export declare function registerAuthenticationStrategy(context: Context, strategyClass: Constructor<AuthenticationStrategy>): Binding<unknown>;
|
|
87
86
|
/**
|
|
88
87
|
* A binding template for auth strategy contributor extensions
|
|
89
88
|
*/
|
package/dist/types.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// This file is licensed under the MIT License.
|
|
5
5
|
// License text available at https://opensource.org/licenses/MIT
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.asAuthStrategy = exports.registerAuthenticationStrategy = exports.USER_PROFILE_NOT_FOUND = exports.AUTHENTICATION_STRATEGY_NOT_FOUND = void 0;
|
|
7
8
|
const core_1 = require("@loopback/core");
|
|
8
9
|
const keys_1 = require("./keys");
|
|
9
10
|
exports.AUTHENTICATION_STRATEGY_NOT_FOUND = 'AUTHENTICATION_STRATEGY_NOT_FOUND';
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,wCAAwC;AACxC,+CAA+C;AAC/C,gEAAgE
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,wCAAwC;AACxC,+CAA+C;AAC/C,gEAAgE;;;AAEhE,yCAOwB;AAGxB,iCAA8C;AAgFjC,QAAA,iCAAiC,GAC5C,mCAAmC,CAAC;AAEzB,QAAA,sBAAsB,GAAG,wBAAwB,CAAC;AAE/D;;;;;;;GAOG;AACH,SAAgB,8BAA8B,CAC5C,OAAgB,EAChB,aAAkD;IAElD,OAAO,mBAAY,CACjB,OAAO,EACP,6BAAsB,CAAC,4CAA4C,EACnE,aAAa,EACb;QACE,SAAS,EACP,6BAAsB,CAAC,4CAA4C;KACtE,CACF,CAAC;AACJ,CAAC;AAbD,wEAaC;AAED;;GAEG;AACU,QAAA,cAAc,GAAoB,OAAO,CAAC,EAAE;IACvD,mBAAY,CACV,6BAAsB,CAAC,4CAA4C,CACpE,CAAC,OAAO,CAAC,CAAC;IACX,OAAO,CAAC,GAAG,CAAC;QACV,SAAS,EACP,6BAAsB,CAAC,4CAA4C;KACtE,CAAC,CAAC;AACL,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loopback/authentication",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.5",
|
|
4
4
|
"description": "A LoopBack component for authentication support.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
5
7
|
"engines": {
|
|
6
8
|
"node": ">=10"
|
|
7
9
|
},
|
|
@@ -19,23 +21,23 @@
|
|
|
19
21
|
"copyright.owner": "IBM Corp.",
|
|
20
22
|
"license": "MIT",
|
|
21
23
|
"dependencies": {
|
|
22
|
-
"@loopback/context": "^3.
|
|
23
|
-
"@loopback/core": "^2.
|
|
24
|
-
"@loopback/metadata": "^2.1.
|
|
25
|
-
"@loopback/openapi-v3": "^3.
|
|
26
|
-
"@loopback/rest": "^
|
|
27
|
-
"@loopback/security": "^0.2.
|
|
24
|
+
"@loopback/context": "^3.8.1",
|
|
25
|
+
"@loopback/core": "^2.7.0",
|
|
26
|
+
"@loopback/metadata": "^2.1.5",
|
|
27
|
+
"@loopback/openapi-v3": "^3.4.1",
|
|
28
|
+
"@loopback/rest": "^5.0.1",
|
|
29
|
+
"@loopback/security": "^0.2.10",
|
|
28
30
|
"@types/express": "^4.17.6",
|
|
29
|
-
"@types/lodash": "^4.14.
|
|
31
|
+
"@types/lodash": "^4.14.152",
|
|
30
32
|
"lodash": "^4.17.15",
|
|
31
|
-
"tslib": "^
|
|
33
|
+
"tslib": "^2.0.0"
|
|
32
34
|
},
|
|
33
35
|
"devDependencies": {
|
|
34
|
-
"@loopback/build": "^5.
|
|
35
|
-
"@loopback/eslint-config": "^
|
|
36
|
-
"@loopback/openapi-spec-builder": "^2.1.
|
|
37
|
-
"@loopback/testlab": "^3.1.
|
|
38
|
-
"@types/node": "^10.17.
|
|
36
|
+
"@loopback/build": "^5.4.1",
|
|
37
|
+
"@loopback/eslint-config": "^7.0.1",
|
|
38
|
+
"@loopback/openapi-spec-builder": "^2.1.5",
|
|
39
|
+
"@loopback/testlab": "^3.1.5",
|
|
40
|
+
"@types/node": "^10.17.24",
|
|
39
41
|
"jsonwebtoken": "^8.5.1"
|
|
40
42
|
},
|
|
41
43
|
"keywords": [
|
|
@@ -44,8 +46,6 @@
|
|
|
44
46
|
],
|
|
45
47
|
"files": [
|
|
46
48
|
"README.md",
|
|
47
|
-
"index.js",
|
|
48
|
-
"index.d.ts",
|
|
49
49
|
"dist",
|
|
50
50
|
"src",
|
|
51
51
|
"!*/__tests__"
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"url": "https://github.com/strongloop/loopback-next.git",
|
|
56
56
|
"directory": "packages/authentication"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "62aea854bf85c5a5995b59e6908fe5409f7eea96"
|
|
59
59
|
}
|
package/src/keys.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import {BindingKey} from '@loopback/context';
|
|
7
7
|
import {MetadataAccessor} from '@loopback/metadata';
|
|
8
|
-
import {SecurityBindings} from '@loopback/security';
|
|
8
|
+
import {SecurityBindings, UserProfile} from '@loopback/security';
|
|
9
9
|
import {AuthenticationComponent} from './authentication.component';
|
|
10
10
|
import {
|
|
11
11
|
AuthenticateFn,
|
|
@@ -117,7 +117,7 @@ export namespace AuthenticationBindings {
|
|
|
117
117
|
'authentication.strategies';
|
|
118
118
|
|
|
119
119
|
// Make `CURRENT_USER` the alias of SecurityBindings.USER for backward compatibility
|
|
120
|
-
export const CURRENT_USER = SecurityBindings.USER;
|
|
120
|
+
export const CURRENT_USER: BindingKey<UserProfile> = SecurityBindings.USER;
|
|
121
121
|
|
|
122
122
|
// Redirect url for authenticating current user
|
|
123
123
|
export const AUTHENTICATION_REDIRECT_URL = BindingKey.create<string>(
|
package/src/types.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
addExtension,
|
|
8
|
+
Binding,
|
|
8
9
|
BindingTemplate,
|
|
9
10
|
Constructor,
|
|
10
11
|
Context,
|
|
@@ -108,7 +109,7 @@ export const USER_PROFILE_NOT_FOUND = 'USER_PROFILE_NOT_FOUND';
|
|
|
108
109
|
export function registerAuthenticationStrategy(
|
|
109
110
|
context: Context,
|
|
110
111
|
strategyClass: Constructor<AuthenticationStrategy>,
|
|
111
|
-
) {
|
|
112
|
+
): Binding<unknown> {
|
|
112
113
|
return addExtension(
|
|
113
114
|
context,
|
|
114
115
|
AuthenticationBindings.AUTHENTICATION_STRATEGY_EXTENSION_POINT_NAME,
|
package/index.d.ts
DELETED
package/index.js
DELETED