|
|
|
@@ -1,5 +1,6 @@
|
|
|
|
package com.kri.kart.server.controller;
|
|
|
|
package com.kri.kart.server.controller;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.kri.common.feature.auth.dto.JwtUserClaimsDto;
|
|
|
|
import com.kri.common.feature.web.RequestUserContext;
|
|
|
|
import com.kri.common.feature.web.RequestUserContext;
|
|
|
|
import com.kri.kart.server.dto.auth.LoginRequestDto;
|
|
|
|
import com.kri.kart.server.dto.auth.LoginRequestDto;
|
|
|
|
import com.kri.kart.server.dto.auth.LoginResponseDto;
|
|
|
|
import com.kri.kart.server.dto.auth.LoginResponseDto;
|
|
|
|
@@ -7,6 +8,10 @@ import com.kri.kart.server.service.AuthService;
|
|
|
|
import jakarta.validation.Valid;
|
|
|
|
import jakarta.validation.Valid;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
|
|
|
|
|
|
import org.springframework.http.CacheControl;
|
|
|
|
|
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
|
|
|
|
import org.springframework.security.core.annotation.CurrentSecurityContext;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
@@ -19,6 +24,12 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
public class AuthController {
|
|
|
|
public class AuthController {
|
|
|
|
private final AuthService authService;
|
|
|
|
private final AuthService authService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/my-info")
|
|
|
|
|
|
|
|
public ResponseEntity<JwtUserClaimsDto> myInfo(
|
|
|
|
|
|
|
|
@CurrentSecurityContext(expression = "authentication.details") JwtUserClaimsDto user) {
|
|
|
|
|
|
|
|
return ResponseEntity.ok().cacheControl(CacheControl.noStore()).body(user);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/login")
|
|
|
|
@PostMapping("/login")
|
|
|
|
public LoginResponseDto login(
|
|
|
|
public LoginResponseDto login(
|
|
|
|
@Valid @RequestBody LoginRequestDto request, RequestUserContext ctx) {
|
|
|
|
@Valid @RequestBody LoginRequestDto request, RequestUserContext ctx) {
|
|
|
|
|