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


Java PasswordService类代码示例

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


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

示例1: createSecurityManager

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

import org.apache.shiro.authc.credential.PasswordService; //导入依赖的package包/类
@Override
protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {
  switch (propertyName.hashCode()) {
    case 1402846733:  // userMaster
      ((WebUserData) bean).setUserMaster((UserMaster) newValue);
      return;
    case 348360602:  // passwordService
      ((WebUserData) bean).setPasswordService((PasswordService) newValue);
      return;
    case -1723794814:  // uriUserName
      ((WebUserData) bean).setUriUserName((String) newValue);
      return;
    case 3599307:  // user
      ((WebUserData) bean).setUser((ManageableUser) newValue);
      return;
  }
  super.propertySet(bean, propertyName, newValue, quiet);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:19,代码来源:WebUserData.java

示例3: bind

import org.apache.shiro.authc.credential.PasswordService; //导入依赖的package包/类
/**
 * Declares some services.
 */
public static void bind(ServiceBinder binder) {
	binder.bind(UserDAO.class, UserDAOImpl.class);
	binder.bind(PageDAO.class, PageDAOImpl.class);
	binder.bind(TagDAO.class, TagDAOImpl.class);
	binder.bind(CommentDAO.class, CommentDAOImpl.class);
	binder.bind(CommentController.class, CommentControllerImpl.class);
	binder.bind(UserController.class, UserControllerImpl.class);
	binder.bind(PageController.class, PageControllerImpl.class);
	binder.bind(TagController.class, TagControllerImpl.class);
	binder.bind(EloquentiaRealm.class);
	binder.bind(PasswordService.class, BcryptPasswordService.class);
	binder.bind(PasswordHasher.class, BcryptPasswordService.class);
	binder.bind(UserValueEncoder.class);
	binder.bind(PageValueEncoder.class);
	binder.bind(PagePermissionChecker.class);
	binder.bind(UserService.class, UserServiceImpl.class);
	binder.bind(PageActivationContextService.class, PageActivationContextServiceImpl.class);
}
 
开发者ID:thiagohp,项目名称:eloquentia,代码行数:22,代码来源:AppModule.java

示例4: onInitialize

import org.apache.shiro.authc.credential.PasswordService; //导入依赖的package包/类
@Override
protected void onInitialize() {
	super.onInitialize();
	
	PasswordEditBean bean = new PasswordEditBean();
	
	Set<String> excludedProperties = new HashSet<>();
	
	// in case administrator changes password we do not ask for old password
	if (SecurityUtils.isAdministrator()) 
		excludedProperties.add("oldPassword");
	
	Form<?> form = new Form<Void>("form") {

		@Override
		protected void onSubmit() {
			super.onSubmit();
			getUser().setPassword(AppLoader.getInstance(PasswordService.class).encryptPassword(bean.getNewPassword()));
			GitPlex.getInstance(UserManager.class).save(getUser(), null);
			Session.get().success("Password has been changed");

			bean.setOldPassword(null);
			replace(BeanContext.editBean("editor", bean, excludedProperties));
		}

	};
	add(form);
	
	form.add(BeanContext.editBean("editor", bean, excludedProperties));
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:31,代码来源:PasswordEditPage.java

示例5: GitPlexAuthorizingRealm

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

示例6: DefaultUserManager

import org.apache.shiro.authc.credential.PasswordService; //导入依赖的package包/类
@Inject
public DefaultUserManager(Dao dao, CacheManager cacheManager, PasswordService passwordService) {
    super(dao);
    
    this.passwordService = passwordService;
    this.cacheManager = cacheManager;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:8,代码来源:DefaultUserManager.java

示例7: DefaultDataManager

import org.apache.shiro.authc.credential.PasswordService; //导入依赖的package包/类
@Inject
public DefaultDataManager(IdManager idManager, UserManager userManager, 
		ConfigManager configManager, TaskScheduler taskScheduler, 
		PersistManager persistManager, MailManager mailManager, 
		Validator validator, PasswordService passwordService) {
	this.userManager = userManager;
	this.configManager = configManager;
	this.validator = validator;
	this.idManager = idManager;
	this.taskScheduler = taskScheduler;
	this.persistManager = persistManager;
	this.mailManager = mailManager;
	this.passwordService = passwordService;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:15,代码来源:DefaultDataManager.java

示例8: ResetAdminPasswordCommand

import org.apache.shiro.authc.credential.PasswordService; //导入依赖的package包/类
@Inject
public ResetAdminPasswordCommand(PhysicalNamingStrategy physicalNamingStrategy, HibernateProperties properties, 
		Interceptor interceptor, IdManager idManager, Dao dao, 
		EntityValidator validator, UserManager userManager, PasswordService passwordService) {
	super(physicalNamingStrategy, properties, interceptor, idManager, dao, validator);
	this.userManager = userManager;
	this.passwordService = passwordService;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:9,代码来源:ResetAdminPasswordCommand.java

示例9: passwordService

import org.apache.shiro.authc.credential.PasswordService; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
public PasswordService passwordService() {
    DefaultPasswordService service = new DefaultPasswordService();

    DefaultHashService hashService = new DefaultHashService();
    hashService.setHashAlgorithmName(shiroProperties.getHashAlgorithmName());
    hashService.setHashIterations(shiroProperties.getHashIterations());
    service.setHashService(hashService);

    return service;
}
 
开发者ID:storezhang,项目名称:utils,代码行数:13,代码来源:ShiroAutoConfiguration.java

示例10: SecurityConfigurationManagerImpl

import org.apache.shiro.authc.credential.PasswordService; //导入依赖的package包/类
@Inject
public SecurityConfigurationManagerImpl(final SecurityConfigurationSource configurationSource,
                                        final SecurityConfigurationCleaner configCleaner,
                                        final PasswordService passwordService,
                                        final EventManager eventManager)
{
  this.configurationSource = configurationSource;
  this.eventManager = eventManager;
  this.configCleaner = configCleaner;
  this.passwordService = passwordService;
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:12,代码来源:SecurityConfigurationManagerImpl.java

示例11: UserManagerImpl

import org.apache.shiro.authc.credential.PasswordService; //导入依赖的package包/类
@Inject
public UserManagerImpl(final EventManager eventManager,
                       final SecurityConfigurationManager configuration,
                       final SecuritySystem securitySystem,
                       final PasswordService passwordService)
{
  this.eventManager = checkNotNull(eventManager);
  this.configuration = configuration;
  this.securitySystem = securitySystem;
  this.passwordService = passwordService;
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:12,代码来源:UserManagerImpl.java

示例12: DefaultSecurityPasswordService

import org.apache.shiro.authc.credential.PasswordService; //导入依赖的package包/类
@Inject
public DefaultSecurityPasswordService(@Named("legacy") final PasswordService legacyPasswordService) {
  this.passwordService = new DefaultPasswordService();
  this.legacyPasswordService = checkNotNull(legacyPasswordService);

  //Create and set a hash service according to our hashing policies
  DefaultHashService hashService = new DefaultHashService();
  hashService.setHashAlgorithmName(DEFAULT_HASH_ALGORITHM);
  hashService.setHashIterations(DEFAULT_HASH_ITERATIONS);
  hashService.setGeneratePublicSalt(true);
  this.passwordService.setHashService(hashService);
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:13,代码来源:DefaultSecurityPasswordService.java

示例13: AuthenticatingRealmImpl

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

示例14: setUp

import org.apache.shiro.authc.credential.PasswordService; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();

  realm = (AuthenticatingRealmImpl) lookup(Realm.class, AuthenticatingRealmImpl.NAME);
  configurationManager = lookup(SecurityConfigurationManagerImpl.class);
  passwordService = lookup(PasswordService.class, "default");
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:9,代码来源:AuthenticatingRealmImplTest.java

示例15: initPasswordService

import org.apache.shiro.authc.credential.PasswordService; //导入依赖的package包/类
/**
 * Initializes the password service via {@code createPasswordService}.
 * 
 * @param repo  the component repository, not null
 * @return the password service, not null
 */
protected PasswordService initPasswordService(ComponentRepository repo) {
  PasswordService pwService = createPasswordService(repo);
  ComponentInfo info = new ComponentInfo(PasswordService.class, getClassifier());
  repo.registerComponent(info, pwService);
  return pwService;
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:13,代码来源:ShiroSecurityComponentFactory.java


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