-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from Sketcher-s/refactor/48
- Loading branch information
Showing
9 changed files
with
106 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/java/shop/catchmind/auth/provider/RedisProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package shop.catchmind.auth.provider; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.data.redis.core.RedisTemplate; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
import static shop.catchmind.auth.constant.JwtConstant.REDIS_LOGOUT_KEY; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class RedisProvider { | ||
|
||
private final RedisTemplate<String, String> redisTemplate; | ||
|
||
public void registerBlackList(final String accessToken, final Long remainingExpirationTime) { | ||
redisTemplate.opsForValue().set(REDIS_LOGOUT_KEY, accessToken, remainingExpirationTime, TimeUnit.SECONDS); | ||
} | ||
|
||
public boolean isTokenBlacklisted(final String accessToken) { | ||
return Boolean.TRUE.equals(redisTemplate.hasKey(REDIS_LOGOUT_KEY + accessToken)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package shop.catchmind.global.config; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.http.converter.HttpMessageConverter; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
import shop.catchmind.global.converter.OctetStreamReadMsgConverter; | ||
|
||
import java.util.List; | ||
|
||
@Configuration | ||
@RequiredArgsConstructor | ||
public class WebConfig implements WebMvcConfigurer { | ||
|
||
private final OctetStreamReadMsgConverter octetStreamReadMsgConverter; | ||
|
||
@Override | ||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { | ||
converters.add(octetStreamReadMsgConverter); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/shop/catchmind/global/converter/OctetStreamReadMsgConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package shop.catchmind.global.converter; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.lang.reflect.Type; | ||
|
||
@Component | ||
public class OctetStreamReadMsgConverter extends AbstractJackson2HttpMessageConverter { | ||
|
||
@Autowired | ||
public OctetStreamReadMsgConverter(ObjectMapper objectMapper) { | ||
super(objectMapper, MediaType.APPLICATION_OCTET_STREAM); | ||
} | ||
|
||
@Override | ||
public boolean canWrite(Class<?> clazz, MediaType mediaType) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean canWrite(Type type, Class<?> clazz, MediaType mediaType) { | ||
return false; | ||
} | ||
|
||
@Override | ||
protected boolean canWrite(MediaType mediaType) { | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 11 additions & 4 deletions
15
src/main/java/shop/catchmind/picture/domain/PictureType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
package shop.catchmind.picture.domain; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public enum PictureType { | ||
HOUSE, | ||
TREE, | ||
MALE, | ||
FEMALE | ||
HOUSE("house"), | ||
TREE("tree"), | ||
MALE("male"), | ||
FEMALE("female"); | ||
|
||
private final String type; | ||
} |