Java Code Examples for org.springframework.security.core.userdetails.UserDetails#isAccountNonExpired()

The following examples show how to use org.springframework.security.core.userdetails.UserDetails#isAccountNonExpired() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OpenIdAuthenticationProvider.java    From cola with MIT License 7 votes vote down vote up
@Override
public void check(UserDetails user) {
	if (!user.isAccountNonLocked()) {
		logger.debug("User account is locked");

		throw new LockedException(messages.getMessage(
				"AbstractUserDetailsAuthenticationProvider.locked",
				"User account is locked"));
	}

	if (!user.isEnabled()) {
		logger.debug("User account is disabled");

		throw new DisabledException(messages.getMessage(
				"AbstractUserDetailsAuthenticationProvider.disabled",
				"User is disabled"));
	}

	if (!user.isAccountNonExpired()) {
		logger.debug("User account is expired");

		throw new AccountExpiredException(messages.getMessage(
				"AbstractUserDetailsAuthenticationProvider.expired",
				"User account has expired"));
	}
}
 
Example 2
Source File: SmsAuthenticationProvider.java    From cola with MIT License 6 votes vote down vote up
@Override
public void check(UserDetails user) {
	if (!user.isAccountNonLocked()) {
		logger.debug("User account is locked");

		throw new LockedException(messages.getMessage(
				"AbstractUserDetailsAuthenticationProvider.locked",
				"User account is locked"));
	}

	if (!user.isEnabled()) {
		logger.debug("User account is disabled");

		throw new DisabledException(messages.getMessage(
				"AbstractUserDetailsAuthenticationProvider.disabled",
				"User is disabled"));
	}

	if (!user.isAccountNonExpired()) {
		logger.debug("User account is expired");

		throw new AccountExpiredException(messages.getMessage(
				"AbstractUserDetailsAuthenticationProvider.expired",
				"User account has expired"));
	}
}
 
Example 3
Source File: AcAuthenticationProvider.java    From cola with MIT License 6 votes vote down vote up
@Override
public void check(UserDetails user) {
	if (!user.isAccountNonLocked()) {
		logger.debug("User account is locked");

		throw new LockedException(messages.getMessage(
				"AbstractUserDetailsAuthenticationProvider.locked",
				"User account is locked"));
	}

	if (!user.isEnabled()) {
		logger.debug("User account is disabled");

		throw new DisabledException(messages.getMessage(
				"AbstractUserDetailsAuthenticationProvider.disabled",
				"User is disabled"));
	}

	if (!user.isAccountNonExpired()) {
		logger.debug("User account is expired");

		throw new AccountExpiredException(messages.getMessage(
				"AbstractUserDetailsAuthenticationProvider.expired",
				"User account has expired"));
	}
}
 
Example 4
Source File: WebAuthnAuthenticationProvider.java    From webauthn4j-spring-security with Apache License 2.0 6 votes vote down vote up
@Override
public void check(UserDetails user) {
    if (!user.isAccountNonLocked()) {
        logger.debug("User account is locked");

        throw new LockedException(messages.getMessage(
                "WebAuthnAuthenticationProvider.locked",
                "User account is locked"));
    }

    if (!user.isEnabled()) {
        logger.debug("User account is disabled");

        throw new DisabledException(messages.getMessage(
                "WebAuthnAuthenticationProvider.disabled",
                "User is disabled"));
    }

    if (!user.isAccountNonExpired()) {
        logger.debug("User account is expired");

        throw new AccountExpiredException(messages.getMessage(
                "WebAuthnAuthenticationProvider.expired",
                "User account has expired"));
    }
}
 
Example 5
Source File: MobileCodeAuthenticationProvider.java    From springcloud-oauth2 with MIT License 5 votes vote down vote up
/**
 * 账号禁用、锁定、超时校验
 *
 * @param user
 */
private void check(UserDetails user) {
    if (!user.isAccountNonLocked()) {
        throw new LockedException(this.messages.getMessage("AbstractUserDetailsAuthenticationProvider.locked", "User account is locked"));
    } else if (!user.isEnabled()) {
        throw new DisabledException(this.messages.getMessage("AbstractUserDetailsAuthenticationProvider.disabled", "User is disabled"));
    } else if (!user.isAccountNonExpired()) {
        throw new AccountExpiredException(this.messages.getMessage("AbstractUserDetailsAuthenticationProvider.expired", "User account has expired"));
    }
}
 
Example 6
Source File: AbstractUserDetailsAuthenticationProvider.java    From Taroco with Apache License 2.0 5 votes vote down vote up
@Override
public void check(UserDetails user) {
    if (!user.isAccountNonLocked()) {
        log.debug("User account is locked");
        throw new LockedException(AbstractUserDetailsAuthenticationProvider.this.messages.getMessage("AbstractUserDetailsAuthenticationProvider.locked", "User account is locked"));
    } else if (!user.isEnabled()) {
        log.debug("User account is disabled");
        throw new DisabledException(AbstractUserDetailsAuthenticationProvider.this.messages.getMessage("AbstractUserDetailsAuthenticationProvider.disabled", "User is disabled"));
    } else if (!user.isAccountNonExpired()) {
        log.debug("User account is expired");
        throw new AccountExpiredException(AbstractUserDetailsAuthenticationProvider.this.messages.getMessage("AbstractUserDetailsAuthenticationProvider.expired", "User account has expired"));
    }
}