本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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));
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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");
}
示例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;
}