org.springframework.security.authentication.AuthenticationServiceException.getMessage()方法的使用及代码示例

x33g5p2x  于11个月前 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(36)

本文整理了Java中org.springframework.security.authentication.AuthenticationServiceException.getMessage()方法的一些代码示例,展示了AuthenticationServiceException.getMessage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AuthenticationServiceException.getMessage()方法的具体详情如下:
包路径:org.springframework.security.authentication.AuthenticationServiceException
类名称:AuthenticationServiceException
方法名:getMessage

AuthenticationServiceException.getMessage介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-security

@Test
public void testDetectsNullBeingReturnedFromAuthenticationDao() {
  UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(
      "rod", "koala");
  DaoAuthenticationProvider provider = createProvider();
  provider.setUserDetailsService(new MockUserDetailsServiceReturnsNull());
  try {
    provider.authenticate(token);
    fail("Should have thrown AuthenticationServiceException");
  }
  catch (AuthenticationServiceException expected) {
    assertThat(
        "UserDetailsService returned null, which is an interface contract violation").isEqualTo(
            expected.getMessage());
  }
}

代码示例来源:origin: spring-projects/spring-security

@Test
public void testAuthenticateError() {
  OpenIDAuthenticationProvider provider = new OpenIDAuthenticationProvider();
  provider.setUserDetailsService(new MockUserDetailsService());
  Authentication preAuth = new OpenIDAuthenticationToken(
      OpenIDAuthenticationStatus.ERROR, USERNAME, "", null);
  assertThat(preAuth.isAuthenticated()).isFalse();
  try {
    provider.authenticate(preAuth);
    fail("Should throw an AuthenticationException");
  }
  catch (AuthenticationServiceException expected) {
    assertThat(expected.getMessage()).isEqualTo("Error message from server: ");
  }
}

代码示例来源:origin: spring-projects/spring-security

@Test
public void testAuthenticateSetupNeeded() {
  OpenIDAuthenticationProvider provider = new OpenIDAuthenticationProvider();
  provider.setUserDetailsService(new MockUserDetailsService());
  Authentication preAuth = new OpenIDAuthenticationToken(
      OpenIDAuthenticationStatus.SETUP_NEEDED, USERNAME, "", null);
  assertThat(preAuth.isAuthenticated()).isFalse();
  try {
    provider.authenticate(preAuth);
    fail("Should throw an AuthenticationException");
  }
  catch (AuthenticationServiceException expected) {
    assertThat(
        "The server responded setup was needed, which shouldn't happen").isEqualTo(
            expected.getMessage());
  }
}

代码示例来源:origin: apache/nifi

throw new AccessDeniedException(upe.getMessage(), upe);
} catch (final AuthenticationServiceException ase) {
  throw new AdministrationException(ase.getMessage(), ase);

相关文章

最新文章

更多