tokenInfo.remove(); return false;
private boolean validateCredentials(TokenCredentials tokenCredentials) { // credentials without userID -> check if attributes provide // sufficient information for successful authentication. String token = tokenCredentials.getToken(); tokenInfo = tokenProvider.getTokenInfo(token); if (tokenInfo == null) { log.debug("No valid TokenInfo for token."); return false; } long loginTime = new Date().getTime(); if (tokenInfo.isExpired(loginTime)) { // token is expired log.debug("Token is expired"); tokenInfo.remove(); return false; } if (tokenInfo.matches(tokenCredentials)) { tokenInfo.resetExpiration(loginTime); return true; } return false; } }
tokenInfo.remove(); return false;
@Test public void testRemoveToken2() throws Exception { TokenInfo info = tokenProvider.createToken(userId, Collections.<String, Object>emptyMap()); assertTrue(info.remove()); }
@Test public void testRemoveToken() throws Exception { TokenInfo info = tokenProvider.createToken(userId, Collections.<String, Object>emptyMap()); assertTrue(info.remove()); }
@Test public void testRemoveToken() throws Exception { TokenInfo readOnlyInfo = readOnlyTp.getTokenInfo(generateToken()); assertFalse(readOnlyInfo.remove()); } }
@Test public void testRemoveTokenRemovesNode() throws Exception { TokenInfo info = tokenProvider.createToken(userId, Collections.<String, Object>emptyMap()); Tree userTree = root.getTree(getUserManager(root).getAuthorizable(userId).getPath()); Tree tokens = userTree.getChild(TOKENS_NODE_NAME); String tokenNodePath = tokens.getChildren().iterator().next().getPath(); info.remove(); assertFalse(root.getTree(tokenNodePath).exists()); }