spring mvc - Use of sec:authorize to load javascript -


i'm making development using spring mvc , thymeleaf.
i'm trying use sec:authorize load javascript. in other words, want script load when user authenticated. here code i'm trying work:

<script src="/js/jquery.min.js"         th:src="@{/js/jquery.min.js}"></script>         <script src="/js/submit.js"         th:src="@{/js/submit.js}"></script>         <script src="/js/url.js"         th:src="@{/js/url.js}"></script>          <!-- admin -->         <script sec:authorize="isauthenticated()" src="/js/jquery.simplemodal-1.4.4.js"         th:src="@{/js/jquery.simplemodal-1.4.4.js}"></script>         <script sec:authorize="isauthenticated()" src="/js/admin.js"         th:src="@{/js/admin.js}"></script> 

these last 2 resources i'm trying use sec:authorize load seem handle every time load page. valid way use sec:authorize? id isn't, there way this?

isauthenticated() may returning role_anonymous legit role, hence why returning true , rendering script.

here explanation why user can authenticated anonymous (which in turn breaks logic) why 'anonymoususer' authenticated in spring security?

to circumvent , advise want user specific access there need roles such role_user, role_admin.

hope helps.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -