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
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
thymeleaf로 HTML 페이지를 동적으로 만듭니다 (spring + gradle)지난번에는 에서 화면에 HTML을 표시했습니다. 이번에는 화면을 동적으로 움직여보고 싶기 때문에 입력한 문자를 화면에 표시시키고 싶습니다. 초보자의 비망록이므로 이상한 점 등 있으면 지적 받을 수 있으면 기쁩니다! ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.