Tabnine Logo
OpenIDAuthenticationToken.getStatus
Code IndexAdd Tabnine to your IDE (free)

How to use
getStatus
method
in
org.springframework.security.openid.OpenIDAuthenticationToken

Best Java code snippets using org.springframework.security.openid.OpenIDAuthenticationToken.getStatus (Showing top 7 results out of 315)

origin: spring-projects/spring-security

@Test
public void testAuthenticateSuccess() {
  OpenIDAuthenticationProvider provider = new OpenIDAuthenticationProvider();
  provider.setUserDetailsService(new MockUserDetailsService());
  Authentication preAuth = new OpenIDAuthenticationToken(
      OpenIDAuthenticationStatus.SUCCESS, USERNAME, "", null);
  assertThat(preAuth.isAuthenticated()).isFalse();
  Authentication postAuth = provider.authenticate(preAuth);
  assertThat(postAuth).isNotNull();
  assertThat(postAuth instanceof OpenIDAuthenticationToken).isTrue();
  assertThat(postAuth.isAuthenticated()).isTrue();
  assertThat(postAuth.getPrincipal()).isNotNull();
  assertThat(postAuth.getPrincipal() instanceof UserDetails).isTrue();
  assertThat(postAuth.getAuthorities()).isNotNull();
  assertThat(postAuth.getAuthorities().size() > 0).isTrue();
  assertThat(
      ((OpenIDAuthenticationToken) postAuth).getStatus() == OpenIDAuthenticationStatus.SUCCESS).isTrue();
  assertThat(((OpenIDAuthenticationToken) postAuth).getMessage() == null).isTrue();
}
origin: spring-projects/spring-security

@Test
public void failedVerificationReturnsFailedAuthenticationStatus() throws Exception {
  ConsumerManager mgr = mock(ConsumerManager.class);
  OpenID4JavaConsumer consumer = new OpenID4JavaConsumer(mgr,
      new NullAxFetchListFactory());
  VerificationResult vr = mock(VerificationResult.class);
  DiscoveryInformation di = mock(DiscoveryInformation.class);
  when(
      mgr.verify(any(), any(ParameterList.class),
          any(DiscoveryInformation.class))).thenReturn(vr);
  MockHttpServletRequest request = new MockHttpServletRequest();
  request.getSession().setAttribute(DiscoveryInformation.class.getName(), di);
  OpenIDAuthenticationToken auth = consumer.endConsumption(request);
  assertThat(auth.getStatus()).isEqualTo(OpenIDAuthenticationStatus.FAILURE);
}
origin: spring-projects/spring-security

@SuppressWarnings("serial")
@Test
public void successfulVerificationReturnsExpectedAuthentication() throws Exception {
  ConsumerManager mgr = mock(ConsumerManager.class);
  OpenID4JavaConsumer consumer = new OpenID4JavaConsumer(mgr,
      new NullAxFetchListFactory());
  VerificationResult vr = mock(VerificationResult.class);
  DiscoveryInformation di = mock(DiscoveryInformation.class);
  Identifier id = new Identifier() {
    public String getIdentifier() {
      return "id";
    }
  };
  Message msg = mock(Message.class);
  when(
      mgr.verify(any(), any(ParameterList.class),
          any(DiscoveryInformation.class))).thenReturn(vr);
  when(vr.getVerifiedId()).thenReturn(id);
  when(vr.getAuthResponse()).thenReturn(msg);
  MockHttpServletRequest request = new MockHttpServletRequest();
  request.getSession().setAttribute(DiscoveryInformation.class.getName(), di);
  request.getSession().setAttribute(
      "SPRING_SECURITY_OPEN_ID_ATTRIBUTES_FETCH_LIST", attributes);
  OpenIDAuthenticationToken auth = consumer.endConsumption(request);
  assertThat(auth.getStatus()).isEqualTo(OpenIDAuthenticationStatus.SUCCESS);
}
origin: spring-projects/spring-security

OpenIDAuthenticationStatus status = response.getStatus();
origin: org.apache.rave/rave-web

@Override
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException {
  if(exception instanceof UsernameNotFoundException
    && exception.getAuthentication() instanceof OpenIDAuthenticationToken
    && ((OpenIDAuthenticationToken)exception.getAuthentication()).getStatus().equals(OpenIDAuthenticationStatus.SUCCESS)) {
    
    OpenIDAuthenticationToken token = (OpenIDAuthenticationToken)exception.getAuthentication();
    String url = token.getIdentityUrl();
    User user = createTemporaryUser(token, url);
    request.getSession(true).setAttribute(ModelKeys.NEW_USER, user);
    DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
    log.info("Redirecting to new user account creation page");
    super.setRedirectStrategy(redirectStrategy);
    redirectStrategy.sendRedirect(request, response, "/"+ViewNames.CREATE_ACCOUNT_PAGE);
    return;
  } else {
    super.onAuthenticationFailure(request, response, exception);
  }
}
origin: org.springframework.security/spring-security-openid

OpenIDAuthenticationStatus status = response.getStatus();
origin: pebbleblog/pebble

if (token.getStatus() == OpenIDAuthenticationStatus.SUCCESS) {
org.springframework.security.openidOpenIDAuthenticationTokengetStatus

Popular methods of OpenIDAuthenticationToken

  • getAttributes
  • getIdentityUrl
  • <init>
  • getMessage
  • setAuthenticated
  • setDetails
  • getAuthorities
  • getName
  • getPrincipal
    Returns the principal value.

Popular in Java

  • Making http post requests using okhttp
  • setScale (BigDecimal)
  • addToBackStack (FragmentTransaction)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now