Controlling the Maximum Size of Compressed JWTs
A number of AM features accept JWTs to receive information. Some examples are:
The Remote Consent Service, when it receives consent responses.
The OAuth 2.0/OpenID Connect authorization service, when:
OpenID Connect clients send
request
parameters as a JWT instead of as HTTP parameters.OpenID Connect clients register dynamically using software statements.
The Authentication service, when configured to issue client-based sessions.
These JWTs that AM receives can be signed and/or encrypted. Sometimes, larger JWTs are compressed to improve delivery speeds to AM.
Decompressing a JWT makes it expand in size. By default, AM rejects any JWT that expands to more than 32 KiB (32768 bytes), and throws an exception with a message similar to JWT payload decompressed to larger than maximum allowed size
.
Ensure that the JWTs your clients send to AM are smaller than 32 KiB before compression, or increase the 32 KiB value to a reasonable limit. Take into account that AM performs decryption and decompression operations in its heap, and that you do not want to allow very large JWTs to, potentially, leave AM out of memory.
If you need to change the default value, perform the following steps:
Configure the
org.forgerock.json.jose.jwe.compression.max.decompressed.size.bytes
Java system property on the container where AM runs.For example, edit the
setenv.sh
file of the Apache Tomcat instance, and set the property with the new size in bytes:JAVA_OPTS="$JAVA_OPTS -Dorg.forgerock.json.jose.jwe.compression.max.decompressed.size.bytes=40960"
Restart the container for the changes to make effect.