You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.
@param roles the list of roles the user should match against
@param context the graphql context that contains the user info
*/
function isAuthorizedByRole(roles, context) {
if (!(context && context[KeycloakContext_1.CONTEXT_KEY])) {
console.error(context.${KeycloakContext_1.CONTEXT_KEY} is missing. Keycloak integration is probably misconfigured);
return false;
}
for (const role of roles) {
if (context[KeycloakContext_1.CONTEXT_KEY].hasRole(role)) {
return true;
}
}
return false;
}
exports.isAuthorizedByRole = isAuthorizedByRole;
The text was updated successfully, but these errors were encountered:
Agreed @Mohsinfistix needs to provide more context, however, I want to ask, if I passes a Bearer token in an authorization header, should I expect accessToken to equal that bearer token?
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isAuthorizedByRole = void 0;
const KeycloakContext_1 = require("../KeycloakContext");
/**
*
*/
function isAuthorizedByRole(roles, context) {
if (!(context && context[KeycloakContext_1.CONTEXT_KEY])) {
console.error(
context.${KeycloakContext_1.CONTEXT_KEY} is missing. Keycloak integration is probably misconfigured
);return false;
}
for (const role of roles) {
if (context[KeycloakContext_1.CONTEXT_KEY].hasRole(role)) {
return true;
}
}
return false;
}
exports.isAuthorizedByRole = isAuthorizedByRole;
The text was updated successfully, but these errors were encountered: