Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [#131] Security 적용 #139

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/org/rf/rfserver/config/WebSecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public SecurityFilterChain filterChain(HttpSecurity http, TokenAuthenticationFil
return http
.csrf(AbstractHttpConfigurer::disable)
.authorizeHttpRequests(requests ->
requests.requestMatchers("/", "/swagger-ui/**", "/user/**", "/party/**"
, "/mail/**", "/schedule/**", "/report/**","/chat/**", "/block/**",
requests.requestMatchers("/", "/user/login", "/chat/**", "/user", "/user/idCheck/**", "/user/nicknameCheck/**" ,
"/user/findId", "/user/resetPassword",
"/token", "/enums", "/apns/**", "/ws/**").permitAll() // requestMatchers의 인자로 전달된 url은 모두에게 허용
.anyRequest().authenticated() // 그 외의 모든 요청은 인증 필요
)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/rf/rfserver/constant/RfRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

public class RfRule {
public static final int MAX_PARTY_NUMBER = 5;
public static final int ACCESS_TOKEN_EXPIRATION = 2;
public static final int ACCESS_TOKEN_EXPIRATION = 70;
public static final int REFRESH_TOKEN_EXPIRATION = 7;
}
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public LoginRes login(LoginReq loginReq) throws BaseException {
User user = userRepository.findByLoginId(loginReq.getLoginId())
.filter(it -> bCryptPasswordEncoder.matches(loginReq.getPassword(), it.getPassword())) // 암호화된 비밀번호와 비교하도록 수정
.orElseThrow(() -> new BaseException(INVALID_LOGIN_IR_OR_PASSWORD));
String accessToken = tokenProvider.generateToken(user, Duration.ofHours(ACCESS_TOKEN_EXPIRATION));
String accessToken = tokenProvider.generateToken(user, Duration.ofDays(ACCESS_TOKEN_EXPIRATION));
String refreshToken = tokenProvider.generateToken(user, Duration.ofDays(REFRESH_TOKEN_EXPIRATION));
refreshTokenService.saveRefreshToken(user.getId(), refreshToken);
user.setDeviceToken(loginReq.getDeviceToken());
Expand Down
Loading