File tree Expand file tree Collapse file tree
src/test/java/com/example/solidconnection/security/authentication Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ void setUp() {
4444 user = siteUserFixture .사용자 ();
4545 }
4646
47+ private static final long VALID_TOKEN_TTL_MS = 30 * 1000L ;
48+
4749 @ Test
4850 void 처리할_수_있는_타입인지를_반환한다 () {
4951 // given
@@ -118,7 +120,7 @@ private String createValidToken(long id) {
118120 return Jwts .builder ()
119121 .subject (String .valueOf (id ))
120122 .issuedAt (new Date ())
121- .expiration (new Date (System .currentTimeMillis () + 1000 ))
123+ .expiration (new Date (System .currentTimeMillis () + VALID_TOKEN_TTL_MS ))
122124 .signWith (Keys .hmacShaKeyFor (jwtProperties .secret ().getBytes (StandardCharsets .UTF_8 )))
123125 .compact ();
124126 }
@@ -127,7 +129,7 @@ private String createExpiredToken() {
127129 return Jwts .builder ()
128130 .subject (String .valueOf (user .getId ()))
129131 .issuedAt (new Date ())
130- .expiration (new Date (System .currentTimeMillis () - 1000 ))
132+ .expiration (new Date (System .currentTimeMillis () - VALID_TOKEN_TTL_MS ))
131133 .signWith (Keys .hmacShaKeyFor (jwtProperties .secret ().getBytes (StandardCharsets .UTF_8 )))
132134 .compact ();
133135 }
@@ -136,7 +138,7 @@ private String createWrongSubjectTypeToken() {
136138 return Jwts .builder ()
137139 .subject ("subject" )
138140 .issuedAt (new Date ())
139- .expiration (new Date (System .currentTimeMillis () + 1000 ))
141+ .expiration (new Date (System .currentTimeMillis () + VALID_TOKEN_TTL_MS ))
140142 .signWith (Keys .hmacShaKeyFor (jwtProperties .secret ().getBytes (StandardCharsets .UTF_8 )))
141143 .compact ();
142144 }
You can’t perform that action at this time.
0 commit comments