Using plain javascript in javascript based policy
by abhishekumar005@yahoo.com
Hi all,I am using a Javascript-based policy to verify a user in order to access a particular resource. I want to include an extra check, like, I will call an external API and if that API returns true, then only access will be provided to the user. I tried using XMLHttpRequest to open a get request, but it is not working. In fact, plain js functions like console.log() is also not working in javascript policy. The error show is given below:
Unexpected error while evaluating permissions: java.lang.RuntimeException: Failed to evaluate permissions.
Caused by: org.keycloak.scripting.ScriptCompilationException: Could not compile 'Mail-policy' problem was: <eval>:7:4 Expected ; but found xhrlet xhr = new XMLHttpRequest(); ^ in <eval> at line number 7 at column number 4
How to do this? Is there any other approach?
Regards,Abhishek