本文整理汇总了Java中org.ldaptive.auth.AccountState.Warning方法的典型用法代码示例。如果您正苦于以下问题:Java AccountState.Warning方法的具体用法?Java AccountState.Warning怎么用?Java AccountState.Warning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ldaptive.auth.AccountState
的用法示例。
在下文中一共展示了AccountState.Warning方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleWarning
import org.ldaptive.auth.AccountState; //导入方法依赖的package包/类
@Override
protected void handleWarning(
final AccountState.Warning warning,
final AuthenticationResponse response,
final LdapPasswordPolicyConfiguration configuration,
final List<MessageDescriptor> messages) {
final LdapAttribute attribute = response.getLdapEntry().getAttribute(this.warningAttributeName);
boolean matches = false;
if (attribute != null) {
logger.debug("Found warning attribute {} with value {}", attribute.getName(), attribute.getStringValue());
matches = this.warningAttributeValue.equals(attribute.getStringValue());
}
logger.debug("matches={}, displayWarningOnMatch={}", matches, displayWarningOnMatch);
if (displayWarningOnMatch == matches) {
super.handleWarning(warning, response, configuration, messages);
}
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:19,代码来源:OptionalWarningAccountStateHandler.java
示例2: handleWarning
import org.ldaptive.auth.AccountState; //导入方法依赖的package包/类
@Override
protected void handleWarning(
final AccountState.Warning warning,
final AuthenticationResponse response,
final LdapPasswordPolicyConfiguration configuration,
final List<Message> messages) {
final LdapAttribute attribute = response.getLdapEntry().getAttribute(this.warningAttributeName);
boolean matches = false;
if (attribute != null) {
logger.debug("Found warning attribute {} with value {}", attribute.getName(), attribute.getStringValue());
matches = this.warningAttributeValue.equals(attribute.getStringValue());
}
logger.debug("matches={}, displayWarningOnMatch={}", matches, displayWarningOnMatch);
if (displayWarningOnMatch == matches) {
super.handleWarning(warning, response, configuration, messages);
}
}
示例3: handle
import org.ldaptive.auth.AccountState; //导入方法依赖的package包/类
@Override
public List<Message> handle(final AuthenticationResponse response, final LdapPasswordPolicyConfiguration configuration)
throws LoginException {
final AccountState state = response.getAccountState();
final AccountState.Error error;
final AccountState.Warning warning;
if (state != null) {
error = state.getError();
warning = state.getWarning();
} else {
logger.debug("Account state not defined");
error = null;
warning = null;
}
final List<Message> messages = new ArrayList<Message>();
handleError(error, response, configuration, messages);
handleWarning(warning, response, configuration, messages);
return messages;
}
示例4: handleWarning
import org.ldaptive.auth.AccountState; //导入方法依赖的package包/类
@Override
protected void handleWarning(
final AccountState.Warning warning,
final AuthenticationResponse response,
final LdapPasswordPolicyConfiguration configuration,
final List<MessageDescriptor> messages) {
if (StringUtils.isBlank(this.warningAttributeName)) {
logger.debug("No warning attribute name is defined");
return;
}
if (StringUtils.isBlank(this.warningAttributeValue)) {
logger.debug("No warning attribute value to match is defined");
return;
}
final LdapAttribute attribute = response.getLdapEntry().getAttribute(this.warningAttributeName);
boolean matches = false;
if (attribute != null) {
logger.debug("Found warning attribute {} with value {}", attribute.getName(), attribute.getStringValue());
matches = this.warningAttributeValue.equals(attribute.getStringValue());
}
logger.debug("matches={}, displayWarningOnMatch={}", matches, displayWarningOnMatch);
if (displayWarningOnMatch == matches) {
super.handleWarning(warning, response, configuration, messages);
}
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:30,代码来源:OptionalWarningAccountStateHandler.java
示例5: handleWarning
import org.ldaptive.auth.AccountState; //导入方法依赖的package包/类
/**
* Handle an account state warning produced by ldaptive account state machinery.
* <p>
* Override this method to provide custom warning message handling.
*
* @param warning the account state warning messages.
* @param response Ldaptive authentication response.
* @param configuration Password policy configuration.
* @param messages Container for messages produced by account state warning handling.
*/
protected void handleWarning(
final AccountState.Warning warning,
final AuthenticationResponse response,
final LdapPasswordPolicyConfiguration configuration,
final List<MessageDescriptor> messages) {
logger.debug("Handling warning {}", warning);
if (warning == null) {
logger.debug("Account state warning not defined");
return;
}
final Calendar expDate = warning.getExpiration();
final Days ttl = Days.daysBetween(Instant.now(), new Instant(expDate));
logger.debug(
"Password expires in {} days. Expiration warning threshold is {} days.",
ttl.getDays(),
configuration.getPasswordWarningNumberOfDays());
if (configuration.isAlwaysDisplayPasswordExpirationWarning()
|| ttl.getDays() < configuration.getPasswordWarningNumberOfDays()) {
messages.add(new PasswordExpiringWarningMessageDescriptor(
"Password expires in {0} days. Please change your password at <href=\"{1}\">{1}</a>",
ttl.getDays(),
configuration.getPasswordPolicyUrl()));
}
if (warning.getLoginsRemaining() > 0) {
messages.add(new DefaultMessageDescriptor(
"password.expiration.loginsRemaining",
"You have {0} logins remaining before you MUST change your password.",
warning.getLoginsRemaining()));
}
}
示例6: handleWarning
import org.ldaptive.auth.AccountState; //导入方法依赖的package包/类
@Override
protected void handleWarning(
final AccountState.Warning warning,
final AuthenticationResponse response,
final LdapPasswordPolicyConfiguration configuration,
final List<MessageDescriptor> messages) {
if (StringUtils.isBlank(this.warnAttributeName)) {
LOGGER.debug("No warning attribute name is defined");
return;
}
if (StringUtils.isBlank(this.warningAttributeValue)) {
LOGGER.debug("No warning attribute value to match is defined");
return;
}
final LdapAttribute attribute = response.getLdapEntry().getAttribute(
this.warnAttributeName);
boolean matches = false;
if (attribute != null) {
LOGGER.debug("Found warning attribute [{}] with value [{}]",
attribute.getName(), attribute.getStringValue());
matches = this.warningAttributeValue.equals(attribute.getStringValue());
}
LOGGER.debug("matches=[{}], displayWarningOnMatch=[{}]", matches,
this.displayWarningOnMatch);
if (this.displayWarningOnMatch == matches) {
super.handleWarning(warning, response, configuration, messages);
}
}
示例7: handleWarning
import org.ldaptive.auth.AccountState; //导入方法依赖的package包/类
/**
* Handle an account state warning produced by ldaptive account state machinery.
* <p>
* Override this method to provide custom warning message handling.
*
* @param warning the account state warning messages.
* @param response Ldaptive authentication response.
* @param configuration Password policy configuration.
* @param messages Container for messages produced by account state warning handling.
*/
protected void handleWarning(
final AccountState.Warning warning,
final AuthenticationResponse response,
final LdapPasswordPolicyConfiguration configuration,
final List<MessageDescriptor> messages) {
LOGGER.debug("Handling warning [{}]", warning);
if (warning == null) {
LOGGER.debug("Account state warning not defined");
return;
}
final ZonedDateTime expDate = DateTimeUtils.zonedDateTimeOf(warning.getExpiration());
final long ttl = ZonedDateTime.now(ZoneOffset.UTC).until(expDate, ChronoUnit.DAYS);
LOGGER.debug(
"Password expires in [{}] days. Expiration warning threshold is [{}] days.",
ttl,
configuration.getPasswordWarningNumberOfDays());
if (configuration.isAlwaysDisplayPasswordExpirationWarning() || ttl < configuration.getPasswordWarningNumberOfDays()) {
messages.add(new PasswordExpiringWarningMessageDescriptor("Password expires in {0} days.", ttl));
}
if (warning.getLoginsRemaining() > 0) {
messages.add(new DefaultMessageDescriptor(
"password.expiration.loginsRemaining",
"You have {0} logins remaining before you MUST change your password.",
warning.getLoginsRemaining()));
}
}
示例8: handleWarning
import org.ldaptive.auth.AccountState; //导入方法依赖的package包/类
/**
* Handle an account state warning produced by ldaptive account state machinery.
* <p>
* Override this method to provide custom warning message handling.
*
* @param error Account state warning.
* @param response Ldaptive authentication response.
* @param configuration Password policy configuration.
* @param messages Container for messages produced by account state warning handling.
*/
protected void handleWarning(
final AccountState.Warning warning,
final AuthenticationResponse response,
final LdapPasswordPolicyConfiguration configuration,
final List<Message> messages) {
if (warning == null) {
logger.debug("Account state warning not defined");
return;
}
final Calendar expDate = warning.getExpiration();
final Days ttl = Days.daysBetween(Instant.now(), new Instant(expDate));
logger.debug(
"Password expires in {} days. Expiration warning threshold is {} days.",
ttl.getDays(),
configuration.getPasswordWarningNumberOfDays());
if (configuration.isAlwaysDisplayPasswordExpirationWarning()
|| ttl.getDays() < configuration.getPasswordWarningNumberOfDays()) {
messages.add(new PasswordExpiringWarningMessage(
"Password expires in {0} days. Please change your password at <href=\"{1}\">{1}</a>",
ttl.getDays(),
configuration.getPasswordPolicyUrl()));
}
if (warning.getLoginsRemaining() > 0) {
messages.add(new Message(
"password.expiration.loginsRemaining",
"You have {0} logins remaining before you MUST change your password.",
warning.getLoginsRemaining()));
}
}