本文整理汇总了Java中org.apache.shiro.authc.credential.PasswordMatcher.setPasswordService方法的典型用法代码示例。如果您正苦于以下问题:Java PasswordMatcher.setPasswordService方法的具体用法?Java PasswordMatcher.setPasswordService怎么用?Java PasswordMatcher.setPasswordService使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.shiro.authc.credential.PasswordMatcher
的用法示例。
在下文中一共展示了PasswordMatcher.setPasswordService方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: 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;
}
示例3: PasswordRealmMixin
import org.apache.shiro.authc.credential.PasswordMatcher; //导入方法依赖的package包/类
public PasswordRealmMixin()
{
super();
passwordService = new DefaultPasswordService();
PasswordMatcher matcher = new PasswordMatcher();
matcher.setPasswordService( passwordService );
setCredentialsMatcher( matcher );
}
示例4: MyRealmMixin
import org.apache.shiro.authc.credential.PasswordMatcher; //导入方法依赖的package包/类
public MyRealmMixin()
{
super();
passwordService = new DefaultPasswordService();
PasswordMatcher matcher = new PasswordMatcher();
matcher.setPasswordService( passwordService );
setCredentialsMatcher( matcher );
}
示例5: Init
import org.apache.shiro.authc.credential.PasswordMatcher; //导入方法依赖的package包/类
@PostConstruct
private void Init()
{
PasswordMatcher passwordMatcher = new PasswordMatcher();
passwordMatcher.setPasswordService(passwordService);
setCredentialsMatcher(passwordMatcher);
}
示例6: 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);
}
示例7: 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;
}
示例8: 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;
}
示例9: providePasswordMatcher
import org.apache.shiro.authc.credential.PasswordMatcher; //导入方法依赖的package包/类
@Provides @Singleton PasswordMatcher providePasswordMatcher(PasswordService passwordService) {
PasswordMatcher passwordMatcher = new PasswordMatcher();
passwordMatcher.setPasswordService(passwordService);
return passwordMatcher;
}
示例10: 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);
}
return this.securityManager;
}