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

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -