本文整理汇总了Java中org.jasig.cas.authentication.UsernamePasswordCredential.getPassword方法的典型用法代码示例。如果您正苦于以下问题:Java UsernamePasswordCredential.getPassword方法的具体用法?Java UsernamePasswordCredential.getPassword怎么用?Java UsernamePasswordCredential.getPassword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jasig.cas.authentication.UsernamePasswordCredential
的用法示例。
在下文中一共展示了UsernamePasswordCredential.getPassword方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: authenticateUsernamePasswordInternal
import org.jasig.cas.authentication.UsernamePasswordCredential; //导入方法依赖的package包/类
@Override
protected final HandlerResult authenticateUsernamePasswordInternal(final UsernamePasswordCredential credential)
throws GeneralSecurityException, PreventedException {
try {
if (this.fileName == null || !this.fileName.exists()) {
throw new FileNotFoundException("Filename does not exist");
}
final String username = credential.getUsername();
final String passwordOnRecord = getPasswordOnRecord(username);
if (StringUtils.isBlank(passwordOnRecord)) {
throw new AccountNotFoundException(username + " not found in backing file.");
}
final String password = credential.getPassword();
if (StringUtils.isNotBlank(password) && this.getPasswordEncoder().encode(password).equals(passwordOnRecord)) {
return createHandlerResult(credential, this.principalFactory.createPrincipal(username), null);
}
} catch (final IOException e) {
throw new PreventedException("IO error reading backing file", e);
}
throw new FailedLoginException();
}
示例2: authenticate
import org.jasig.cas.authentication.UsernamePasswordCredential; //导入方法依赖的package包/类
@Override
public HandlerResult authenticate(final Credential credential)
throws GeneralSecurityException, PreventedException {
final UsernamePasswordCredential usernamePasswordCredential = (UsernamePasswordCredential) credential;
final String username = usernamePasswordCredential.getUsername();
final String password = usernamePasswordCredential.getPassword();
final Exception exception = this.usernameErrorMap.get(username);
if (exception instanceof GeneralSecurityException) {
throw (GeneralSecurityException) exception;
} else if (exception instanceof PreventedException) {
throw (PreventedException) exception;
} else if (exception instanceof RuntimeException) {
throw (RuntimeException) exception;
} else if (exception != null) {
logger.debug("Cannot throw checked exception {} since it is not declared by method signature.", exception);
}
if (StringUtils.hasText(username) && StringUtils.hasText(password) && username.equals(password)) {
logger.debug("User [{}] was successfully authenticated.", username);
return new DefaultHandlerResult(this, new BasicCredentialMetaData(credential));
}
logger.debug("User [{}] failed authentication", username);
throw new FailedLoginException();
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:27,代码来源:SimpleTestUsernamePasswordAuthenticationHandler.java
示例3: authenticateUsernamePasswordInternal
import org.jasig.cas.authentication.UsernamePasswordCredential; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected final HandlerResult authenticateUsernamePasswordInternal(final UsernamePasswordCredential credential)
throws GeneralSecurityException, PreventedException {
try {
final String username = credential.getUsername();
final String passwordOnRecord = getPasswordOnRecord(username);
if (StringUtils.isBlank(passwordOnRecord)) {
throw new AccountNotFoundException(username + " not found in backing file.");
}
final String password = credential.getPassword();
if (StringUtils.isNotBlank(password) && this.getPasswordEncoder().encode(password).equals(passwordOnRecord)) {
return createHandlerResult(credential, this.principalFactory.createPrincipal(username), null);
}
} catch (final IOException e) {
throw new PreventedException("IO error reading backing file", e);
}
throw new FailedLoginException();
}
示例4: authenticate
import org.jasig.cas.authentication.UsernamePasswordCredential; //导入方法依赖的package包/类
@Override
public HandlerResult authenticate(final Credential credential)
throws GeneralSecurityException, PreventedException {
final UsernamePasswordCredential usernamePasswordCredential = (UsernamePasswordCredential) credential;
final String username = usernamePasswordCredential.getUsername();
final String password = usernamePasswordCredential.getPassword();
final Exception exception = this.usernameErrorMap.get(username);
if (exception instanceof GeneralSecurityException) {
throw (GeneralSecurityException) exception;
} else if (exception instanceof PreventedException) {
throw (PreventedException) exception;
} else if (exception instanceof RuntimeException) {
throw (RuntimeException) exception;
} else if (exception != null) {
logger.debug("Cannot throw checked exception {} since it is not declared by method signature.", exception);
}
if (StringUtils.hasText(username) && StringUtils.hasText(password) && username.equals(password)) {
logger.debug("User [{}] was successfully authenticated.", username);
return new HandlerResult(this, new BasicCredentialMetaData(credential));
}
logger.debug("User [{}] failed authentication", username);
throw new FailedLoginException();
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:27,代码来源:SimpleTestUsernamePasswordAuthenticationHandler.java
示例5: authenticateUsernamePasswordInternal
import org.jasig.cas.authentication.UsernamePasswordCredential; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
protected final HandlerResult authenticateUsernamePasswordInternal(final UsernamePasswordCredential credential)
throws GeneralSecurityException, PreventedException {
try {
final String username = credential.getUsername();
final String passwordOnRecord = getPasswordOnRecord(username);
if (passwordOnRecord == null) {
throw new AccountNotFoundException(username + " not found in backing file.");
}
if (credential.getPassword() != null
&& this.getPasswordEncoder().encode(credential.getPassword()).equals(passwordOnRecord)) {
return createHandlerResult(credential, new SimplePrincipal(username), null);
}
} catch (final IOException e) {
throw new PreventedException("IO error reading backing file", e);
}
throw new FailedLoginException();
}
示例6: authenticate
import org.jasig.cas.authentication.UsernamePasswordCredential; //导入方法依赖的package包/类
@Override
public HandlerResult authenticate(final Credential credential)
throws GeneralSecurityException, PreventedException {
final UsernamePasswordCredential usernamePasswordCredential = (UsernamePasswordCredential) credential;
final String username = usernamePasswordCredential.getUsername();
final String password = usernamePasswordCredential.getPassword();
final Exception exception = this.usernameErrorMap.get(username);
if (exception instanceof GeneralSecurityException) {
throw (GeneralSecurityException) exception;
} else if (exception instanceof PreventedException) {
throw (PreventedException) exception;
} else if (exception instanceof RuntimeException) {
throw (RuntimeException) exception;
} else if (exception != null) {
logger.debug("Cannot throw checked exception {} since it is not declared by method signature.", exception);
}
if (StringUtils.hasText(username) && StringUtils.hasText(password) && username.equals(password)) {
logger.debug("User [{}] was successfully authenticated.", username);
return new DefaultHandlerResult(this, new BasicCredentialMetaData(credential),
this.principalFactory.createPrincipal(username));
}
logger.debug("User [{}] failed authentication", username);
throw new FailedLoginException();
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:28,代码来源:SimpleTestUsernamePasswordAuthenticationHandler.java
示例7: authenticateUsernamePasswordInternal
import org.jasig.cas.authentication.UsernamePasswordCredential; //导入方法依赖的package包/类
/**
* {@inheritDoc}
* Attempts to authenticate the received credentials using the Yubico cloud validation platform.
* In this implementation, the {@link UsernamePasswordCredential#getUsername()}
* is mapped to the {@code uid} which will be used by the plugged-in instance of the
* {@link YubiKeyAccountRegistry}
* and the {@link UsernamePasswordCredential#getPassword()} is the received
* one-time password token issued by the YubiKey device.
*/
@Override
protected HandlerResult authenticateUsernamePasswordInternal(final UsernamePasswordCredential transformedCredential)
throws GeneralSecurityException, PreventedException {
final String uid = transformedCredential.getUsername();
final String otp = transformedCredential.getPassword();
if (!YubicoClient.isValidOTPFormat(otp)) {
logger.debug("Invalid OTP format [{}]", otp);
throw new FailedLoginException("OTP format is invalid");
}
final String publicId = YubicoClient.getPublicId(otp);
if (this.registry != null
&&!this.registry.isYubiKeyRegisteredFor(uid, publicId)) {
logger.debug("YubiKey public id [{}] is not registered for user [{}]", publicId, uid);
throw new AccountNotFoundException("YubiKey id is not recognized in registry");
}
try {
final VerificationResponse response = this.client.verify(otp);
final ResponseStatus status = response.getStatus();
if (status.compareTo(ResponseStatus.OK) == 0) {
logger.debug("YubiKey response status {} at {}", status, response.getTimestamp());
return createHandlerResult(transformedCredential,
this.principalFactory.createPrincipal(uid), null);
}
throw new FailedLoginException("Authentication failed with status: " + status);
} catch (final YubicoVerificationException | YubicoValidationFailure e) {
logger.error(e.getMessage(), e);
throw new FailedLoginException("YubiKey validation failed: " + e.getMessage());
}
}
示例8: authenticateUsernamePasswordInternal
import org.jasig.cas.authentication.UsernamePasswordCredential; //导入方法依赖的package包/类
/**
* 认证用户名和密码是否正确
* @see UsernamePasswordCredential参数包含了前台页面输入的用户信息
*/
@Override
protected HandlerResult authenticateUsernamePasswordInternal(UsernamePasswordCredential transformedCredential) throws GeneralSecurityException, PreventedException {
String username = transformedCredential.getUsername();
String password = transformedCredential.getPassword();
if(userDaoJdbc.verifyAccount(username, password)){
return createHandlerResult(transformedCredential, new SimplePrincipal(username), null);
}
throw new FailedLoginException();
}