Saturday, 28 September 2013

Thymeleaf is not parsing "sec:authorize" attribute

Thymeleaf is not parsing "sec:authorize" attribute

I'm using thymeleaf-spring3 2.0.18 and Spring 3.1.1. I've done a Login
page that works ok but, while other Thymeleaf attributes are parsed,
"sec:autorize" aren't, since I can see them if I review source code of
generated view.
This is my login.html:
<!DOCTYPE html>
<head>
...
</head>
<body>
<div class="top">
<div class="container">
<ul class="loginbar pull-right">
<li sec:authorize="isAnonymous()"><a href="/login"
class="login-btn">Login</a></li>
<li sec:authorize="isAuthenticated()"
class="login-btn">Welcome <span
sec:authentication="name">Bob</span></li>
</ul>
</div>
</div><!--/top-->
<!--=== Content Part ===-->
<div class="container">
<div class="row-fluid">
<form name="f" th:action="@{/j_spring_security_check}"
method="post" class="log-page">
<h3>Login</h3>
<div th:if="${loginError}"
th:with="errorMsg=${session['SPRING_SECURITY_LAST_EXCEPTION'].message}"
class="alert alert-error">
Usuario o contraseña incorrecto.<br/>
Cause: <span th:text="${errorMsg}">Wrong input!</span>
</div>
<div class="input-prepend">
<span class="add-on"><i class="icon-user"></i></span>
<input name="j_username" class="input-xlarge" type="text"
placeholder="Username" />
</div>
<div class="input-prepend">
<span class="add-on"><i class="icon-lock"></i></span>
<input name="j_password" class="input-xlarge"
type="password" placeholder="Password" />
</div>
<div class="controls form-inline">
<button class="btn-u pull-right" type="submit">Login</button>
</div>
</form>
</div><!--/row-fluid-->
</div><!--/container-->
<!--=== End Content Part ===-->
</body>
</html>

No comments:

Post a Comment