@Test public void testGetTokenInfoFromInvalidLocation2() throws Exception { TokenInfo info = createTokenInfo(tokenProvider, userId); assertNotNull(tokenProvider.getTokenInfo(info.getToken())); Tree userTree = getUserTree(userId); Tree node = TreeUtil.addChild(userTree, "testNode", JcrConstants.NT_UNSTRUCTURED); try { replaceTokenTree(info, node, TOKEN_NT_NAME); assertNull(tokenProvider.getTokenInfo(info.getToken())); } finally { root.refresh(); } }
@Nullable @Override public TokenInfo getTokenInfo(@NotNull String token) { int pos = token.indexOf(DELIM); String nodeId = (pos == -1) ? token : token.substring(0, pos); Tree tokenTree = identifierManager.getTree(nodeId); if (isValidTokenTree(tokenTree)) { try { User user = getUser(tokenTree); if (user != null) { return new TokenInfoImpl(tokenTree, token, user.getID(), user.getPrincipal()); } } catch (RepositoryException e) { log.debug("Cannot determine userID/principal from token: {}", e.getMessage()); } } return null; }
TokenProviderImpl implements TokenProvider, TokenConstants { @Nullable @Override public TokenInfo getTokenInfo(@NotNull String token) { int pos = token.indexOf(DELIM); String nodeId = (pos == -1) ? token : token.substring(0, pos); Tree tokenTree = identifierManager.getTree(nodeId); if (isValidTokenTree(tokenTree)) { try { User user = getUser(tokenTree); if (user != null) { return new TokenInfoImpl(tokenTree, token, user.getID(), user.getPrincipal()); } } catch (RepositoryException e) { log.debug("Cannot determine userID/principal from token: {}", e.getMessage()); } } return null; } }
TokenProviderImpl implements TokenProvider, TokenConstants { @Nullable @Override public TokenInfo getTokenInfo(@NotNull String token) { int pos = token.indexOf(DELIM); String nodeId = (pos == -1) ? token : token.substring(0, pos); Tree tokenTree = identifierManager.getTree(nodeId); if (isValidTokenTree(tokenTree)) { try { User user = getUser(tokenTree); if (user != null) { return new TokenInfoImpl(tokenTree, token, user.getID(), user.getPrincipal()); } } catch (RepositoryException e) { log.debug("Cannot determine userID/principal from token: {}", e.getMessage()); } } return null; } TokenProviderImpl(@NotNull Root root, @NotNull ConfigurationParameters options, @NotNull UserConfiguration userConfiguration);   TokenProviderImpl(@NotNull Root root, @NotNull ConfigurationParameters options, @NotNull UserConfiguration userConfiguration, @NotNull CredentialsSupport credentialsSupport); }
TokenProviderImpl implements TokenProvider, TokenConstants { @Nullable @Override public TokenInfo getTokenInfo(@NotNull String token) { int pos = token.indexOf(DELIM); String nodeId = (pos == -1) ? token : token.substring(0, pos); Tree tokenTree = identifierManager.getTree(nodeId); if (isValidTokenTree(tokenTree)) { try { User user = getUser(tokenTree); if (user != null) { return new TokenInfoImpl(tokenTree, token, user.getID(), user.getPrincipal()); } } catch (RepositoryException e) { log.debug("Cannot determine userID/principal from token: {}", e.getMessage()); } } return null; } TokenProviderImpl(@NotNull Root root, @NotNull ConfigurationParameters options, @NotNull UserConfiguration userConfiguration);   TokenProviderImpl(@NotNull Root root, @NotNull ConfigurationParameters options, @NotNull UserConfiguration userConfiguration, @NotNull CredentialsSupport credentialsSupport); @Override boolean doCreateToken(@NotNull Credentials credentials); @Nullable @Override TokenInfo createToken(@NotNull Credentials credentials); @Nullable @Override TokenInfo createToken(@NotNull String userId, @NotNull Map<String, ?> attributes); @Nullable @Override TokenInfo getTokenInfo(@NotNull String token); }
TokenProviderImpl implements TokenProvider, TokenConstants { @Nullable @Override public TokenInfo getTokenInfo(@NotNull String token) { int pos = token.indexOf(DELIM); String nodeId = (pos == -1) ? token : token.substring(0, pos); Tree tokenTree = identifierManager.getTree(nodeId); if (isValidTokenTree(tokenTree)) { try { User user = getUser(tokenTree); if (user != null) { return new TokenInfoImpl(tokenTree, token, user.getID(), user.getPrincipal()); } } catch (RepositoryException e) { log.debug("Cannot determine userID/principal from token: {}", e.getMessage()); } } return null; } TokenProviderImpl(@NotNull Root root, @NotNull ConfigurationParameters options, @NotNull UserConfiguration userConfiguration);   TokenProviderImpl(@NotNull Root root, @NotNull ConfigurationParameters options, @NotNull UserConfiguration userConfiguration, @NotNull CredentialsSupport credentialsSupport); @Override boolean doCreateToken(@NotNull Credentials credentials); @Nullable @Override TokenInfo createToken(@NotNull Credentials credentials); @Nullable @Override TokenInfo createToken(@NotNull String userId, @NotNull Map<String, ?> attributes); @Nullable @Override TokenInfo getTokenInfo(@NotNull String token);  }