티스토리 뷰

☠️ Java

Spring Tags

James Wetzel 2024. 11. 24. 16:03
728x90
반응형
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-taglibs</artifactId>
</dependency>

<%@ taglib uri="http://www.springframework.org/security/tags" prefix="sec" %>

<!-- ADMIN Role -->
<sec:authorize access="hasRole('ADMIN')">
    <p>This section is visible only to Admins.</p>
</sec:authorize>

<!-- Non-USER Role -->
<sec:authorize access="!hasRole('USER')">
    <p>This section is visible to non-Users.</p>
</sec:authorize>

<!-- Authenticated User -->
<sec:authorize access="isAuthenticated()">
    <p>You are logged in as an authenticated user.</p>
</sec:authorize>

<!-- Anonymous User -->
<sec:authorize access="isAnonymous()">
    <p>Please log in to access more features.</p>
</sec:authorize>

 

<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
728x90
반응형