Examples of RememberMeAuthenticationToken


Examples of org.acegisecurity.providers.rememberme.RememberMeAuthenticationToken

            // By this stage we have a valid token
            if (logger.isDebugEnabled()) {
              logger.debug("Remember-me cookie accepted");
            }

            RememberMeAuthenticationToken auth = new RememberMeAuthenticationToken(this.key, userDetails,
                userDetails.getAuthorities());
            auth.setDetails(authenticationDetailsSource.buildDetails((HttpServletRequest) request));

            return auth;
          }
          else {
            cancelCookie(request, response, "Cookie token did not contain 3 tokens; decoded value was '"
View Full Code Here

Examples of org.acegisecurity.providers.rememberme.RememberMeAuthenticationToken

                        // By this stage we have a valid token
                        if (logger.isDebugEnabled()) {
                            logger.debug("Remember-me cookie accepted");
                        }

                        return new RememberMeAuthenticationToken(this.key,
                            userDetails, userDetails.getauthorities());
                    } else {
                        cancelCookie(request, response,
                            "Cookie token did not contain 3 tokens; decoded value was '"
                            + cookieAsPlainText + "'");
View Full Code Here

Examples of org.springframework.security.authentication.RememberMeAuthenticationToken

     *                      stored as the principal.
     *
     * @return the <tt>Authentication</tt> for the remember-me authenticated user
     */
    protected Authentication createSuccessfulAuthentication(HttpServletRequest request, UserDetails user) {
        RememberMeAuthenticationToken auth = new RememberMeAuthenticationToken(key, user,
                authoritiesMapper.mapAuthorities(user.getAuthorities()));
        auth.setDetails(authenticationDetailsSource.buildDetails(request));
        return auth;
    }
View Full Code Here

Examples of org.springframework.security.authentication.RememberMeAuthenticationToken

    //~ Methods ========================================================================================================

    public void testConstructorRejectsNulls() {
        try {
            new RememberMeAuthenticationToken(null, "Test", ROLES_12);
            fail("Should have thrown IllegalArgumentException");
        } catch (IllegalArgumentException expected) {
            assertTrue(true);
        }

        try {
            new RememberMeAuthenticationToken("key", null, ROLES_12);
            fail("Should have thrown IllegalArgumentException");
        } catch (IllegalArgumentException expected) {
            assertTrue(true);
        }

        try {
            List<GrantedAuthority> authsContainingNull = new ArrayList<GrantedAuthority>();
            authsContainingNull.add(null);
            new RememberMeAuthenticationToken("key", "Test", authsContainingNull);
            fail("Should have thrown IllegalArgumentException");
        } catch (IllegalArgumentException expected) {
            assertTrue(true);
        }
    }
View Full Code Here

Examples of org.springframework.security.authentication.RememberMeAuthenticationToken

            assertTrue(true);
        }
    }

    public void testEqualsWhenEqual() {
        RememberMeAuthenticationToken token1 = new RememberMeAuthenticationToken("key", "Test", ROLES_12);
        RememberMeAuthenticationToken token2 = new RememberMeAuthenticationToken("key", "Test", ROLES_12);

        assertEquals(token1, token2);
    }
View Full Code Here

Examples of org.springframework.security.authentication.RememberMeAuthenticationToken

        assertEquals(token1, token2);
    }

    public void testGetters() {
        RememberMeAuthenticationToken token = new RememberMeAuthenticationToken("key", "Test",
                ROLES_12);

        assertEquals("key".hashCode(), token.getKeyHash());
        assertEquals("Test", token.getPrincipal());
        assertEquals("", token.getCredentials());
        assertTrue(AuthorityUtils.authorityListToSet(token.getAuthorities()).contains("ROLE_ONE"));
        assertTrue(AuthorityUtils.authorityListToSet(token.getAuthorities()).contains("ROLE_TWO"));
        assertTrue(token.isAuthenticated());
    }
View Full Code Here

Examples of org.springframework.security.authentication.RememberMeAuthenticationToken

        assertTrue(AuthorityUtils.authorityListToSet(token.getAuthorities()).contains("ROLE_TWO"));
        assertTrue(token.isAuthenticated());
    }

    public void testNotEqualsDueToAbstractParentEqualsCheck() {
        RememberMeAuthenticationToken token1 = new RememberMeAuthenticationToken("key", "Test",ROLES_12);
        RememberMeAuthenticationToken token2 = new RememberMeAuthenticationToken("key", "DIFFERENT_PRINCIPAL",ROLES_12);

        assertFalse(token1.equals(token2));
    }
View Full Code Here

Examples of org.springframework.security.authentication.RememberMeAuthenticationToken

        assertFalse(token1.equals(token2));
    }

    public void testNotEqualsDueToDifferentAuthenticationClass() {
        RememberMeAuthenticationToken token1 = new RememberMeAuthenticationToken("key", "Test", ROLES_12);
        UsernamePasswordAuthenticationToken token2 = new UsernamePasswordAuthenticationToken("Test", "Password",ROLES_12);

        assertFalse(token1.equals(token2));
    }
View Full Code Here

Examples of org.springframework.security.authentication.RememberMeAuthenticationToken

        assertFalse(token1.equals(token2));
    }

    public void testNotEqualsDueToKey() {
        RememberMeAuthenticationToken token1 = new RememberMeAuthenticationToken("key", "Test", ROLES_12);
        RememberMeAuthenticationToken token2 = new RememberMeAuthenticationToken("DIFFERENT_KEY", "Test", ROLES_12);

        assertFalse(token1.equals(token2));
    }
View Full Code Here

Examples of org.springframework.security.authentication.RememberMeAuthenticationToken

        assertFalse(token1.equals(token2));
    }

    public void testSetAuthenticatedIgnored() {
        RememberMeAuthenticationToken token = new RememberMeAuthenticationToken("key", "Test", ROLES_12);
        assertTrue(token.isAuthenticated());
        token.setAuthenticated(false);
        assertTrue(!token.isAuthenticated());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.