@Test public void testCreateJwtTokenReturnsValidJWTString() { final Key secretKey = createSecretKey(); final Principal Principal = generatePrincipal(); final JsonWebTokenAuthenticator authenticator = createAuthenticatorWithSecretKey(secretKey); final String returnedToken = authenticator.createJwtToken(Principal); assertIsValidJWT(secretKey, returnedToken); }
public static String createJwtToken(SignatureAlgorithm alg, Key secretKey, Principal principal) { return Jwts.builder().setSubject(principal.getName()).signWith(alg, secretKey).compact(); }
JsonWebTokenAuthenticator implements Authenticator<String, Principal> { public static String createJwtToken(SignatureAlgorithm alg, Key secretKey, Principal principal) { return Jwts.builder().setSubject(principal.getName()).signWith(alg, secretKey).compact(); } }
JsonWebTokenAuthenticator implements Authenticator<String, Principal> { public static String createJwtToken(SignatureAlgorithm alg, Key secretKey, Principal principal) { return Jwts.builder().setSubject(principal.getName()).signWith(alg, secretKey).compact(); } JsonWebTokenAuthenticator(Key secretKey, SignatureAlgorithm algorithm); }
JsonWebTokenAuthenticator implements Authenticator<String, Principal> { public static String createJwtToken(SignatureAlgorithm alg, Key secretKey, Principal principal) { return Jwts.builder().setSubject(principal.getName()).signWith(alg, secretKey).compact(); } JsonWebTokenAuthenticator(Key secretKey, SignatureAlgorithm algorithm); static String createJwtToken(SignatureAlgorithm alg, Key secretKey, Principal principal); @Override Optional<Principal> authenticate(String s); String createJwtToken(Principal principal); }
JsonWebTokenAuthenticator implements Authenticator<String, Principal> { public static String createJwtToken(SignatureAlgorithm alg, Key secretKey, Principal principal) { return Jwts.builder().setSubject(principal.getName()).signWith(alg, secretKey).compact(); } JsonWebTokenAuthenticator(Key secretKey, SignatureAlgorithm algorithm); static String createJwtToken(SignatureAlgorithm alg, Key secretKey, Principal principal); @Override Optional<Principal> authenticate(String s); String createJwtToken(Principal principal);  }