@aptana/multichannel-common 2.9.15 → 2.9.16
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.
|
@@ -14,10 +14,16 @@ export declare class TokenGuard implements Guard {
|
|
|
14
14
|
* The currently authenticated user.
|
|
15
15
|
*/
|
|
16
16
|
private _user;
|
|
17
|
+
/**
|
|
18
|
+
* Skip userKey & userToken authentication
|
|
19
|
+
*/
|
|
20
|
+
private _skipUserKeyAuth;
|
|
17
21
|
/**
|
|
18
22
|
* Create a new authtentication guard.
|
|
19
23
|
*/
|
|
20
|
-
constructor(provider: UserProvider, req: any
|
|
24
|
+
constructor(provider: UserProvider, req: any, options?: {
|
|
25
|
+
skipUserKeyAuth?: boolean;
|
|
26
|
+
});
|
|
21
27
|
/**
|
|
22
28
|
* Determine if the current user is authenticated. If not, throw an error.
|
|
23
29
|
*/
|
|
@@ -18,12 +18,17 @@ class TokenGuard {
|
|
|
18
18
|
* The currently authenticated user.
|
|
19
19
|
*/
|
|
20
20
|
_user;
|
|
21
|
+
/**
|
|
22
|
+
* Skip userKey & userToken authentication
|
|
23
|
+
*/
|
|
24
|
+
_skipUserKeyAuth;
|
|
21
25
|
/**
|
|
22
26
|
* Create a new authtentication guard.
|
|
23
27
|
*/
|
|
24
|
-
constructor(provider, req) {
|
|
28
|
+
constructor(provider, req, options) {
|
|
25
29
|
this._provider = provider;
|
|
26
30
|
this._req = req;
|
|
31
|
+
this._skipUserKeyAuth = options?.skipUserKeyAuth ?? false;
|
|
27
32
|
}
|
|
28
33
|
/**
|
|
29
34
|
* Determine if the current user is authenticated. If not, throw an error.
|
|
@@ -54,7 +59,8 @@ class TokenGuard {
|
|
|
54
59
|
let user = null;
|
|
55
60
|
let token = this.getTokenFromRequest();
|
|
56
61
|
let { userKey, userToken } = this.getUserKeyTokenFromRequest();
|
|
57
|
-
|
|
62
|
+
// Skip userKey auth if configured
|
|
63
|
+
if (!this._skipUserKeyAuth && userKey && userToken) {
|
|
58
64
|
user = await this._provider.getByUserKeyAndUserToken(userKey, userToken);
|
|
59
65
|
}
|
|
60
66
|
else if (token) {
|