Set JWT claims and header parameters with the 0.12 JwtBuilder API

Proprietary

Migrates JwtBuilder methods whose 0.12 replacements are nested builders: setAudience(aud) to audience().single(aud), setHeaderParam(name, value) and setHeaderParams(map) to header().add(..).and(), setHeader(map) to header().empty().add(map).and() and setClaims(map) to claims(map), or to claims().empty().add(map).and() when claims set earlier in the chain must be replaced. audience().single(aud) is marked as deprecated only to discourage its use, but unlike audience().add(aud) it keeps serializing the audience as a JSON string rather than an array, which recipients may not accept.

org.openrewrite.java.security.jjwt.MigrateJwtBuilderClaimsAndHeader
mod run . --recipe=org.openrewrite.java.security.jjwt.MigrateJwtBuilderClaimsAndHeader

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.