Skip to content

Commit

Permalink
Merge pull request #102 from playkuround/develop
Browse files Browse the repository at this point in the history
Code deploy
  • Loading branch information
redcarrot1 authored May 24, 2024
2 parents 3f3622a + a7d6929 commit 8d63109
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/server-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/cachesz
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ private Claims parseClaims(String accessToken) {
.parseClaimsJws(accessToken)
.getBody();
} catch (Exception e) {
log.info("Invalid JWT Token", e);
throw new InvalidTokenException();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public enum AppVersion {

ANDROID("2.0.2"),
ANDROID("2.0.3"),
IOS("2.0.0");

private static final Map<String, AppVersion> stringToEnum =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.playkuround.playkuroundserver.domain.auth.token.application.TokenManager;
import com.playkuround.playkuroundserver.global.security.JwtAuthenticationFilter;
import com.playkuround.playkuroundserver.global.security.LoggingFilter;
import com.playkuround.playkuroundserver.global.security.UserDetailsServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.autoconfigure.security.servlet.PathRequest;
Expand Down Expand Up @@ -56,6 +57,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
).hasRole("ADMIN")
.anyRequest().authenticated()
)
.addFilterBefore(new LoggingFilter(), UsernamePasswordAuthenticationFilter.class)
.addFilterBefore(new JwtAuthenticationFilter(tokenManager), UsernamePasswordAuthenticationFilter.class)
.userDetailsService(userDetailsService)
.build();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.playkuround.playkuroundserver.global.security;

import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.filter.OncePerRequestFilter;

import java.io.IOException;

@Slf4j
public class LoggingFilter extends OncePerRequestFilter {

private static void logRequest(HttpServletRequest request) {
if (request.getRequestURI() != null && request.getRequestURI().contains("/prometheus")) {
return;
}
String queryString = request.getQueryString();
log.info("Request : {} uri=[{}] content-type=[{}]", request.getMethod(), queryString == null ? request.getRequestURI() : request.getRequestURI() + queryString, request.getContentType());
}

@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
if (!isAsyncDispatch(request)) {
logRequest(request);
}
filterChain.doFilter(request, response);
}

}


5 changes: 1 addition & 4 deletions src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,9 @@

<!-- prod 환경 -->
<springProfile name="prod">
<root level="info">
<root level="INFO">
<appender-ref ref="STDOUT"/>
</root>
<logger name="com.playkuround.playkuroundserver.global" level="error" additivity="false">
<appender-ref ref="FILE"/>
</logger>
</springProfile>

</configuration>

0 comments on commit 8d63109

Please sign in to comment.