Can Thymeleaf integrate with apache shiro?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Can Thymeleaf integrate with apache shiro?

廖师虎
Hello!
I'm used the spring mvc and apache shiro in recent one year, and nearly want to use thymeleaf too, but I can't find how to do? Who can help me, Thanks !
Reply | Threaded
Open this post in threaded view
|

Re: Can Thymeleaf integrate with apache shiro?

Zemi
Administrator
Hi,

I don't know Apache Shiro, but looking at the documentation seem to be compatible with Thymeleaf, as it is configured as a Servlet filter, as long as you don't use the JSP tags.

If you have your security logic in the Java code, for example,
    if ( currentUser.hasRole( "admin" ) ) {
        log.info("User is an admin" );
    }
you don't need to do anything extra.

If you want to use something like JSP tags, like
    <shiro:hasRole ... />
you would have to implement an equivalent Thymeleaf Dialect.


Reply | Threaded
Open this post in threaded view
|

Re: Can Thymeleaf integrate with apache shiro?

廖师虎
Thanks Zemi!
I want to use the shiro tag like in jsp, how to implement the Thymeleaf Dialect? Where is the sample or tutorial?
Reply | Threaded
Open this post in threaded view
|

Re: Can Thymeleaf integrate with apache shiro?

Zemi
Administrator
At the documentation page you have two articles:
- Say Hello! Extending Thymeleaf in 5 minutes
- Say Hello Again! Extending Thymeleaf even more in another 5 minutes
and one tutorial:
- Extending Thymeleaf

Besides, at the ecosystem page you would find some examples of Dialects.

Reply | Threaded
Open this post in threaded view
|

Re: Can Thymeleaf integrate with apache shiro?

廖师虎
Thank you very much! Zemi!