Directory

← Back

shiro-vaadin-integration

Apache Shiro support for Vaadin 10+ applications

Author

Rating

Popularity

<100

This library allows you to use Vaadin 10's Router with Apache Shiro.

Instructions

Implement the Vaadin views. For example:

@Route
public class LoginView extends VerticalLayout {}

@Route
public class View1View extends VerticalLayout {}

@Route
public class View2View extends VerticalLayout {}

Add a shiro.ini file in the resources directory and set your security configuration. Configure and ese the VaadinNavigationRolesAuthorizationFilter. For example:

[main]
authc.loginUrl = /login
vaadin = org.vaadin.shiro.VaadinNavigationRolesAuthorizationFilter
vaadin.loginUrl = /login

[users]
admin = admin, admin
user = user, user

[roles]
admin = *
user = action1:*

[urls]
/ = anon, vaadin
/login = anon, vaadin
/view1 = authc, vaadin[admin]
/view2 = authc, vaadin[user]

In order for this to work you have to configure the following filters:

@WebListener
public class ShiroListener extends EnvironmentLoaderListener { }

@WebFilter(urlPatterns = "/*")
public class ShiroFilter extends VaadinShiroFilter { }

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Updated to Vaadin 14.6.3 and Apache Shiro 1.7.1.

Released
2021-06-22
Maturity
STABLE
License
Apache License 2.0

Compatibility

Framework
Vaadin 14
Vaadin 10 in 1.0.2
Browser
N/A

shiro-vaadin-integration - Vaadin Add-on Directory

Apache Shiro support for Vaadin 10+ applications shiro-vaadin-integration - Vaadin Add-on Directory
This library allows you to use Vaadin 10's Router with Apache Shiro. Instructions ------------ Implement the *Vaadin views*. For example: ```java @Route public class LoginView extends VerticalLayout {} @Route public class View1View extends VerticalLayout {} @Route public class View2View extends VerticalLayout {} ``` Add a `shiro.ini` file in the `resources` directory and set your security configuration. Configure and ese the `VaadinNavigationRolesAuthorizationFilter`. For example: ``` [main] authc.loginUrl = /login vaadin = org.vaadin.shiro.VaadinNavigationRolesAuthorizationFilter vaadin.loginUrl = /login [users] admin = admin, admin user = user, user [roles] admin = * user = action1:* [urls] / = anon, vaadin /login = anon, vaadin /view1 = authc, vaadin[admin] /view2 = authc, vaadin[user] ``` In order for this to work you have to configure the following filters: ```java @WebListener public class ShiroListener extends EnvironmentLoaderListener { } @WebFilter(urlPatterns = "/*") public class ShiroFilter extends VaadinShiroFilter { } ```
Source code

shiro-vaadin-integration version 1.0.0

shiro-vaadin-integration version 1.0.1
Fixes #3 Doesn't work with server-side navigation. Compiled with Vaadin 10.0.5.

shiro-vaadin-integration version 1.0.2
Updated to Vaadin 12.0.7 and bug fixes.

shiro-vaadin-integration version 1.1.0
Updated to Vaadin 14.6.3 and Apache Shiro 1.7.1.

Online