Skip to content

Commit 1c0005f

Browse files
committed
formatting
1 parent 2a3d644 commit 1c0005f

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

src/main/java/io/fusionauth/jwt/JWTEncoder.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016-2019, FusionAuth, All Rights Reserved
2+
* Copyright (c) 2016-2023, FusionAuth, All Rights Reserved
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -51,12 +51,9 @@ public String encode(JWT jwt, Signer signer) {
5151
* @return the encoded JWT string.
5252
*/
5353
public String encode(JWT jwt, Signer signer, Supplier<Header> supplier) {
54-
final Header header;
55-
if (supplier != null) {
56-
header = supplier.get();
57-
} else {
58-
header = new Header();
59-
}
54+
Header header = supplier != null
55+
? supplier.get()
56+
: new Header();
6057
return encode(jwt, signer, header);
6158
}
6259

src/test/java/io/fusionauth/jwt/JWTTest.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -563,12 +563,9 @@ public void test_complexPayload() {
563563
Signer signer = HMACSigner.newSHA256Signer("secret");
564564
Verifier verifier = HMACVerifier.newVerifier("secret");
565565

566-
String encodedJWT = JWT.getEncoder().encode(expectedJWT, signer, () -> {
567-
final Header header = new Header();
568-
header.set("gty", Collections.singletonList("client_credentials"));
569-
header.set("kid", "1234");
570-
return header;
571-
});
566+
String encodedJWT = JWT.getEncoder().encode(expectedJWT, signer, () -> new Header()
567+
.set("gty", Collections.singletonList("client_credentials"))
568+
.set("kid", "1234"));
572569
JWT actualJwt = JWT.getDecoder().decode(encodedJWT, verifier);
573570

574571
assertEquals(actualJwt.header.algorithm, Algorithm.HS256);

0 commit comments

Comments
 (0)