Done Category, Product Catalogue, Customer, Vendor, Purchase Invoice Module
This commit is contained in:
17
kifi-api/TestJwt.java
Normal file
17
kifi-api/TestJwt.java
Normal file
@@ -0,0 +1,17 @@
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.security.Keys;
|
||||
import java.util.HashMap;
|
||||
public class TestJwt {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
byte[] key = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".getBytes();
|
||||
HashMap<String, Object> claims = new HashMap<>();
|
||||
claims.put("userId", 1L);
|
||||
String token = Jwts.builder().claims(claims).signWith(Keys.hmacShaKeyFor(key)).compact();
|
||||
Long parsed = Jwts.parser().verifyWith(Keys.hmacShaKeyFor(key)).build().parseSignedClaims(token).getPayload().get("userId", Long.class);
|
||||
System.out.println("Parsed: " + parsed);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user