test_class.declarator: jwtTokenUtil
test_class.modifier: @Autowired
  	private
test_class.original_string: @Autowired
  	private JwtTokenUtil jwtTokenUtil;
test_class.type: JwtTokenUtil
test_class.var_name: jwtTokenUtil
test_class.file: trading-webapp/src/test/java/fr/ymanvieu/trading/webapp/jwt/JwtTokenUtilTest.java
test_class.identifier: JwtTokenUtilTest
test_case.body: @Test
  	public void testGenerateRefreshToken() throws Exception {
  		// GIVEN
  		Instant start = Instant.now().minusSeconds(1);
  		Duration expiration = Duration.ofDays(90);
  		
  		// WHEN
  		String token = jwtTokenUtil.generateRefreshToken("username");
  		
  		
  		// THEN
  		assertThat(jwtTokenUtil.getUsernameFromToken(token)).isEqualTo("username");
  		assertThat(jwtTokenUtil.getIssuedAtDateFromToken(token)).isBetween(start, Instant.now());
  		assertThat(jwtTokenUtil.getExpirationDateFromToken(token)).isBetween(start.plus(expiration), Instant.now().plus(expiration));
  	}
test_case.class_method_signature: JwtTokenUtilTest.testGenerateRefreshToken()
test_case.full_signature: @Test public void testGenerateRefreshToken()
test_case.identifier: testGenerateRefreshToken
test_case.invocations: minusSeconds now ofDays generateRefreshToken isEqualTo assertThat getUsernameFromToken isBetween assertThat getIssuedAtDateFromToken now isBetween assertThat getExpirationDateFromToken plus plus now
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGenerateRefreshToken()
focal_class.declarator: CLAIM_KEY_ROLES = "roles"
focal_class.modifier: static final
focal_class.original_string: static final String CLAIM_KEY_ROLES = "roles";
focal_class.type: String
focal_class.var_name: CLAIM_KEY_ROLES
focal_class.declarator: ROLES_CLAIM_DELIMITER = ","
focal_class.modifier: static final
focal_class.original_string: static final String ROLES_CLAIM_DELIMITER = ",";
focal_class.type: String
focal_class.var_name: ROLES_CLAIM_DELIMITER
focal_class.declarator: jwtConfig
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private JwtProperties jwtConfig;
focal_class.type: JwtProperties
focal_class.var_name: jwtConfig
focal_class.file: trading-webapp/src/main/java/fr/ymanvieu/trading/webapp/jwt/JwtTokenUtil.java
focal_class.identifier: JwtTokenUtil
focal_class.class_method_signature: JwtTokenUtil.getUsernameFromToken(String token)
focal_class.full_signature: public String getUsernameFromToken(String token)
focal_class.identifier: getUsernameFromToken
focal_class.modifiers: public
focal_class.parameters: (String token)
focal_class.return: String
focal_class.signature: String getUsernameFromToken(String token)
focal_class.class_method_signature: JwtTokenUtil.getIssuedAtDateFromToken(String token)
focal_class.full_signature: public Instant getIssuedAtDateFromToken(String token)
focal_class.identifier: getIssuedAtDateFromToken
focal_class.modifiers: public
focal_class.parameters: (String token)
focal_class.return: Instant
focal_class.signature: Instant getIssuedAtDateFromToken(String token)
focal_class.class_method_signature: JwtTokenUtil.getExpirationDateFromToken(String token)
focal_class.full_signature: public Instant getExpirationDateFromToken(String token)
focal_class.identifier: getExpirationDateFromToken
focal_class.modifiers: public
focal_class.parameters: (String token)
focal_class.return: Instant
focal_class.signature: Instant getExpirationDateFromToken(String token)
focal_class.class_method_signature: JwtTokenUtil.getClaimFromToken(String token, Function<Claims, T> claimsResolver)
focal_class.full_signature: public T getClaimFromToken(String token, Function<Claims, T> claimsResolver)
focal_class.identifier: getClaimFromToken
focal_class.modifiers: public
focal_class.parameters: (String token, Function<Claims, T> claimsResolver)
focal_class.return: T
focal_class.signature: T getClaimFromToken(String token, Function<Claims, T> claimsResolver)
focal_class.class_method_signature: JwtTokenUtil.getAllClaimsFromToken(String token)
focal_class.full_signature: private Claims getAllClaimsFromToken(String token)
focal_class.identifier: getAllClaimsFromToken
focal_class.modifiers: private
focal_class.parameters: (String token)
focal_class.return: Claims
focal_class.signature: Claims getAllClaimsFromToken(String token)
focal_class.class_method_signature: JwtTokenUtil.isTokenExpired(String token)
focal_class.full_signature: private Boolean isTokenExpired(String token)
focal_class.identifier: isTokenExpired
focal_class.modifiers: private
focal_class.parameters: (String token)
focal_class.return: Boolean
focal_class.signature: Boolean isTokenExpired(String token)
focal_class.class_method_signature: JwtTokenUtil.isCreatedBeforeLastPasswordReset(Instant created, Instant lastPasswordReset)
focal_class.full_signature: private Boolean isCreatedBeforeLastPasswordReset(Instant created, Instant lastPasswordReset)
focal_class.identifier: isCreatedBeforeLastPasswordReset
focal_class.modifiers: private
focal_class.parameters: (Instant created, Instant lastPasswordReset)
focal_class.return: Boolean
focal_class.signature: Boolean isCreatedBeforeLastPasswordReset(Instant created, Instant lastPasswordReset)
focal_class.class_method_signature: JwtTokenUtil.generateToken(UserDetails userDetails)
focal_class.full_signature: public String generateToken(UserDetails userDetails)
focal_class.identifier: generateToken
focal_class.modifiers: public
focal_class.parameters: (UserDetails userDetails)
focal_class.return: String
focal_class.signature: String generateToken(UserDetails userDetails)
focal_class.class_method_signature: JwtTokenUtil.doGenerateToken(String subject, Map<String, Object> claims)
focal_class.full_signature: private String doGenerateToken(String subject, Map<String, Object> claims)
focal_class.identifier: doGenerateToken
focal_class.modifiers: private
focal_class.parameters: (String subject, Map<String, Object> claims)
focal_class.return: String
focal_class.signature: String doGenerateToken(String subject, Map<String, Object> claims)
focal_class.class_method_signature: JwtTokenUtil.canTokenBeRefreshed(String token, Instant lastPasswordReset)
focal_class.full_signature: public Boolean canTokenBeRefreshed(String token, Instant lastPasswordReset)
focal_class.identifier: canTokenBeRefreshed
focal_class.modifiers: public
focal_class.parameters: (String token, Instant lastPasswordReset)
focal_class.return: Boolean
focal_class.signature: Boolean canTokenBeRefreshed(String token, Instant lastPasswordReset)
focal_class.class_method_signature: JwtTokenUtil.generateRefreshToken(String subject)
focal_class.full_signature: public String generateRefreshToken(String subject)
focal_class.identifier: generateRefreshToken
focal_class.modifiers: public
focal_class.parameters: (String subject)
focal_class.return: String
focal_class.signature: String generateRefreshToken(String subject)
focal_class.class_method_signature: JwtTokenUtil.validateToken(String token, UserDetails userDetails)
focal_class.full_signature: public Boolean validateToken(String token, UserDetails userDetails)
focal_class.identifier: validateToken
focal_class.modifiers: public
focal_class.parameters: (String token, UserDetails userDetails)
focal_class.return: Boolean
focal_class.signature: Boolean validateToken(String token, UserDetails userDetails)
focal_class.class_method_signature: JwtTokenUtil.getGrantedAuthoritiesFromToken(String authToken)
focal_class.full_signature: public Collection<? extends GrantedAuthority> getGrantedAuthoritiesFromToken(String authToken)
focal_class.identifier: getGrantedAuthoritiesFromToken
focal_class.modifiers: public
focal_class.parameters: (String authToken)
focal_class.return: Collection<? extends GrantedAuthority>
focal_class.signature: Collection<? extends GrantedAuthority> getGrantedAuthoritiesFromToken(String authToken)
focal_method.body: public String generateRefreshToken(String subject) {
      	final Instant createdDate = Instant.now();
      	final Instant expirationDate = createdDate.plus(jwtConfig.getRefreshExpiration());
      	
      	log.info("generateRefreshToken()");
          
          return Jwts.builder()
          		.setSubject(subject)
                  .setIssuedAt(Date.from(createdDate))
                  .setExpiration(Date.from(expirationDate))
                  .signWith(Keys.hmacShaKeyFor(Decoders.BASE64.decode(jwtConfig.getSecret())), SignatureAlgorithm.HS512)
                  .compact();
      }
focal_method.class_method_signature: JwtTokenUtil.generateRefreshToken(String subject)
focal_method.full_signature: public String generateRefreshToken(String subject)
focal_method.identifier: generateRefreshToken
focal_method.invocations: now plus getRefreshExpiration info compact signWith setExpiration setIssuedAt setSubject builder from from hmacShaKeyFor decode getSecret
focal_method.modifiers: public
focal_method.parameters: (String subject)
focal_method.return: String
focal_method.signature: String generateRefreshToken(String subject)