본문 바로가기 메뉴 바로가기

기록

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

기록

검색하기 폼
  • 전체보기 (49)
    • ∙Java & Spring (15)
    • ∙Infra (7)
    • ∙Database (2)
    • ∙Monitoring (1)
    • ∙Design Pattern (2)
    • ∙React + Spring (5)
    • ∙React (5)
    • ∙React native (3)
    • ∙기술 단어 (2)
    • ∙도서 (2)
    • ∙기타 (5)
  • 방명록

∙React + Spring (5)
회원가입,로그인,로그아웃 기능,경로 설정(react + spring boot )

1. 회원가입,로그인,로그아웃 기능 - auth.service const API_URL = "http://localhost:8080/api/auth/"; class AuthService { register(username, email, password) { return axios.post(API_URL + "signup", { username, email, password }); } } - spring boot 서버에 넘겨주기 위해 API_URL를 알맞게 설정하고 username, email, password를 값을 post를 보내준다. 이 때 통신을 하기 위해서 axios 썼다. 서버에서는 중복값 체크를 한다. login(username, password) { return axios .post(API_..

∙React + Spring 2021. 8. 17. 15:33
spring boot JWT 인증 #4 (Controller)

1. Controller 생성 - AuthController @CrossOrigin(origins = "*", maxAge = 3600) @RestController @RequestMapping("/api/auth") public class AuthController { ..... @PostMapping("/signin") public ResponseEntity authenticateUser(@Valid @RequestBody LoginRequest loginRequest) { Authentication authentication = authenticationManager.authenticate( new UsernamePasswordAuthenticationToken (loginRequest.getUse..

∙React + Spring 2021. 8. 17. 14:13
spring boot JWT 인증 #3 ( 비인증, 필터, JWT 생성)

1. unauthorizedHandler 비인증 처리 - AuthEntryPointJwt @Component // 인증,인가 예외발생시 처리 public class AuthEntryPointJwt implements AuthenticationEntryPoint { private static final Logger logger = LoggerFactory.getLogger(AuthEntryPointJwt.class); @Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletExceptio..

∙React + Spring 2021. 8. 17. 11:45
spring boot JWT 인증 #2 (model, repository, userDetails, configAdapter)

1. model 생성 - User @Data @Entity @Table(name = "users", uniqueConstraints = { @UniqueConstraint(columnNames = "username"), @UniqueConstraint(columnNames = "email") }) public class User { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @NotBlank @Size(max = 20) private String username; @NotBlank @Size(max = 50) @Email private String email; @NotBlank @Size(max = 120) priva..

∙React + Spring 2021. 8. 17. 11:02
이전 1 2 다음
이전 다음

Blog is powered by Tistory / Designed by Tistory
전체 방문자
Today :
Yesterday :
  • 전체보기 (49)
    • ∙Java & Spring (15)
    • ∙Infra (7)
    • ∙Database (2)
    • ∙Monitoring (1)
    • ∙Design Pattern (2)
    • ∙React + Spring (5)
    • ∙React (5)
    • ∙React native (3)
    • ∙기술 단어 (2)
    • ∙도서 (2)
    • ∙기타 (5)
  • 방명록

티스토리툴바