@Test public void shouldNotAuthenticateUser_noUser() throws Exception { JsonObject credentials = new JsonObject(); credentials.put("username", "my-user-id"); credentials.put("password", "my-user-password"); credentials.put("provider", "idp"); Client client = new Client(); when(authenticationProvider.loadUserByUsername(any(EndUserAuthentication.class))).thenReturn(Maybe.empty()); when(routingContext.get("client")).thenReturn(client); when(routingContext.get("provider")).thenReturn(authenticationProvider); when(routingContext.request()).thenReturn(httpServerRequest); when(httpServerRequest.method()).thenReturn(HttpMethod.POST); CountDownLatch latch = new CountDownLatch(1); authProvider.authenticate(routingContext, credentials, userAsyncResult -> { latch.countDown(); Assert.assertNotNull(userAsyncResult); Assert.assertTrue(userAsyncResult.failed()); Assert.assertTrue(userAsyncResult.cause() instanceof BadCredentialsException); }); assertTrue(latch.await(10, TimeUnit.SECONDS)); verify(userAuthenticationManager, never()).connect(any()); }
@Override public void authenticate(JsonObject authInfo, Handler<AsyncResult<User>> resultHandler) { authenticate(null, authInfo, resultHandler); }
SocialAuthenticationProvider implements UserAuthProvider { @Override public void authenticate(JsonObject authInfo, Handler<AsyncResult<User>> resultHandler) { authenticate(null, authInfo, resultHandler); } }
SocialAuthenticationProvider implements UserAuthProvider { @Override public void authenticate(JsonObject authInfo, Handler<AsyncResult<User>> resultHandler) { authenticate(null, authInfo, resultHandler); } SocialAuthenticationProvider();  SocialAuthenticationProvider(UserAuthenticationManager userAuthenticationManager); }
SocialAuthenticationProvider implements UserAuthProvider { @Override public void authenticate(JsonObject authInfo, Handler<AsyncResult<User>> resultHandler) { authenticate(null, authInfo, resultHandler); } SocialAuthenticationProvider();  SocialAuthenticationProvider(UserAuthenticationManager userAuthenticationManager); @Override void authenticate(JsonObject authInfo, Handler<AsyncResult<User>> resultHandler); void authenticate(RoutingContext context, JsonObject authInfo, Handler<AsyncResult<User>> resultHandler); }
SocialAuthenticationProvider implements UserAuthProvider { @Override public void authenticate(JsonObject authInfo, Handler<AsyncResult<User>> resultHandler) { authenticate(null, authInfo, resultHandler); } SocialAuthenticationProvider();  SocialAuthenticationProvider(UserAuthenticationManager userAuthenticationManager); @Override void authenticate(JsonObject authInfo, Handler<AsyncResult<User>> resultHandler); void authenticate(RoutingContext context, JsonObject authInfo, Handler<AsyncResult<User>> resultHandler);  }