當前位置: 首頁>>代碼示例>>Java>>正文


Java AuthorizingRealm類代碼示例

本文整理匯總了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);
      }
    }
  }
}
 
開發者ID:sonatype,項目名稱:nexus-public,代碼行數:20,代碼來源:RealmManagerImpl.java

示例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();
        }
      }
    }
  }
}
 
開發者ID:sonatype,項目名稱:nexus-public,代碼行數:19,代碼來源:RealmManagerImpl.java

示例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;
}
 
開發者ID:Zabrimus,項目名稱:vdr-jonglisto,代碼行數:10,代碼來源:AppModule.java

示例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;
}
 
開發者ID:fireshort,項目名稱:spring-boot-quickstart,代碼行數:8,代碼來源:ShiroConfiguration.java

示例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;
}
 
開發者ID:arthurgregorio,項目名稱:exemplos,代碼行數:35,代碼來源:ShiroConfiguration.java

示例6: ShiroInitConfig

import org.apache.shiro.realm.AuthorizingRealm; //導入依賴的package包/類
public ShiroInitConfig(AuthorizingRealm realm) {
    this.realm = realm;
}
 
開發者ID:Teddy-Zhu,項目名稱:SilentGo,代碼行數:4,代碼來源:ShiroInitConfig.java

示例7: ShiroConfig

import org.apache.shiro.realm.AuthorizingRealm; //導入依賴的package包/類
public ShiroConfig(AuthorizingRealm realm) {
    this.realm = realm;
}
 
開發者ID:Teddy-Zhu,項目名稱:SilentGo,代碼行數:4,代碼來源:ShiroConfig.java

示例8: getRealm

import org.apache.shiro.realm.AuthorizingRealm; //導入依賴的package包/類
public AuthorizingRealm getRealm() {
    return realm;
}
 
開發者ID:Teddy-Zhu,項目名稱:SilentGo,代碼行數:4,代碼來源:ShiroConfig.java

示例9: setRealm

import org.apache.shiro.realm.AuthorizingRealm; //導入依賴的package包/類
public void setRealm(AuthorizingRealm realm) {
    this.realm = realm;
}
 
開發者ID:Teddy-Zhu,項目名稱:SilentGo,代碼行數:4,代碼來源:ShiroConfig.java

示例10: contributeWebSecurityManager

import org.apache.shiro.realm.AuthorizingRealm; //導入依賴的package包/類
public static void contributeWebSecurityManager(Configuration<Realm> configuration, AuthorizingRealm realm) {
    configuration.add(realm);
}
 
開發者ID:Zabrimus,項目名稱:vdr-jonglisto,代碼行數:4,代碼來源:AppModule.java

示例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;
}
 
開發者ID:fireshort,項目名稱:spring-boot-quickstart,代碼行數:7,代碼來源:ShiroConfiguration.java

示例12: authorizingRealm

import org.apache.shiro.realm.AuthorizingRealm; //導入依賴的package包/類
@Bean
public AuthorizingRealm authorizingRealm(){
    return new SpringRealm();
}
 
開發者ID:jvalenciag,項目名稱:VaadinSpringShiroMongoDB,代碼行數:5,代碼來源:SecurityConfig.java

示例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;
}
 
開發者ID:arthurgregorio,項目名稱:exemplos,代碼行數:34,代碼來源:ShiroConfiguration.java


注:本文中的org.apache.shiro.realm.AuthorizingRealm類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。