当前位置: 首页>>代码示例>>Java>>正文


Java PasswordMatcher类代码示例

本文整理汇总了Java中org.apache.shiro.authc.credential.PasswordMatcher的典型用法代码示例。如果您正苦于以下问题:Java PasswordMatcher类的具体用法?Java PasswordMatcher怎么用?Java PasswordMatcher使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PasswordMatcher类属于org.apache.shiro.authc.credential包,在下文中一共展示了PasswordMatcher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createSecurityManager

import org.apache.shiro.authc.credential.PasswordMatcher; //导入依赖的package包/类
/**
 * Creates the security manager without registering it.
 * 
 * @param repo  the component repository, only used to register secondary items like lifecycle, not null
 * @param pwService  the password service, not null
 * @return the security manager, not null
 */
protected SecurityManager createSecurityManager(ComponentRepository repo, PasswordService pwService) throws IOException {
  // password matcher
  PasswordMatcher pwMatcher = new PasswordMatcher();
  pwMatcher.setPasswordService(pwService);
  // user database realm
  UserSource userSource = getUserSource();
  if (userSource == null) {
    userSource = getUserMaster();
  }
  UserSourceRealm realm = new UserSourceRealm(userSource);
  realm.setAuthenticationCachingEnabled(true);
  realm.setAuthorizationCachingEnabled(true);
  realm.setCredentialsMatcher(pwMatcher);
  realm.setPermissionResolver(AuthUtils.getPermissionResolver());
  // security manager
  DefaultWebSecurityManager sm = new DefaultWebSecurityManager();
  sm.setRealm(realm);
  sm.setAuthorizer(realm);  // replace ModularRealmAuthorizer as not needed
  sm.setCacheManager(new MemoryConstrainedCacheManager());
  return sm;
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:29,代码来源:ShiroSecurityComponentFactory.java

示例2: createRealm

import org.apache.shiro.authc.credential.PasswordMatcher; //导入依赖的package包/类
@Override
    protected Realm createRealm(Ini ini) {
      // Set the resolvers first, because IniRealm is initialized before the resolvers
      // are applied by the ModularRealmAuthorizer
      IniRealm realm = new IniRealm() {
        @Override
        protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
          SimpleAccount account = (SimpleAccount) super.doGetAuthorizationInfo(principals);
          // implicitly, give the role agate-user to all users from ini
          if(account != null) account.addRole(Roles.AGATE_USER.toString());

          return account;
        }
      };
      realm.setName(INI_REALM);
//      realm.setRolePermissionResolver(rolePermissionResolver);
      realm.setPermissionResolver(permissionResolver);
      realm.setResourcePath(getShiroIniPath());
      realm.setCredentialsMatcher(new PasswordMatcher());
      realm.setIni(ini);
      return realm;
    }
 
开发者ID:obiba,项目名称:agate,代码行数:23,代码来源:SecurityManagerFactory.java

示例3: GitPlexAuthorizingRealm

import org.apache.shiro.authc.credential.PasswordMatcher; //导入依赖的package包/类
@Inject
  public GitPlexAuthorizingRealm(UserManager userManager, CacheManager cacheManager, ConfigManager configManager, 
  		MembershipManager membershipManager, GroupManager groupManager) {
   PasswordMatcher passwordMatcher = new PasswordMatcher();
   passwordMatcher.setPasswordService(AppLoader.getInstance(PasswordService.class));
setCredentialsMatcher(passwordMatcher);

  	this.userManager = userManager;
  	this.cacheManager = cacheManager;
  	this.configManager = configManager;
  	this.membershipManager = membershipManager;
  	this.groupManager = groupManager;
  }
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:14,代码来源:GitPlexAuthorizingRealm.java

示例4: PasswordRealmMixin

