Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 924c701

Browse files
authoredNov 6, 2023
Make check requests to the Warrant API instead of an active edge agent if 'Warrant-Token: latest' is specified (#48)
1 parent ebfb849 commit 924c701

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed
 

‎src/modules/Authorization.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ export default class Authorization {
1616
const check: Check = {
1717
warrants: [checkWarrantParamsToCheckWarrant(checkParams)],
1818
debug: checkParams.debug
19-
}
20-
if (WarrantClient.config.authorizeEndpoint) {
19+
};
20+
21+
if (WarrantClient.config.authorizeEndpoint && options.warrantToken != "latest") {
2122
return this.makeEdgeCheckRequest(check, options);
2223
}
2324

@@ -31,7 +32,7 @@ export default class Authorization {
3132
debug: checkParams.debug
3233
};
3334

34-
if (WarrantClient.config.authorizeEndpoint) {
35+
if (WarrantClient.config.authorizeEndpoint && options.warrantToken != "latest") {
3536
return this.makeEdgeCheckRequest(check, options);
3637
}
3738

@@ -48,7 +49,7 @@ export default class Authorization {
4849
subject: featureCheckParams.subject,
4950
context: featureCheckParams.context,
5051
debug: featureCheckParams.debug
51-
}, options)
52+
}, options);
5253
}
5354

5455
public static async hasPermission(permissionCheckParams: PermissionCheckParams, options: WarrantRequestOptions = {}): Promise<boolean> {
@@ -61,7 +62,7 @@ export default class Authorization {
6162
subject: permissionCheckParams.subject,
6263
context: permissionCheckParams.context,
6364
debug: permissionCheckParams.debug
64-
}, options)
65+
}, options);
6566
}
6667

6768
// Private methods

0 commit comments

Comments
 (0)
Please sign in to comment.