Chuyển đến nội dung chính

Bài đăng

Hiển thị các bài đăng có nhãn authentication

[Shiro][Spring-MVC] Apache Shiro with Spring framework, Java config and WebApplicationInitializer

Recently I was adding  Apache Shiro  security framework to Spring based web application which is using Java config and doesn't have xml configuration at all, not even web.xml Apache Shiro documentation is mostly using xml examples so it took some time to put it all together in Java config based application. Central part of Shiro security is  a realm. Here is how official Shiro documentation defines realms: " A Realm is a component that can access application-specific security data such as users, roles, and permissions. The Realm translates this application-specific data into a format that Shiro understands so Shiro can in turn provide a single easy-to-understand  Subject  programming API no matter how many data sources exist or how application-specific your data might be ." Shiro comes with number of out-of-the-box Realm  implementations that connects directly to database, to LDAP, etc, but in this example we will use custom Realm implementation since