import org.apache.shiro.authc.credential.PasswordMatcher; //导入依赖的package包/类
public PasswordRealmMixin()
{
    super();
    passwordService = new DefaultPasswordService();
    PasswordMatcher matcher = new PasswordMatcher();
    matcher.setPasswordService( passwordService );
    setCredentialsMatcher( matcher );
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:9,代码来源:PasswordRealmMixin.java

示例5: MyRealmMixin

import org.apache.shiro.authc.credential.PasswordMatcher; //导入依赖的package包/类
public MyRealmMixin()
{
    super();
    passwordService = new DefaultPasswordService();
    PasswordMatcher matcher = new PasswordMatcher();
    matcher.setPasswordService( passwordService );
    setCredentialsMatcher( matcher );
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:9,代码来源:RealmServiceTest.java

示例6: Init

import org.apache.shiro.authc.credential.PasswordMatcher; //导入依赖的package包/类
@PostConstruct
private void Init()
{
    PasswordMatcher passwordMatcher = new PasswordMatcher();
    passwordMatcher.setPasswordService(passwordService);
    setCredentialsMatcher(passwordMatcher);
}
 
开发者ID:jvalenciag,项目名称:VaadinSpringShiroMongoDB,代码行数:8,代码来源:SpringRealm.java

示例7: AuthenticatingRealmImpl

import org.apache.shiro.authc.credential.PasswordMatcher; //导入依赖的package包/类
@Inject
public AuthenticatingRealmImpl(final SecurityConfigurationManager configuration,
                               final PasswordService passwordService)
{
  this.configuration = configuration;
  this.passwordService = passwordService;

  PasswordMatcher passwordMatcher = new PasswordMatcher();
  passwordMatcher.setPasswordService(this.passwordService);
  setCredentialsMatcher(passwordMatcher);
  setName(NAME);
  setAuthenticationCachingEnabled(true);
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:14,代码来源:AuthenticatingRealmImpl.java

示例8: getSecurityManager

import org.apache.shiro.authc.credential.PasswordMatcher; //导入依赖的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

示例9: setup

import org.apache.shiro.authc.credential.PasswordMatcher; //导入依赖的package包/类
protected void setup(HashService hashService, HashFormat hashFormat) {
    PortofinoPasswordService passwordService = new PortofinoPasswordService();
    passwordService.setHashService(hashService);
    passwordService.setHashFormat(hashFormat);
    PasswordMatcher passwordMatcher = new PasswordMatcher();
    passwordMatcher.setPasswordService(passwordService);
    setCredentialsMatcher(passwordMatcher);
    this.passwordService = passwordService;
}
 
开发者ID:ManyDesigns,项目名称:Portofino,代码行数:10,代码来源:AbstractPortofinoRealm.java

示例10: createRealm

import org.apache.shiro.authc.credential.PasswordMatcher; //导入依赖的package包/类
@Override
protected Realm createRealm(Ini ini) {
  // Set the resolvers first, because IniRealm is initialized before the resolvers
  // are applied by the ModularRealmAuthorizer
  IniRealm realm = new IniRealm();
  realm.setName(INI_REALM);
  realm.setRolePermissionResolver(rolePermissionResolver);
  realm.setPermissionResolver(permissionResolver);
  realm.setResourcePath(getShiroIniPath());
  realm.setCredentialsMatcher(new PasswordMatcher());
  realm.setIni(ini);
  return realm;
}
 
开发者ID:obiba,项目名称:mica2,代码行数:14,代码来源:SecurityManagerFactory.java

示例11: getShiroBeanFromIni

import org.apache.shiro.authc.credential.PasswordMatcher; //导入依赖的package包/类
@Test
public void getShiroBeanFromIni() {
    CdiIniSecurityManagerFactory securityManagerFactory = new CdiIniSecurityManagerFactory("classpath:test-shiro.ini", beanManager);
    SecurityManager securityManager = securityManagerFactory.createInstance();
    assertThat(securityManager, is(notNullValue()));
    Object passwordMatcher = securityManagerFactory.getBeans().get("passwordMatcher");
    assertThat(passwordMatcher, is(instanceOf(PasswordMatcher.class)));
}
 
开发者ID:ops4j,项目名称:org.ops4j.pax.shiro,代码行数:9,代码来源:CdiIniSecurityManagerFactoryTest.java

示例12: defineRealms

import org.apache.shiro.authc.credential.PasswordMatcher; //导入依赖的package包/类
/**
 * Defines the realms.
 *
 * @return a list of {@link Realm}.
 */
private List<Realm> defineRealms() {
    final List<Realm> realms = new ArrayList<Realm>();

    final IniRealm iniRealm = new IniRealm("classpath:userAndRoles.ini");
    iniRealm.setCredentialsMatcher(new PasswordMatcher());
    realms.add(iniRealm);
    return realms;
}
 
开发者ID:opensource21,项目名称:fuwesta,代码行数:14,代码来源:SecurityConfig.java

示例13: credentialsMatcher

import org.apache.shiro.authc.credential.PasswordMatcher; //导入依赖的package包/类
@Bean(name="credentialsMatcher")
public CredentialsMatcher credentialsMatcher(){
	return new PasswordMatcher();
}
 
开发者ID:ranji1221,项目名称:lemcloud,代码行数:5,代码来源:ShiroConfig.java

示例14: provideKhaRealm

import org.apache.shiro.authc.credential.PasswordMatcher; //导入依赖的package包/类
@Provides @Singleton KhaRealm provideKhaRealm(UsersDao usersDao, PasswordMatcher passwordMatcher) {
    KhaRealm realm = new KhaRealm(usersDao);
    realm.setCredentialsMatcher(passwordMatcher);
    realm.setAuthenticationCachingEnabled(true);
    return realm;
}
 
开发者ID:kalixia,项目名称:kha,代码行数:7,代码来源:SecurityModule.java

示例15: providePasswordMatcher

import org.apache.shiro.authc.credential.PasswordMatcher; //导入依赖的package包/类
@Provides @Singleton PasswordMatcher providePasswordMatcher(PasswordService passwordService) {
    PasswordMatcher passwordMatcher = new PasswordMatcher();
    passwordMatcher.setPasswordService(passwordService);
    return passwordMatcher;
}
 
开发者ID:kalixia,项目名称:kha,代码行数:6,代码来源:SecurityModule.java


注:本文中的org.apache.shiro.authc.credential.PasswordMatcher类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。