Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/theborakompanioni/thymeleaf-extras-shiro

A Thymeleaf dialect for Apache Shiro tags.
https://github.com/theborakompanioni/thymeleaf-extras-shiro

shiro spring thymeleaf

Last synced: 1 day ago
JSON representation

A Thymeleaf dialect for Apache Shiro tags.

Awesome Lists containing this project

README

        

[![Build](https://github.com/theborakompanioni/thymeleaf-extras-shiro/actions/workflows/build.yml/badge.svg)](https://github.com/theborakompanioni/thymeleaf-extras-shiro/actions/workflows/build.yml)
[![GitHub Release](https://img.shields.io/github/release/theborakompanioni/thymeleaf-extras-shiro.svg?maxAge=3600)](https://github.com/theborakompanioni/thymeleaf-extras-shiro/releases/latest)
[![Maven Central](https://img.shields.io/maven-central/v/com.github.theborakompanioni/thymeleaf-extras-shiro.svg?maxAge=3600)](http://search.maven.org/#search|ga|1|g%3A%22com.github.theborakompanioni%22%20AND%20a%3A%22thymeleaf-extras-shiro%22)
[![License](https://img.shields.io/github/license/theborakompanioni/thymeleaf-extras-shiro.svg?maxAge=2592000)](https://github.com/theborakompanioni/thymeleaf-extras-shiro/blob/master/LICENSE)

thymeleaf-extras-shiro
---

A [Thymeleaf](https://www.thymeleaf.org/) dialect for [Apache Shiro](https://shiro.apache.org) [tags](https://shiro.apache.org/tags).

## Download

##### Gradle
```groovy
implementation "com.github.theborakompanioni:thymeleaf-extras-shiro:${thymeleaf-shiro.version}"
```

##### Maven
```html

com.github.theborakompanioni
thymeleaf-extras-shiro
${thymeleaf-shiro.version}

```

##### Jar
[Download](https://search.maven.org/#search|gav|1|g%3A%22com.github.theborakompanioni%22%20AND%20a%3A%22thymeleaf-extras-shiro%22) from Maven Central.

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

## Example
```html


thymeleaf-extras-shiro


Please login



Hello, , how are you today?


```

### 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](https://shiro.apache.org/web.html#Web-JSP%252FGSPTagLibrary) of the Apache Shiro documentation.

Tags can be written in attribute or element notation:

##### Attribute
```html


Goodbye cruel World!


```

##### Element
```html

Hello World!

```

* * *

#### The `guest` tag
```html


Please Login


```

#### The `user` tag
```html


Welcome back John! Not John? Click here to login.


```

#### The `authenticated` tag
```html
Update your contact information
```

#### The `notAuthenticated` tag
```html


Please login in order to update your credit card information.


```

#### The `principal` tag
```html

Hello, , how are you today?


```
or
```html

Hello, , how are you today?


```

Typed principal and principal property are also supported.

#### The `hasRole` tag
```html
Administer the system
```

#### The `lacksRole` tag
```html


Sorry, you are not allowed to administer the system.


```

#### The `hasAllRoles` tag
```html


You are a developer and a project manager.


```

#### The `hasAnyRoles` tag
```html


You are a developer, project manager, or administrator.


```

#### The `hasPermission` tag
```html
Create a new User
```

#### The `lacksPermission` tag
```html


Sorry, you are not allowed to delete user accounts.


```

#### The `hasAllPermissions` tag
```html


You can create and delete users.


```

#### The `hasAnyPermissions` tag
```html


You can create or delete users.


```

## Resources
- Apache Shiro (Website): https://shiro.apache.org
- Apache Shiro (GitHub): https://github.com/apache/shiro
- Thymeleaf (Website): https://www.thymeleaf.org/
- Thymeleaf (GitHub): https://github.com/thymeleaf/thymeleaf

## License
The project is licensed under the Apache License. See [LICENSE](LICENSE) for details.