本文整理汇总了Java中org.jasypt.util.password.PasswordEncryptor类的典型用法代码示例。如果您正苦于以下问题:Java PasswordEncryptor类的具体用法?Java PasswordEncryptor怎么用?Java PasswordEncryptor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PasswordEncryptor类属于org.jasypt.util.password包,在下文中一共展示了PasswordEncryptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import org.jasypt.util.password.PasswordEncryptor; //导入依赖的package包/类
@Override
protected void configure() {
bind(JsonTransformer.class);
bind(JwtGenerator.class);
bind(PasswordEncryptor.class).to(RFC2307SMD5PasswordEncryptor.class);
bind(UserService.class).to(UserServiceImpl.class);
bind(UsersController.class);
bind(RoleService.class).to(RoleServiceImpl.class);
bind(RoleController.class);
bind(CompanyService.class).to(CompanyServiceImpl.class);
bind(CompaniesController.class);
bind(UrlDecoder.class);
bind(FilterRequestFactory.class);
}
示例2: createAuthenticator
import org.jasypt.util.password.PasswordEncryptor; //导入依赖的package包/类
/**
* <p>If a credentialFile is provided, this method will use that file to populate the list of Peers the Authenticator
* checks during request processing. If instead the "users" and "passwords" Strings are provided, this method will use
* those to populate the list of Peers.</p>
* @return An Authenticator appropriate for registering with Jersey as described
* https://dropwizard.github.io/dropwizard/manual/auth.html
*/
public Authenticator<BasicCredentials, Peer> createAuthenticator() {
PasswordEncryptor passwordEncryptor = encryptor.getPasswordEncryptor();
if (this.credentialFile != null) {
InputStream allowedPeersResource = this.getClass().getClassLoader().getResourceAsStream(this.credentialFile);
return new AllowedPeerAuthenticator(new FlatFilePeerDAO(allowedPeersResource),
passwordEncryptor);
}
else if (this.users != null && this.passwords != null && this.delimiter != null) {
return new AllowedPeerAuthenticator(new StringPeerDAO(this.users, this.passwords, this.delimiter),
passwordEncryptor);
}
else {
throw new IllegalStateException("Illegal call to createAuthenticator() when no valid configuration was set");
}
}
示例3: main
import org.jasypt.util.password.PasswordEncryptor; //导入依赖的package包/类
public static void main(String[] args) {
String password = args.length >= 1 ? args[0] : "strong";
String text = args.length >= 2 ? args[1] : "i am hero";
PasswordEncryptor passwordEncryptor = new StrongPasswordEncryptor();
String encryptedPassword = passwordEncryptor.encryptPassword(password);
BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
textEncryptor.setPassword(encryptedPassword);
String myEncryptedText = textEncryptor.encrypt(text);
System.out.println(myEncryptedText);
}
示例4: getPasswordEncryptor
import org.jasypt.util.password.PasswordEncryptor; //导入依赖的package包/类
public PasswordEncryptor getPasswordEncryptor() {
switch (this) {
case NONE : return null;
case BASIC : return new BasicPasswordEncryptor();
case STRONG : return new StrongPasswordEncryptor();
default : throw new IllegalStateException("No support for encryptor type " + this);
}
}
示例5: UserCommandHandler
import org.jasypt.util.password.PasswordEncryptor; //导入依赖的package包/类
@Autowired
public UserCommandHandler(Repository<UserAggregate> userAggregateRepository,
UserRepository userRepository,
PasswordEncryptor passwordEncryptor) {
this.userAggregateRepository = userAggregateRepository;
this.userRepository = userRepository;
this.passwordEncryptor = passwordEncryptor;
}
示例6: setUp
import org.jasypt.util.password.PasswordEncryptor; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
// set up the encryptor here
PasswordEncryptor passwordEncryptor = new TestPasswordEncryptor();
fixture = Fixtures.newGivenWhenThenFixture(UserAggregate.class);
UserCommandHandler commandHandler = new UserCommandHandler(fixture.getRepository(), mock(UserRepository.class), passwordEncryptor);
fixture.registerAnnotatedCommandHandler(commandHandler);
fixture.setReportIllegalStateChange(false);
}
示例7: AuthenticationService
import org.jasypt.util.password.PasswordEncryptor; //导入依赖的package包/类
public AuthenticationService(UserRepository userRepository, PasswordEncryptor passwordEncryptor, String secret, Period expiresDuration, Period passwordExpiresDuration, Period passwordReminder) {
if (secret.length() < SECRET_MIN_LENGTH) {
throw new IllegalArgumentException("secret must be at least " + SECRET_MIN_LENGTH + " characters long, " +
"but it was only " + secret.length());
}
this.userRepository = userRepository;
this.passwordEncryptor = passwordEncryptor;
this.expiresDuration = expiresDuration;
this.passwordExpiresDuration = passwordExpiresDuration;
this.passwordReminderDuration = passwordReminder;
this.base64 = new Base64(-1, null, true);
this.secret = secret.getBytes(UTF_8);
}
示例8: UserServiceImpl
import org.jasypt.util.password.PasswordEncryptor; //导入依赖的package包/类
@Inject
public UserServiceImpl(UserRepository userRepository, PasswordEncryptor passwordEncryptor) {
this.userRepository = userRepository;
this.passwordEncryptor = passwordEncryptor;
}
示例9: matchPassword
import org.jasypt.util.password.PasswordEncryptor; //导入依赖的package包/类
private boolean matchPassword(String password) {
PasswordEncryptor pe = new BasicPasswordEncryptor();
return pe.checkPassword(password, encryptedPassword);
}
示例10: setPasswordEncryptor
import org.jasypt.util.password.PasswordEncryptor; //导入依赖的package包/类
public void setPasswordEncryptor(PasswordEncryptor passwordEncryptor)
{
this.passwordEncryptor = passwordEncryptor;
}
示例11: AllowedPeerAuthenticator
import org.jasypt.util.password.PasswordEncryptor; //导入依赖的package包/类
public AllowedPeerAuthenticator(PeerDAO peerDAO, PasswordEncryptor passwordEncryptor) {
this.allPeers = peerDAO.findAll();
this.passwordEncryptor = passwordEncryptor;
LOGGER.info("Constructed Authenticator with {} allowed peers", this.allPeers.size());
}
示例12: getEncryptor
import org.jasypt.util.password.PasswordEncryptor; //导入依赖的package包/类
PasswordEncryptor getEncryptor() {
return Encryptor.valueOf(type).getPasswordEncryptor();
}
示例13: passwordEncryptor
import org.jasypt.util.password.PasswordEncryptor; //导入依赖的package包/类
@Bean
public PasswordEncryptor passwordEncryptor() {
return new StrongPasswordEncryptor();
}
示例14: getPasswordEncryptor
import org.jasypt.util.password.PasswordEncryptor; //导入依赖的package包/类
public PasswordEncryptor getPasswordEncryptor() {
return passwordEncryptor;
}
示例15: encryptor
import org.jasypt.util.password.PasswordEncryptor; //导入依赖的package包/类
private PasswordEncryptor encryptor() {
return new HexPasswordEncryptor();
}