Skip to content

Commit

Permalink
Merge pull request #88 from Triumers/hotfix
Browse files Browse the repository at this point in the history
[Fix] 외부망 접속 시 2차 인증 버그 수정위한 컨트롤러
  • Loading branch information
Leegiyeon authored Jun 12, 2024
2 parents bf0c385 + 2ecded0 commit 3bd9241
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.triumers.kmsback.common.controller;

import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
Expand All @@ -10,6 +11,9 @@
@RestController
public class StatusCheckController {

@Value("${in-house-ip-address}")
private String defaultIpAddress;

@GetMapping("/health-check")
public ResponseEntity<String> checkHealthStatus() {

Expand All @@ -21,4 +25,11 @@ public ResponseEntity<String> checkIpAddressCheck(HttpServletRequest request) {

return ResponseEntity.status(HttpStatus.OK).body("Current Ip Address: " + IpAddressUtil.getClientIp(request));
}

@GetMapping("/is-in-house")
public ResponseEntity<String> isInHouse(HttpServletRequest request) {
String ipAddress = IpAddressUtil.getClientIp(request);
String inHouseIpAddress = defaultIpAddress;
return ResponseEntity.status(HttpStatus.OK).body("current: " + ipAddress + " / in-house: " + inHouseIpAddress + " / is same?: " + ipAddress.equals(inHouseIpAddress));
}
}

0 comments on commit 3bd9241

Please sign in to comment.