Skip to content

Conversation

@jasoncodes42
Copy link

@jasoncodes42 jasoncodes42 commented Mar 7, 2022

Reviving the following old PR as I'm hitting the same issue:

#97

https://issues.redhat.com/browse/KEYCLOAK-5771?workflowName=GIT+Pull+Request+workflow+&stepId=4

I need to use an async GuardFn for my application.

I tested with a simple setTimeout method:

const keycloakGuardFn: KeycloakConnect.GuardFn = async (accessToken: Token, req: express.Request): Promise<boolean> => {
    const sleep = async (ms: number) => {
        return new Promise((resolve) => setTimeout(resolve, ms));
    }
    logger.trace("Sleeping for 2 seconds");
    await sleep(2000);
    logger.trace("Sleep finished");
    return true;
}

Looks fine in my testing.

Do I need to update the unit tests? I'm not too sure where/what to add here.

Cheers

@jasoncodes42
Copy link
Author

Any chance of merging this in? What needs to be done on my end? Cheers

@pjamroziak
Copy link

@jseparovic
Library will be deprecated :( I don't think, if they will merge your changes :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants