SpringSecurity 3

Spring Security 3.x.x (회원 가입 화면 구현)

회원 가입 로직을 짰으면 회원 가입 화면을 만들어서 웹 상에서 사용자들이 편하게 사용할 수 있도록 해보자 아래는 간단하게 만든 회원가입 HTML의 body 부분 이다. 이름 아이디 암호 이메일 전화번호 회원가입 목록 thymeleaf 템플릿을 사용 중이다. thymeleaf 사용 방법을 모른다면 thymeleaf에 대해 내가 작성한 글을 읽고 오자 일단 th:action의 경우 @{/member/regMember}를 이용하여 form태그의 경로를 설정 해주었다. method는 post방식을 사용한다. th:object="${memberDTO}라고 있는데 , 이 th:object 는 MemberController에 있는 MemberDTO객체를 가져온다는 것이다. ${ ... } 안에 객체를 지정해주면 해당..

Spring Security 3.x.x (회원가입)

이제 회원가입 기능 구현을 해보겠다. Entity 생성 @Entity @Getter @Builder @NoArgsConstructor @AllArgsConstructor @ToString public class Member { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(nullable = false) private String userName;//이름 @Column(nullable = false, updatable = false, unique = true) private String userId;//아이디 @Column(nullable = false) private String password;//암호 ..

Spring Security 3.x.x (초기 설정)

오늘은 Spring Security를 정리해보자! Springboot 3.2.2 / gradle기준이다. springboot 2.x.x버전 대는 구글링하면 많이 나오지만, 여러가지 좀 바뀐 3.x.x버전 대는 많이 없어서 따로 정리해본다. 먼저 build.gradle에 springSecurity 의존성을 추가해주자 implementation 'org.springframework.boot:spring-boot-starter-security' 위의 것은 스프링 시큐리티 의존성이다. 그리고 밑의 것은 스프링 시큐리티와 타임리프를 같이 사용할 경우 추가 해준다. implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6' ※ thymeleaf-e..