더북(TheBook)

loginform.jsp

<%@ page contentType="text/html; charset=utf-8" %>
<html>
<head>
<title>로그인</title>
</head>
<body>
<h1>로그인</h1>
<form action="./login" method="post">
    <p>사용자명 <input type="text" name="username" placeholder="username">
    <p>비밀번호 <input type="password" name="password" placeholder="password">
    <p><button type="submit">로그인</button>
    <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
</form>
</body>
</html>

webpage08_04.jsp

<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %> 
<html>
<head>
<title>Security</title>
</head>
<body>
<h2>스프링 시큐리티 예</h2>

<sec:authorize access="isAuthenticated()">
    <h5><sec:authentication property="principal.username"/>님, 반갑습니다.</h5>
    <form action="./logout" method="POST">
    <button type="submit">LOGOUT</button>
        <input name="${_csrf.parameterName}" type="hidden" value="${_csrf.token}"/>
    </form>
</sec:authorize>
</body>
</html>
신간 소식 구독하기
뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.