Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 소켓통신
- bootstrap
- 오라클 c##제거
- IAM 결제
- TCP/IP
- SpringToolSuite4
- Update
- aws
- web browser external
- AWS사용자
- springboot
- html사용자함수
- javasecurity
- AWS경보
- oracle 18
- hmlt
- AWS 청구
- IP통신
- jsNature
- js구구단
- html주문폼
- 깃헙 데스크탑
- jsp에러
- JPA
- MFC
- git stah
- AWS요금
- hit desktop
- servlet에러
- C++
Archives
- Today
- Total
Ynns
spring security 프로젝트 (2) 본문
# DB 테이블 생성
--jdbc 인증을 위한 테이블 생성
create table spring_member(
userid varchar2(50) not null primary key,
userpw varchar2(100) not null,
username varchar2(100) not null,
regdate date default sysdate,
updatedate date default sysdate,
enabled char(1) default '1'
);
create table spring_member_auth(
userid varchar2(50) not null,
auth varchar2(50) not null, --ROLE(권한) 정보(ex ROLE_MEMBER)
constraint fk_member_suth foreign key(userid)
references spring_member(userid)
);
# pom.xml 라이브러리 추가
<!-- spring JDBC -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.1.10.RELEASE</version>
</dependency>
<!-- HikariCP -->
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>3.3.1</version>
</dependency>
# root-context.xml에서 HikariCP 빈 생성
# junit -> 단위(모듈) 테스트 프레임워크 추가 /어디에서나 사용할 수 있게 스코프<scope> 삭제
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-test -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.1.10.RELEASE</version>
</dependency>
# security-context.xml 인증 방식을 JDBC 방식으로 변경하고 비밀번호 함호화 하기
...
<!-- 비밀번호 암호화 -->
<bean id="bcrypt" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder"></bean>
...
<security:authentication-manager>
<!-- 인증 권한 관련 -->
<security:authentication-provider>
<!-- 사용자 인증을 JDBC 방식으로 인증하기 -->
<security:jdbc-user-service data-source-ref="ds"/>
<security:password-encoder ref="bcrypt"/>
</security:authentication-provider>
</security:authentication-manager>
'JAVA > Spring' 카테고리의 다른 글
spring security 프로젝트(4) (0) | 2019.11.26 |
---|---|
spring 프로젝트 암호화 로그인 오류 해결 (0) | 2019.11.14 |
spring security 프로젝트 (3) (0) | 2019.11.08 |
spring security 프로젝트 실행 (1-1) (0) | 2019.11.08 |
spring security 프로젝트 (1) (0) | 2019.11.07 |
Comments