spring - Build url with 'sec:authentication="name"' -
i know if there possibility build url.
what use:
- spring boot + spring security
- thymeleaf
with following expression, username
sec:authentication="name"
if following, current username display
<span id="username" sec:authentication="name">testuser</span>
but build url following:
<a th:href="@{'~/' + __${{sec.authentication='name'}}__ + '/edit'}" class="text-left">settings</a>
with following error:
org.springframework.expression.spel.spelevaluationexception: el1009e:(pos 4): property or field 'authentication' cannot set on null
any suggestions?
thanks in advance.
as it's described in docs here: https://github.com/thymeleaf/thymeleaf-extras-springsecurity3
your url should be:
<a th:href="@{|~/${#authentication.name}/edit|}" class="text-left">settings</a>
Comments
Post a Comment