keycloak-nodejs-connect
keycloak-nodejs-connect copied to clipboard
add support for async guard function
Reviving the following old PR as I'm hitting the same issue:
https://github.com/keycloak/keycloak-nodejs-connect/pull/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
Any chance of merging this in? What needs to be done on my end? Cheers
@jseparovic Library will be deprecated :( I don't think, if they will merge your changes :/