List of usage examples for org.springframework.security.authentication DisabledException DisabledException
public DisabledException(String msg, Throwable t)
DisabledException
with the specified message and root cause. From source file:org.codehaus.groovy.grails.plugins.springsecurity.DefaultPreAuthenticationChecks.java
public void check(UserDetails user) { if (!user.isAccountNonLocked()) { log.debug("User account is locked"); throw new LockedException(messages.getMessage("AbstractUserDetailsAuthenticationProvider.locked", "User account is locked"), user); }/* w w w .jav a2 s . c o m*/ if (!user.isEnabled()) { log.debug("User account is disabled"); throw new DisabledException( messages.getMessage("AbstractUserDetailsAuthenticationProvider.disabled", "User is disabled"), user); } if (!user.isAccountNonExpired()) { log.debug("User account is expired"); throw new AccountExpiredException(messages.getMessage( "AbstractUserDetailsAuthenticationProvider.expired", "User account has expired"), user); } }
From source file:iplatform.admin.ui.server.auth.ad.ActiveDirectoryLdapAuthenticationProvider.java
void raiseExceptionForErrorCode(int code, NamingException exception) { //String hexString = Integer.toHexString(code); //Throwable cause = new ActiveDirectoryAuthenticationException(hexString, exception.getMessage(), exception); Throwable cause = new Exception(exception.getMessage()); switch (code) { case PASSWORD_EXPIRED: throw new CredentialsExpiredException(messages.getMessage( "LdapAuthenticationProvider.credentialsExpired", "User credentials have expired"), cause); case ACCOUNT_DISABLED: throw new DisabledException( messages.getMessage("LdapAuthenticationProvider.disabled", "User is disabled"), cause); case ACCOUNT_EXPIRED: throw new AccountExpiredException( messages.getMessage("LdapAuthenticationProvider.expired", "User account has expired"), cause); case ACCOUNT_LOCKED: throw new LockedException( messages.getMessage("LdapAuthenticationProvider.locked", "User account is locked"), cause); default:/*w w w . ja v a2 s .c om*/ throw badCredentials(cause); } }