Declare hasPermission method on keycloak-connect package (#42490)

This commit is contained in:
Blas Sackmann
2020-02-25 14:05:17 -05:00
committed by GitHub
parent e457757451
commit 228aa4cae6
2 changed files with 3 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
// Type definitions for keycloak-connect 4.5
// Project: https://github.com/keycloak/keycloak-nodejs-connect, http://keycloak.org
// Definitions by: Gregor Stamać <https://github.com/gstamac>
// Blas Sackmann <https://github.com/SackSlab>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -62,6 +63,7 @@ declare namespace Keycloak {
isExpired: () => boolean;
hasRole: (roleName: string) => boolean;
hasApplicationRole: (appName: string, roleName: string) => boolean;
hasPermission: (resource: string, scope: string) => boolean;
hasRealmRole: (roleName: string) => boolean;
}

View File

@@ -65,6 +65,7 @@ _boolean = token.isExpired();
_boolean = token.hasRole('roleName');
_boolean = token.hasApplicationRole('appName', 'roleName');
_boolean = token.hasRealmRole('roleName');
_boolean = token.hasPermission('res:coffe', 'coffe:espresso');
const specHandler: Keycloak.SpecHandler = undefined;
_boolean = specHandler(token, request, response);