Package org.apache.jackrabbit.oak.spi.security.authentication.token

Examples of org.apache.jackrabbit.oak.spi.security.authentication.token.TokenInfo


        List<Credentials> valid = new ArrayList<Credentials>();
        valid.add(sc);
        valid.add(new ImpersonationCredentials(sc, null));

        for (Credentials creds : valid) {
            TokenInfo info = tokenProvider.createToken(creds);
            assertTokenInfo(info, userId);
        }
    }
View Full Code Here


        }
    }

    @Test
    public void testCreateTokenFromInvalidUserId() throws Exception {
        TokenInfo info = tokenProvider.createToken("unknownUserId", Collections.<String, Object>emptyMap());
        assertNull(info);
    }
View Full Code Here

        assertNull(info);
    }

    @Test
    public void testCreateTokenFromUserId() throws Exception {
        TokenInfo info = tokenProvider.createToken(userId, Collections.<String, Object>emptyMap());
        assertTokenInfo(info, userId);
    }
View Full Code Here

        Map<String, String> attributes = new HashMap<String, String>();
        attributes.putAll(reserved);
        attributes.putAll(publicAttributes);
        attributes.putAll(privateAttributes);

        TokenInfo info = tokenProvider.createToken(userId, attributes);

        Tree userTree = root.getTree(getUserManager().getAuthorizable(userId).getPath());
        Tree tokens = userTree.getChild(".tokens");
        assertTrue(tokens.exists());
        assertEquals(1, tokens.getChildrenCount());
View Full Code Here

        List<String> invalid = new ArrayList<String>();
        invalid.add("/invalid");
        invalid.add(UUID.randomUUID().toString());

        for (String token : invalid) {
            TokenInfo info = tokenProvider.getTokenInfo(token);
            assertNull(info);
        }

        try {
            assertNull(tokenProvider.getTokenInfo("invalidToken"));
View Full Code Here

    }

    @Test
    public void testGetTokenInfo() throws Exception {
        String token = tokenProvider.createToken(userId, Collections.<String, Object>emptyMap()).getToken();
        TokenInfo info = tokenProvider.getTokenInfo(token);
        assertTokenInfo(info, userId);
    }
View Full Code Here

        assertFalse(tokenProvider.removeToken(new InvalidTokenInfo()));
    }

    @Test
    public void testRemoveToken() throws Exception {
        TokenInfo info = tokenProvider.createToken(userId, Collections.<String, Object>emptyMap());
        assertTrue(tokenProvider.removeToken(info));
    }
View Full Code Here

        assertTrue(tokenProvider.removeToken(info));
    }

    @Test
    public void testRemoveToken2() throws Exception {
        TokenInfo info = tokenProvider.createToken(userId, Collections.<String, Object>emptyMap());
        assertTrue(tokenProvider.removeToken(tokenProvider.getTokenInfo(info.getToken())));
    }
View Full Code Here

        assertTrue(tokenProvider.removeToken(tokenProvider.getTokenInfo(info.getToken())));
    }

    @Test
    public void testRemoveTokenRemovesNode() throws Exception {
        TokenInfo info = tokenProvider.createToken(userId, Collections.<String, Object>emptyMap());

        Tree userTree = root.getTree(getUserManager().getAuthorizable(userId).getPath());
        Tree tokens = userTree.getChild(".tokens");
        String tokenNodePath = tokens.getChildren().iterator().next().getPath();
View Full Code Here

        assertFalse(tokenProvider.resetTokenExpiration(new InvalidTokenInfo(), new Date().getTime()));
    }

    @Test
    public void testResetTokenExpirationExpiredToken() throws Exception {
        TokenInfo info = tokenProvider.createToken(userId, Collections.<String, Object>emptyMap());

        long expiredTime = new Date().getTime() + 7200001;
        assertTrue(info.isExpired(expiredTime));
        assertFalse(tokenProvider.resetTokenExpiration(info, expiredTime));
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.spi.security.authentication.token.TokenInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.