Thymeleaf + Spring Security Expression language

I'm trying to fetch the UserDetails object out of Spring Security from Thymeleaf. I have tried various SpEl things, like:

${#authentication.principal.blahblah}

I'm trying to assign this to a Javascript variable as:

var foo="${#authentication.principal.blahblah}";

I'm using Spring Boot 1.2.5 with the thymeleaf-extras-springsecurity4 dependency declared.

Answers


Try

<script th:inline="javascript">
var foo = /*[[${#authentication.principal.blahblah}]]*/;
</script>

Need Your Help

Blurryt text by transform: Rotate in Chrome

javascript css google-chrome

I have a list Hexagons In my web page like this

How to communicate between ASP.NET and an Excel workbook

c# asp.net javascript excel

Is there a way to load an Excel document in a web page and communicate with the excel control using code behind? (JavaScript or Asp.NET) ?