Package org.springframework.security.core.token

Examples of org.springframework.security.core.token.DefaultToken


    public void testEquality() {
        String key = "key";
        long created = new Date().getTime();
        String extendedInformation = "extended";

        DefaultToken t1 = new DefaultToken(key, created, extendedInformation);
        DefaultToken t2 = new DefaultToken(key, created, extendedInformation);
        Assert.assertEquals(t1, t2);
    }
View Full Code Here


    @Test(expected=IllegalArgumentException.class)
    public void testRejectsNullExtendedInformation() {
        String key = "key";
        long created = new Date().getTime();
        new DefaultToken(key, created, null);
    }
View Full Code Here

    @Test
    public void testEqualityWithDifferentExtendedInformation3() {
        String key = "key";
        long created = new Date().getTime();

        DefaultToken t1 = new DefaultToken(key, created, "length1");
        DefaultToken t2 = new DefaultToken(key, created, "longerLength2");
        Assert.assertFalse(t1.equals(t2));
    }
View Full Code Here

    }

    @Test(expected=IllegalArgumentException.class)
    public void testOperationWithMissingKey() {
        KeyBasedPersistenceTokenService service = getService();
        Token token = new DefaultToken("", new Date().getTime(), "");
        service.verifyToken(token.getKey());
    }
View Full Code Here

    @Test(expected=IllegalArgumentException.class)
    public void testOperationWithTamperedKey() {
        KeyBasedPersistenceTokenService service = getService();
        Token goodToken = service.allocateToken("");
        String fake = goodToken.getKey().toUpperCase();
        Token token = new DefaultToken(fake, new Date().getTime(), "");
        service.verifyToken(token.getKey());
    }
View Full Code Here

TOP

Related Classes of org.springframework.security.core.token.DefaultToken

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.