Java-Shiro (five): Shiro Realm of use for (two) IniRealm of, JdbcRelam usage, custom Realm

Introduced

Previous When explaining Realm Profile, introduced Realm Realm contains about four categories of default, this chapter explains:

1) IniRealm usage;

2) JdbcRealm implement authentication, authorization, and based on the default table mysql query;

3) JdbcRealm mysql-based custom tables and query for authentication, authorization.

4) Custom Realm.

When the one explained, a theme class diagram of the Realm, the reference need be repeated here:

 

From the figure, we can see AuthenticatingRealm be AuthorizingRealm parent:

1) AuthenticatingRealm class inside the external authentication interface provides an abstraction:

2) AuthorizingRealm class provides an abstraction of external internal authorization interface:

3) due to AuthorizingRealm inherited AuthenticationgRelam, therefore AuthorizingRealm have the authentication, authorization interface.

Therefore behind to explain the custom Realm, we will use inherited AuthorizingRealm way to achieve self-defined Realm.

IniRealm usage

In fact IniRealm usage and PropertiesRealm most similar in several Shiro default.

 

JdbcRealm usage

Internal JdbcRealm default SQL tables and queries

 

JdbcRealm use custom SQL table and plug Syria

 

Custom Realm

 

Guess you like

Origin www.cnblogs.com/yy3b2007com/p/12089148.html