Skip to content
Proyectos

theborakompanioni/thymeleaf-extras-shiro

Ver en GitHub

Acerca de

Un dialecto de Thymeleaf para las etiquetas de Apache Shiro.

Desarrollo web y de aplicaciones

Cómo se miden estas cifras

Crecimiento de estrellas medido

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Recopilando historial

Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.

README.md

Original

Build GitHub Release Maven Central License

thymeleaf-extras-shiro

A Thymeleaf dialect for Apache Shiro tags.

Download

Gradle
implementation "com.github.theborakompanioni:thymeleaf-extras-shiro:${thymeleaf-shiro.version}"
Maven
<dependency>
    <groupId>com.github.theborakompanioni</groupId>
    <artifactId>thymeleaf-extras-shiro</artifactId>
    <version>${thymeleaf-shiro.version}</version>
</dependency>
Jar

Download from Maven Central.

Repository
git clone https://github.com/theborakompanioni/thymeleaf-extras-shiro.git

Example

<!DOCTYPE html>
<html xmlns:shiro="https://www.github.com/theborakompanioni/thymeleaf-extras-shiro">

  <head>
    <title>thymeleaf-extras-shiro</title>
  </head>

  <body>
    <p shiro:guest="">Please <a href="login.html">login</a></p>
    <p shiro:authenticated="">
      Hello, <span shiro:principal=""></span>, how are you today?
    </p>
  </body>

</html>

Tags

The following examples show how to integrate the tags in your Thymeleaf templates. These are all implementations of the examples given in the JSP / GSP Tag Library Section of the Apache Shiro documentation.

Tags can be written in attribute or element notation:

Attribute
<p shiro:anyTag>
  Goodbye cruel World!
</p>
Element
<shiro:anyTag>
  <p>Hello World!</p>
</shiro:anyTag>

The guest tag

<p shiro:guest="">
  Please <a href="login.html">Login</a>
</p>

The user tag

<p shiro:user="">
  Welcome back John! Not John? Click <a href="login.html">here<a> to login.
</p>

The authenticated tag

<a shiro:authenticated="" href="updateAccount.html">Update your contact information</a>

The notAuthenticated tag

<p shiro:notAuthenticated="">
  Please <a href="login.html">login</a> in order to update your credit card information.
</p>

The principal tag

<p>Hello, <span shiro:principal=""></span>, how are you today?</p>

or

<p>Hello, <shiro:principal/>, how are you today?</p>

Typed principal and principal property are also supported.

The hasRole tag

<a shiro:hasRole="administrator" href="admin.html">Administer the system</a>

The lacksRole tag

<p shiro:lacksRole="administrator">
  Sorry, you are not allowed to administer the system.
</p>

The hasAllRoles tag

<p shiro:hasAllRoles="developer, project manager">
  You are a developer and a project manager.
</p>

The hasAnyRoles tag

<p shiro:hasAnyRoles="developer, project manager, administrator">
  You are a developer, project manager, or administrator.
</p>

The hasPermission tag

<a shiro:hasPermission="user:create" href="createUser.html">Create a new User</a>

The lacksPermission tag

<p shiro:lacksPermission="user:delete">
  Sorry, you are not allowed to delete user accounts.
</p>

The hasAllPermissions tag

<p shiro:hasAllPermissions="user:create, user:delete">
  You can create and delete users.
</p>

The hasAnyPermissions tag

<p shiro:hasAnyPermissions="user:create, user:delete">
  You can create or delete users.
</p>

Resources

License

The project is licensed under the Apache License. See LICENSE for details.

Explorar proyectos relacionados

Cargando…