-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ada985d
commit 60c4b2c
Showing
21 changed files
with
165 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: cd | ||
name: cd-dev | ||
on: | ||
workflow_run: | ||
workflows: [ ci ] | ||
|
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,4 +1,4 @@ | ||
name: cd | ||
name: cd-main | ||
on: | ||
workflow_run: | ||
workflows: [ ci ] | ||
|
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
77 changes: 77 additions & 0 deletions
77
src/main/java/com/lighthouse/lingoswap/auth/config/LoggingFilter.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,77 @@ | ||
package com.lighthouse.lingoswap.auth.config; | ||
|
||
import jakarta.servlet.FilterChain; | ||
import jakarta.servlet.ServletException; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
import jakarta.servlet.http.HttpServletResponse; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.web.filter.OncePerRequestFilter; | ||
|
||
import java.io.IOException; | ||
import java.util.Optional; | ||
|
||
@Slf4j | ||
@RequiredArgsConstructor | ||
@Component | ||
public class LoggingFilter extends OncePerRequestFilter { | ||
|
||
/** | ||
* servletPath:/api/v1/user/form/interests | ||
* <p> | ||
* After request [GET /api/v1/user/form/country, client=0:0:0:0:0:0:0:1, headers=[user-agent:"PostmanRuntime/7.35.0", accept:"*{@literal /}*", host:"localhost:8080", accept-encoding:"gzip, deflate, br", connection:"keep-alive"]] | ||
* <p> | ||
* pathInfo:null | ||
* <p> | ||
* headers: | ||
* <p> | ||
* user-agent: PostmanRuntime/7.35.0 | ||
* <p> | ||
* host | ||
*/ | ||
@Override | ||
protected void doFilterInternal(@NotNull final HttpServletRequest request, | ||
@NotNull final HttpServletResponse response, | ||
@NotNull final FilterChain filterChain) throws ServletException, IOException { | ||
LogDto logDto = LogDto.from(request); | ||
log.info("[REQUEST] {}", logDto); | ||
filterChain.doFilter(request, response); | ||
} | ||
|
||
private record LogDto(String method, | ||
String uri, | ||
String queryString, | ||
String realIp, | ||
String region, | ||
String userAgent, | ||
String acceptLanguage) { | ||
|
||
static LogDto from(HttpServletRequest request) { | ||
return new LogDto( | ||
request.getMethod(), | ||
request.getRequestURI(), | ||
request.getQueryString(), | ||
request.getHeader("X-Real-IP"), | ||
request.getHeader("Region"), | ||
request.getHeader("User-Agent"), | ||
request.getHeader("Accept-Language")); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "%s %s%s%n headers=[X-Real-IP: %s, Region: %s, User-Agent: %s, Accept-Language: %s]%n" | ||
.formatted( | ||
method, | ||
uri, | ||
Optional.ofNullable(queryString).map(q -> "?" + q).orElse(""), | ||
realIp, | ||
region, | ||
userAgent, | ||
acceptLanguage); | ||
} | ||
|
||
} | ||
|
||
} |
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
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
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
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
Submodule security
updated
from 21f3d2 to 2a16e7
21 changes: 21 additions & 0 deletions
21
src/test/java/com/lighthouse/lingoswap/auth/config/LoggingFilterTest.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,21 @@ | ||
package com.lighthouse.lingoswap.auth.config; | ||
|
||
import com.lighthouse.lingoswap.ControllerTestSupport; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; | ||
|
||
class LoggingFilterTest extends ControllerTestSupport { | ||
|
||
// user-agent:"PostmanRuntime/7.35.0", accept:"*/*", host:"localhost:8080", accept-encoding:"gzip, deflate, br", connection:"keep-alive" | ||
@Test | ||
void test() throws Exception { | ||
mockMvc.perform( | ||
get("/api/v1/question") | ||
.queryParam("categoryId", "1") | ||
.header("user-agent", "PostmanRuntime/7.35.0") | ||
.header("host", "PostmanRuntime/7.35.0") | ||
); | ||
} | ||
|
||
} |
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
7 changes: 7 additions & 0 deletions
7
src/test/java/com/lighthouse/lingoswap/match/application/MatchManagerTest.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,7 @@ | ||
package com.lighthouse.lingoswap.match.application; | ||
|
||
import com.lighthouse.lingoswap.IntegrationTestSupport; | ||
|
||
class MatchManagerTest extends IntegrationTestSupport { | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
src/test/java/com/lighthouse/lingoswap/match/presentation/MatchControllerTest.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,7 @@ | ||
package com.lighthouse.lingoswap.match.presentation; | ||
|
||
import com.lighthouse.lingoswap.ControllerTestSupport; | ||
|
||
class MatchControllerTest extends ControllerTestSupport { | ||
|
||
} |
Oops, something went wrong.