In this post under JWT, I will show with example how to create and parse a signed JWT containing payload. As mentioned in previous posts we will use an instance of “JwtBuilder” to construct a JSON Web Token. Below is the code snippet for your reference Snippet 1 1 JwtBuilder jwtBuilder = Jwts.builder();2 3 jwtBuilder.header().add(“alg”,…… Continue reading Creating and Parsing a secret key signed JWT containing payload
Month: October 2022
Parsing simple unsigned JWT containing plaintext as payload
In this post under JJWT, I will show with example how to parse unsigned JWT containing plaintext as payload instead of serialized Claims object. As shown in previous post under JJWT, whenever we need to parse a JWT string. We need to create an instance of “JwtParser” as shown below JwtParserBuilder jwtParserBuilder = Jwts.parser(); jwtParserBuilder.unsecured();…… Continue reading Parsing simple unsigned JWT containing plaintext as payload
Creating a simple unsecured JSON Web Token containing payload
In this post under JJWT, I will show with example how to generate unsecured JWT containing payload. In previous post under JJWT, I talked about JWT containing claims. So what is the difference between claims and payload. Its simple, payload is noting but any String data, whereas claims is a map. Now with the difference…… Continue reading Creating a simple unsecured JSON Web Token containing payload
Creating and Parsing a secret key signed JWT containing claims
In this post under JWT, I will show with example how to create and parse a signed JWT containing claims. As mentioned in previous posts we will use an instance of “JwtBuilder” to construct a JSON Web Token. Below is the code snippet for your recap Snippet 1 1 JwtBuilder jwtBuilder = Jwts.builder();2 3 jwtBuilder.header().add(“alg”,…… Continue reading Creating and Parsing a secret key signed JWT containing claims
AssertDoesNotThrow Example
In this post under JUnit, I will explain with example what is the purpose and how to use “AssertDoesNotThrow” assertion method. AssertDoesNotThrow takes an executable code and assert that the method doesn’t throw any exception during execution. Below is the javadoc of “assertDoesNotThrow” exception public static void assertDoesNotThrow(Executable executable) Where “Executable” is a functional interface…… Continue reading AssertDoesNotThrow Example