throw new AuthenticationCancelledException("Log in cancelled");
@Test public void testAuthenticateCancel() { OpenIDAuthenticationProvider provider = new OpenIDAuthenticationProvider(); provider.setUserDetailsService(new MockUserDetailsService()); provider.setAuthoritiesMapper(new NullAuthoritiesMapper()); Authentication preAuth = new OpenIDAuthenticationToken( OpenIDAuthenticationStatus.CANCELLED, USERNAME, "", null); assertThat(preAuth.isAuthenticated()).isFalse(); try { provider.authenticate(preAuth); fail("Should throw an AuthenticationException"); } catch (AuthenticationCancelledException expected) { assertThat(expected.getMessage()).isEqualTo("Log in cancelled"); } }
throw new AuthenticationCancelledException("Log in cancelled");