本文整理匯總了Java中org.apache.shiro.realm.AuthorizingRealm類的典型用法代碼示例。如果您正苦於以下問題:Java AuthorizingRealm類的具體用法?Java AuthorizingRealm怎麽用?Java AuthorizingRealm使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
AuthorizingRealm類屬於org.apache.shiro.realm包,在下文中一共展示了AuthorizingRealm類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doStop
import org.apache.shiro.realm.AuthorizingRealm; //導入依賴的package包/類
@Override
protected void doStop() throws Exception {
eventManager.unregister(this);
configuration = null;
// reset shiro caches
Collection<Realm> realms = realmSecurityManager.getRealms();
if (realms != null) {
for (Realm realm : realms) {
if (realm instanceof AuthenticatingRealm) {
((AuthenticatingRealm) realm).setAuthenticationCache(null);
}
if (realm instanceof AuthorizingRealm) {
((AuthorizingRealm) realm).setAuthorizationCache(null);
}
}
}
}
示例2: clearAuthzRealmCaches
import org.apache.shiro.realm.AuthorizingRealm; //導入依賴的package包/類
/**
* Looks up registered {@link AuthorizingRealm}s, and clears their authz caches if they have it set.
*/
private void clearAuthzRealmCaches() {
// NOTE: we don't need to iterate all the Sec Managers, they use the same Realms, so one is fine.
Collection<Realm> realms = realmSecurityManager.getRealms();
if (realms != null) {
for (Realm realm : realms) {
if (realm instanceof AuthorizingRealm) {
Cache cache = ((AuthorizingRealm) realm).getAuthorizationCache();
if (cache != null) {
log.debug("Clearing cache: {}", cache);
cache.clear();
}
}
}
}
}
示例3: buildRealm
import org.apache.shiro.realm.AuthorizingRealm; //導入依賴的package包/類
public AuthorizingRealm buildRealm(UserService userService, ConfigurationService configService) {
JdbcSaltedRealm realm = new JdbcSaltedRealm(userService, configService);
HashedCredentialsMatcher matcher = new HashedCredentialsMatcher("SHA-256");
matcher.setHashIterations(1024);
matcher.setStoredCredentialsHexEncoded(false);
realm.setCredentialsMatcher(matcher);
return realm;
}
示例4: getDefaultWebSecurityManager
import org.apache.shiro.realm.AuthorizingRealm; //導入依賴的package包/類
@Bean(name = "securityManager")
public DefaultWebSecurityManager getDefaultWebSecurityManager(AuthorizingRealm realm) {
DefaultWebSecurityManager dwsm = new DefaultWebSecurityManager();
dwsm.setRealm(realm);
dwsm.setCacheManager(getEhCacheManager());
return dwsm;
}
示例5: getSecurityManager
import org.apache.shiro.realm.AuthorizingRealm; //導入依賴的package包/類
/**
* @return the default security manager for this application
*/
@Produces
public WebSecurityManager getSecurityManager() {
if (this.securityManager == null) {
// creates a custom security realm
final AuthorizingRealm realm
= new SecurityRealm(this.accountService);
// instantiate the custom password matcher based on bcrypt
final PasswordMatcher passwordMatcher = new PasswordMatcher();
passwordMatcher.setPasswordService(new BCryptPasswordService());
realm.setCredentialsMatcher(passwordMatcher);
// create the security manager
this.securityManager = new DefaultWebSecurityManager(realm);
// enable the remember me function based on cookies
final CookieRememberMeManager rememberMeManager
= new CookieRememberMeManager();
rememberMeManager.setCipherKey(this.createCypherKey());
this.securityManager.setRememberMeManager(rememberMeManager);
this.securityManager.setCacheManager(new MemoryConstrainedCacheManager());
}
return this.securityManager;
}
示例6: ShiroInitConfig
import org.apache.shiro.realm.AuthorizingRealm; //導入依賴的package包/類
public ShiroInitConfig(AuthorizingRealm realm) {
this.realm = realm;
}
示例7: ShiroConfig
import org.apache.shiro.realm.AuthorizingRealm; //導入依賴的package包/類
public ShiroConfig(AuthorizingRealm realm) {
this.realm = realm;
}
示例8: getRealm
import org.apache.shiro.realm.AuthorizingRealm; //導入依賴的package包/類
public AuthorizingRealm getRealm() {
return realm;
}
示例9: setRealm
import org.apache.shiro.realm.AuthorizingRealm; //導入依賴的package包/類
public void setRealm(AuthorizingRealm realm) {
this.realm = realm;
}
示例10: contributeWebSecurityManager
import org.apache.shiro.realm.AuthorizingRealm; //導入依賴的package包/類
public static void contributeWebSecurityManager(Configuration<Realm> configuration, AuthorizingRealm realm) {
configuration.add(realm);
}
示例11: getShiroRealm
import org.apache.shiro.realm.AuthorizingRealm; //導入依賴的package包/類
@Bean(name = "realm")
public AuthorizingRealm getShiroRealm(AccountService accountService) {
ShiroDbRealm shiroDbRealm = new ShiroDbRealm();
shiroDbRealm.setAccountService(accountService);
return shiroDbRealm;
}
示例12: authorizingRealm
import org.apache.shiro.realm.AuthorizingRealm; //導入依賴的package包/類
@Bean
public AuthorizingRealm authorizingRealm(){
return new SpringRealm();
}
示例13: getSecurityManager
import org.apache.shiro.realm.AuthorizingRealm; //導入依賴的package包/類
/**
* @return the default security manager for this application
*/
@Produces
public WebSecurityManager getSecurityManager() {
if (this.securityManager == null) {
// creates a custom security realm
final AuthorizingRealm realm
= new SecurityRealm(this.accountService);
// instantiate the custom password matcher based on bcrypt
final PasswordMatcher passwordMatcher = new PasswordMatcher();
passwordMatcher.setPasswordService(new BCryptPasswordService());
realm.setCredentialsMatcher(passwordMatcher);
// create the security manager
this.securityManager = new DefaultWebSecurityManager(realm);
// enable the remember me function based on cookies
final CookieRememberMeManager rememberMeManager
= new CookieRememberMeManager();
rememberMeManager.setCipherKey(this.createCypherKey());
this.securityManager.setRememberMeManager(rememberMeManager);
}
return this.securityManager;
}