Removes eager initialization of the CompressionCodecResolver in the JwtParserBuilder

This removes a potential service loader issue with OSGi runtimes.

Fixes: #578
This commit is contained in:
Brian Demers 2020-07-09 16:16:30 -04:00 committed by Brian Demers
parent dc120e8c54
commit 901048aeac
1 changed files with 6 additions and 1 deletions

View File

@ -55,7 +55,7 @@ public class DefaultJwtParserBuilder implements JwtParserBuilder {
private SigningKeyResolver signingKeyResolver; private SigningKeyResolver signingKeyResolver;
private CompressionCodecResolver compressionCodecResolver = new DefaultCompressionCodecResolver(); private CompressionCodecResolver compressionCodecResolver;
private Decoder<String, byte[]> base64UrlDecoder = Decoders.BASE64URL; private Decoder<String, byte[]> base64UrlDecoder = Decoders.BASE64URL;
@ -191,6 +191,11 @@ public class DefaultJwtParserBuilder implements JwtParserBuilder {
this.deserializer = Services.loadFirst(Deserializer.class); this.deserializer = Services.loadFirst(Deserializer.class);
} }
// if the compressionCodecResolver is not set default it.
if (this.compressionCodecResolver == null) {
this.compressionCodecResolver = new DefaultCompressionCodecResolver();
}
return new ImmutableJwtParser( return new ImmutableJwtParser(
new DefaultJwtParser(signingKeyResolver, new DefaultJwtParser(signingKeyResolver,
key, key,