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 | 29 | 30 |
Tags
- fullcalendar
- 페치조인
- jQueryUI
- Generic
- 제네릭
- 벌크연산
- 엔티티직접사용
- calendar
- namedQuery
- jQuery값전송
- paging
- fetchjoin
- 자바서블릿
- Hibernate
- LIST
- 대량쿼리
- javaservlet
- 제너릭
- 페이징
- JQuery
- javascriptcalendar
- JPQL
- jQuery값전달
- JPA
- jscalendar
- values()
- springflow
- 스프링데이터흐름
- joinfetch
- 프로젝트생성
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