当前位置: 首页>>代码示例>>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;未经允许,请勿转载。