title: Spring security using thymeleaf with "if" condition
body: <p>I a using Spring security with an HTML page using thymeleaf. I have a problem to use the "sec:authorize" property in this case:</p>
  
  <pre><code>&lt;ul class="nav nav-tabs margin15-bottom"&gt;
      &lt;li th:each="criteriaGroup,iterGroups : ${aGroupList}"
          th:class="${iterGroups.index == 0}? 'active'"&gt;
          &lt;a th:href="'#' + ${criteriaGroup.id}" data-toggle="tab"
             th:text="${criteriaGroup.groupName}"&gt;&lt;/a&gt;
      &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>Now I want to add a spring security property like: if I have this particular criteria, I need a authorization (<code>sec:authorize="hasRole('Criteria')"</code>) although I will not see the tab corresponding to this criteria:</p>
  
  <pre><code>&lt;ul class="nav nav-tabs margin15-bottom"&gt;
      &lt;li th:each="aGroup,iterGroups : ${aGroupList}" th:class="${iterGroups.index == 0}? 'active'"
          th:sec:authorize="$({criteriaGroup.id =='criteriaA'} || ${criteriaGroup.id =='criteriaB'}) ? 'hasRole('Criteria')'"&gt;
          &lt;a th:href="'#' + ${criteriaGroup.id}" data-toggle="tab"
             th:text="${criteriaGroup.groupName}"&gt;&lt;/a&gt;
      &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>But when I am doing this I have the following error:</p>
  
  <pre><code>org.thymeleaf.exceptions.TemplateProcessingException:   Error processing template: dialect prefix "th" is set as non-lenient but attribute "th:sec:authorize" has not been removed during process
  </code></pre>
  
  <p>How can I avoid it?</p>