@Test public void testGetTokenInfoFromGroup() throws Exception { Group gr = getUserManager(root).createGroup("gr"); Tree groupNode = root.getTree(gr.getPath()); Tree parent = TreeUtil.addChild(groupNode, TokenConstants.TOKENS_NODE_NAME, TokenConstants.TOKENS_NT_NAME); Tree tokenNode = TreeUtil.addChild(parent, "tokenName", TokenConstants.TOKEN_NT_NAME); String tokenUUID = UUID.randomUUID().toString(); tokenNode.setProperty(JcrConstants.JCR_UUID, tokenUUID); String token = tokenUUID + "_generatedKey"; tokenNode.setProperty(TokenConstants.TOKEN_ATTRIBUTE_KEY, token); assertNull(tokenProvider.getTokenInfo(token)); }
@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);  }