8000 accessToken is undefined and roles are also not coming in auth · Issue #134 · aerogear/keycloak-connect-graphql · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.
This repository was archived by the owner on Apr 17, 2023. It is now read-only.
accessToken is undefined and roles are also not coming in auth  #134
Open
@Mohsinfistix

Description

@Mohsinfistix

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isAuthorizedByRole = void 0;
const KeycloakContext_1 = require("../KeycloakContext");
/**
*

  • @param roles the list of roles the user should match against
  • @param context the graphql context that contains the user info
    */
    function is 518A AuthorizedByRole(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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0