일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- 시큐리티로그인
- html
- springboot
- 리눅스
- gradle
- java
- StyleSheet
- 반복문
- css
- security
- javascript
- sql
- 코딩테스트
- codingtest
- 스프링 부트
- 목록
- Spring boot
- programmers
- springSecurity
- Linux
- 프로그래머스
- 소스트리
- 시큐리티 로그인
- 로그인
- 시큐리티
- 싱글톤
- input태그
- 시큐리티 로그아웃
- 2차원배열
- JAVA11
Archives
- Today
- Total
JAVAIARY
Spring Security - 7. 표현식과 동적 화면 구성 본문
표현식 | 설명 |
hasRole( [role] ) hasAuthority( [authority] ) |
해당 권한이 있으면 true |
hasAnyRole( [role,role2]) hasAnyAuthority([authority]) |
여러 권한들 중에서 하나라도 해당하는 권한이 있으면 true |
principal | 현재 사용자 정보를 의미 |
permitAll | 모든 사용자에게 허용 |
denyAll | 모든 사용자에게 거부 |
isAnomymous( ) | 익명의 사용자의 경우(로그인을 하지 않은 경우도 해당) |
isAuthenticated( ) | 인증된 사용자면 true |
isFullyAuthenticated( ) | Remember-me로 인증된 것이 아닌 인증된 사용자인 경우 true |
- 대부분 true/false 리턴
- 조건문 형식과 비슷
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.springframework.org/security/tags" prefix="sec" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Insert title here</title>
</head>
<body>
<h1>/sample/all page</h1>
<sec:authorize access="isAnonymous()">
<a href="/customLogin">로그인</a>
</sec:authorize>
<sec:authorize access="isAuthenticated()">
<a href="/springsecurity/logoutForm">로그아웃</a>
</sec:authorize>
</body>
</html>
all.jsp
- 로그인 여부에 따라 다르게 보이도록 함
'lectureNote > SPRING' 카테고리의 다른 글
Spring Security - 9. 기존 프로젝트에 적용하기 (0) | 2022.12.25 |
---|---|
Spring Security - 8. 자동로그인!! (0) | 2022.12.21 |
Spring Security - 6. JSP에서 시큐리티 사용하기 (1) | 2022.12.21 |
Spring Security - 5. mybatis를 이용하여 기존테이블을 통한 인증/권한 처리 (0) | 2022.12.21 |
lombok 과 어노테이션 (0) | 2022.12.21 |