Script Mapper - Read data from client request

Hi all!

I’m trying to build a script using Script Mapper. Basically, I need to read some data from the body of the request that was made by the client and add it as a claim to the access token.

I read the docs, but didn’t quite figure it out, is it possible?

nvm, the following code did the trick:

var req = keycloakSession.getContext().getContextObject(Java.type("org.jboss.resteasy.spi.HttpRequest").class);
exports = req.getDecodedFormParameters().getFirst("my-param");