Skip to content

Commit

Permalink
build: .gitignore 설정 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
jay-so committed Apr 11, 2024
1 parent 17bda8e commit b63139c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 39 deletions.
16 changes: 9 additions & 7 deletions src/main/java/com/eodya/api/auth/domain/token/JwtProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
import io.jsonwebtoken.*;
import io.jsonwebtoken.io.Decoders;
import io.jsonwebtoken.security.Keys;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.crypto.SecretKey;
import java.util.Date;

import static com.eodya.api.auth.exception.AuthExceptionCode.*;

@Slf4j
@Component
public class JwtProvider {

Expand All @@ -20,13 +22,13 @@ public class JwtProvider {

public JwtProvider(final JwtProperties jwtProperties) {
this.jwtProperties = jwtProperties;
final byte[] keyBytes = Decoders.BASE64.decode(jwtProperties.getSecretKey());
byte[] keyBytes = Decoders.BASE64.decode(jwtProperties.getSecretKey());
this.secretKey = Keys.hmacShaKeyFor(keyBytes);
}

public AuthTokens createLoginToken(final String subject) {
final String accessToken = generateToken(subject, jwtProperties.getAccessTokenExpirationTime());
final String refreshToken = generateToken("", jwtProperties.getRefreshTokenExpirationTime());
public AuthTokens createLoginToken(String subject) {
String accessToken = generateToken(subject, jwtProperties.getAccessTokenExpirationTime());
String refreshToken = generateToken("", jwtProperties.getRefreshTokenExpirationTime());

return AuthTokens.builder()
.accessToken(accessToken)
Expand All @@ -43,7 +45,7 @@ public AuthTokens createRegisterToken(String subject) {
}

private String generateToken(String subject, Long expirationTime) {
final Date now = new Date();
Date now = new Date();

return Jwts.builder()
.subject(subject)
Expand Down Expand Up @@ -100,7 +102,7 @@ public void validateRegisterToken(String registerToken) {
}
}

public boolean isValidRefreshAndInvalidAccess(final String refreshToken, final String accessToken) {
public boolean isValidRefreshAndInvalidAccess(String refreshToken, String accessToken) {
validateRefreshToken(refreshToken);

try {
Expand All @@ -112,7 +114,7 @@ public boolean isValidRefreshAndInvalidAccess(final String refreshToken, final S
return false;
}

public boolean isValidRefreshAndValidAccess(final String refreshToken, final String accessToken) {
public boolean isValidRefreshAndValidAccess(String refreshToken, String accessToken) {
try {
validateRefreshToken(refreshToken);
validateAccessToken(accessToken);
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/eodya/api/common/config/CacheConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.fasterxml.jackson.databind.jsontype.PolymorphicTypeValidator;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -16,6 +17,7 @@
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;

@Slf4j
@Configuration
@EnableCaching
@RequiredArgsConstructor
Expand Down
32 changes: 0 additions & 32 deletions src/main/resources/application.yml

This file was deleted.

0 comments on commit b63139c

Please sign in to comment.