@Test public void testAuthenticate() throws Exception { TokenInfo info = createTokenInfo(tokenProvider, userId); assertTrue(authentication.authenticate(new TokenCredentials(info.getToken()))); }
@Override public boolean authenticate(@Nullable Credentials credentials) throws LoginException { if (credentials instanceof TokenCredentials) { TokenCredentials tc = (TokenCredentials) credentials; if (!validateCredentials(tc)) { throw new LoginException("Invalid token credentials."); } else { return true; } } return false; }
TokenAuthentication implements Authentication { @Override public boolean authenticate(@Nullable Credentials credentials) throws LoginException { if (credentials instanceof TokenCredentials) { TokenCredentials tc = (TokenCredentials) credentials; if (!validateCredentials(tc)) { throw new LoginException("Invalid token credentials."); } else { return true; } } return false; } }
TokenAuthentication implements Authentication { @Override public boolean authenticate(@Nullable Credentials credentials) throws LoginException { if (credentials instanceof TokenCredentials) { TokenCredentials tc = (TokenCredentials) credentials; if (!validateCredentials(tc)) { throw new LoginException("Invalid token credentials."); } else { return true; } } return false; } TokenAuthentication(@NotNull TokenProvider tokenProvider); }
TokenAuthentication implements Authentication { @Override public boolean authenticate(@Nullable Credentials credentials) throws LoginException { if (credentials instanceof TokenCredentials) { TokenCredentials tc = (TokenCredentials) credentials; if (!validateCredentials(tc)) { throw new LoginException("Invalid token credentials."); } else { return true; } } return false; } TokenAuthentication(@NotNull TokenProvider tokenProvider); @Override boolean authenticate(@Nullable Credentials credentials); @Nullable @Override String getUserId(); @Nullable @Override Principal getUserPrincipal(); }
TokenAuthentication implements Authentication { @Override public boolean authenticate(@Nullable Credentials credentials) throws LoginException { if (credentials instanceof TokenCredentials) { TokenCredentials tc = (TokenCredentials) credentials; if (!validateCredentials(tc)) { throw new LoginException("Invalid token credentials."); } else { return true; } } return false; } TokenAuthentication(@NotNull TokenProvider tokenProvider); @Override boolean authenticate(@Nullable Credentials credentials); @Nullable @Override String getUserId(); @Nullable @Override Principal getUserPrincipal();  }