Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- Generic
- 벌크연산
- 페치조인
- jQueryUI
- jQuery값전달
- 페이징
- JPQL
- fetchjoin
- 프로젝트생성
- namedQuery
- JPA
- 자바서블릿
- paging
- JQuery
- javascriptcalendar
- 스프링데이터흐름
- 제너릭
- Hibernate
- joinfetch
- calendar
- javaservlet
- jQuery값전송
- springflow
- 제네릭
- 대량쿼리
- LIST
- fullcalendar
- values()
- 엔티티직접사용
- jscalendar
Archives
- Today
- Total
가자공부하러!
Spring Security 활용 회원 관리 (4) - JSP에서 로그인 정보 받아오는 방법 본문
소스코드 :
1. 스크립트릿
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <% Object prc = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); //user 정보 저장 UserDetails ud = (UserDetails)prc; //ID out.println( ud.getUsername() + "<br>"); //PW out.println( ud.getPassword() + "<br>"); //권한정보 Iterator it = ud.getAuthorities().iterator(); while( it.hasNext() ){ String s = it.next() + ""; out.println( s + "<br>" ); } %> | cs |
2. security taglib 활용
2.1. 디펜던시
1 2 3 4 | <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-taglibs</artifactId> </dependency> | cs |
2.2. jsp
1 2 3 4 5 6 7 8 9 10 11 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %> <sec:authentication property="principal" var="prc"/> ${prc.username } <c:forEach items="${prc.authorities }" var="auth"> ${auth } </c:forEach> | cs |
'공부 > Spring Boot' 카테고리의 다른 글
Spring Security 활용 회원 관리 (5) - AJAX 403 처리(Spring Boot) (0) | 2019.09.26 |
---|---|
에러 페이지 설정(403, 404, 500 ...) (0) | 2019.09.21 |
EHCache 설정과 활용(Spring Boot 2.1.8) (0) | 2019.09.19 |
Spring Security 활용 회원 관리 (3) - Spring Security와 Embedded Redis (0) | 2019.09.17 |
Spring Security 활용 회원 관리 (2) - 커스텀 로그인 뷰 설정 (0) | 2019.09.17 |
Comments