spring security jsp 태그 라 이브 러 리

spring - security jsp 의 태그 라 이브 러 리
1. jsp 에서 설명
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>

2. 라벨
현재 모두 세 개의 라벨 이 있다.
   
<sec:authorize></sec:authorize>      
<sec:authentication property=""></sec:authentication>
<sec:accesscontrollist hasPermission="" domainObject=""></sec:accesscontrollist>

      
2.1 권한 부여 라벨
이 탭 은 내용 이 실 행 될 지 여 부 를 결정 하 는 데 사 용 됩 니 다.
<sec:authorize access="hasRole('supervisor')">
    This content will only be visible to users who have
    the "supervisor" authority in their list of GrantedAuthoritys.
</sec:authorize>

사용자 가 클릭 할 수 있다 면 특정한 링크 를 표시 합 니 다.
<sec:authorize url="/admin">
    This content will only be visible to users who are authorized to send requests to the "/admin" URL.
</sec:authorize>

2.2 인증 라벨
이 탭 은 현재 Authentication 대상 에 접근 하여 보안 컨 텍스트 에 저장 할 수 있 습 니 다.
예 를 들 어 Authentication 의 principal 속성 이 Spring Security 의 User Details 대상 의 인 스 턴 스 라면
사용 하 다
<sec:authentication property="principal.username" /> 

현재 사용자 의 이름 을 렌 더 링 합 니 다.
물론 JSP 라벨 을 사용 하지 않 아 도 됩 니 다. 일부 사람들 은 보기에 서 논 리 를 적 게 유지 하 는 것 이 좋 습 니 다.MVC 컨트롤 러 에서 Authentication 대상 에 접근 할 수 있 습 니 다 (호출 을 통 해
Security ContextHolder. getContext (). getAuthentication () 을 모델 에 직접 데 이 터 를 추가 하여 보 기 를 렌 더 링 합 니 다.
2.3, accesscontrollist 태그
이 라벨 은 Spring Security ACL 모듈 을 사용 할 때 만 사용 할 수 있 습 니 다.그것 은 쉼표 로 구 분 된 특 을 검사 했다.
영역 대상 을 정 하 는 데 필요 한 권한 목록 입 니 다.현재 사용자 가 이 권한 을 가 진 모든 것 이 있 으 면 탭 내용 이 실 행 됩 니 다.
그렇지 않 으 면 생략 될 것 이다.
<sec:accesscontrollist hasPermission="1,2" domainObject="${someObject}">
    This will be shown if the user has either of the permissions
    represented by the values "1" or "2" on the given object.
</sec:accesscontrollist>

참고: SpringSecurity-3.0.1_중국어 공식 문서 (번역 판). pdf

좋은 웹페이지 즐겨찾기