Example usage for org.springframework.security.core AuthenticationException AuthenticationException

List of usage examples for org.springframework.security.core AuthenticationException AuthenticationException

Introduction

In this page you can find the example usage for org.springframework.security.core AuthenticationException AuthenticationException.

Prototype

public AuthenticationException(String msg, Throwable t) 

Source Link

Document

Constructs an AuthenticationException with the specified message and root cause.

Usage

From source file:com.katsu.springframework.security.authentication.HtmlAuthenticationProvider.java

@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
    AbstractAuthenticationToken upat = (AbstractAuthenticationToken) authentication;
    if (!upat.isAuthenticated()) {
        try {/*  ww  w  .  j  a v a2s .  c  o  m*/
            Collection<? extends GrantedAuthority> roles = doLogin(upat);
            if (roles != null) {
                return createSuccessAuthentication(upat, roles);
            }
        } catch (Exception e) {
            throw new AuthenticationException("Can't authenticate", e) {
            };
        } finally {
        }
    }
    return null;
}