feat: locked sign-in message and Change password dialog in the portal
mobile-api now records the browser user agent the portal forwards as X-Client-User-Agent instead of the portal server's own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
1 parent
5ce684168a
commit
6598b58cb8
14 files changed
+364
-12
No files matched your search
+2
-2
@@ -94,7 +94,7 @@ public class AdminAuthenticationService {
|
||||
}
|
||||
}
|
||||
|
||||
/** Best-effort login history entry with the caller's X-Client-IP and User-Agent; never throws. */
|
||||
/** Best-effort login history entry with the caller's X-Client-IP and X-Client-User-Agent; never throws. */
|
||||
public void record(String username, String event, String message) {
|
||||
try {
|
||||
HttpServletRequest req = RequestContextHolder.getRequestAttributes() instanceof ServletRequestAttributes a
|
||||
@@ -103,7 +103,7 @@ public class AdminAuthenticationService {
|
||||
body.put("username", username);
|
||||
body.put("event", event);
|
||||
body.put("ip", req == null ? null : req.getHeader("X-Client-IP"));
|
||||
body.put("userAgent", req == null ? null : req.getHeader("User-Agent"));
|
||||
body.put("userAgent", req == null ? null : req.getHeader("X-Client-User-Agent"));
|
||||
body.put("message", message);
|
||||
restTemplateUtil.postForEntity(
|
||||
restTemplateUtil.getURLforApiService(RestApiSystemServiceConstants.API_REST_LOGIN_SECURITY_RECORD),
|
||||
|
||||
+2
-1
@@ -76,7 +76,8 @@ class AdminAuthenticationServiceLoginSecurityTest {
|
||||
void record_sendsClientIpAndUserAgentFromRequest() {
|
||||
MockHttpServletRequest req = new MockHttpServletRequest();
|
||||
req.addHeader("X-Client-IP", "203.0.113.7");
|
||||
req.addHeader("User-Agent", "JUnit");
|
||||
req.addHeader("X-Client-User-Agent", "JUnit");
|
||||
req.addHeader("User-Agent", "node");
|
||||
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(req));
|
||||
when(rest.postForEntity(any(String.class), eq(String.class), any())).thenReturn(ResponseEntity.ok(""));
|
||||
|
||||
|
||||
Reference in new issue
Block a user