From 1c0005ff9ee7535795fb66193bb403cb52d2f77b Mon Sep 17 00:00:00 2001 From: Daniel DeGroff Date: Wed, 27 Sep 2023 14:24:49 -0600 Subject: [PATCH] formatting --- src/main/java/io/fusionauth/jwt/JWTEncoder.java | 11 ++++------- src/test/java/io/fusionauth/jwt/JWTTest.java | 9 +++------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/main/java/io/fusionauth/jwt/JWTEncoder.java b/src/main/java/io/fusionauth/jwt/JWTEncoder.java index 1cdaa6c..55782c2 100644 --- a/src/main/java/io/fusionauth/jwt/JWTEncoder.java +++ b/src/main/java/io/fusionauth/jwt/JWTEncoder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, FusionAuth, All Rights Reserved + * Copyright (c) 2016-2023, FusionAuth, All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,12 +51,9 @@ public String encode(JWT jwt, Signer signer) { * @return the encoded JWT string. */ public String encode(JWT jwt, Signer signer, Supplier
supplier) { - final Header header; - if (supplier != null) { - header = supplier.get(); - } else { - header = new Header(); - } + Header header = supplier != null + ? supplier.get() + : new Header(); return encode(jwt, signer, header); } diff --git a/src/test/java/io/fusionauth/jwt/JWTTest.java b/src/test/java/io/fusionauth/jwt/JWTTest.java index c6d8e76..37bc2b2 100644 --- a/src/test/java/io/fusionauth/jwt/JWTTest.java +++ b/src/test/java/io/fusionauth/jwt/JWTTest.java @@ -563,12 +563,9 @@ public void test_complexPayload() { Signer signer = HMACSigner.newSHA256Signer("secret"); Verifier verifier = HMACVerifier.newVerifier("secret"); - String encodedJWT = JWT.getEncoder().encode(expectedJWT, signer, () -> { - final Header header = new Header(); - header.set("gty", Collections.singletonList("client_credentials")); - header.set("kid", "1234"); - return header; - }); + String encodedJWT = JWT.getEncoder().encode(expectedJWT, signer, () -> new Header() + .set("gty", Collections.singletonList("client_credentials")) + .set("kid", "1234")); JWT actualJwt = JWT.getDecoder().decode(encodedJWT, verifier); assertEquals(actualJwt.header.algorithm, Algorithm.HS256);