Examples of addAuthority()


Examples of org.apache.rave.portal.model.User.addAuthority()

    @Test
    public void setAuthenticatedUser_validRole() {
        final User authUser = new User(USER_ID);
        final Authority userRole = new Authority();
        userRole.setAuthority("admin");
        authUser.addAuthority(userRole);
        expect(userRepository.get(USER_ID)).andReturn(authUser).anyTimes();
        replay(userRepository);

        service.setAuthenticatedUser(USER_ID);
        assertThat((User) SecurityContextHolder.getContext().getAuthentication().getPrincipal(),
View Full Code Here

Examples of org.apache.rave.portal.model.User.addAuthority()

        assertEquals(authorityName, authority.getAuthority());
        assertTrue(authority.getUsers().isEmpty());

        User newUser = new User();
        newUser.setUsername("adminuser");
        newUser.addAuthority(authority);
        newUser = userRepository.save(newUser);
        assertEquals(authority, newUser.getAuthorities().iterator().next());

        authority = repository.getByAuthority(authorityName);
        assertEquals(1, authority.getUsers().size());
View Full Code Here

Examples of org.apache.rave.portal.model.User.addAuthority()

        Assert.assertNotNull("User is not null", user);
        Assert.assertTrue("User has no authorities", user.getAuthorities().isEmpty());
        assertNull("No authority guest", repository.getByAuthority(authorityName));

        user.addAuthority(authority);
        user = userRepository.save(user);

        assertNull("Persisting a user does not persist an unknown Authority", repository.getByAuthority(authorityName));
        repository.save(authority);
View Full Code Here

Examples of org.apache.rave.portal.model.User.addAuthority()

    @Test
    public void setAuthenticatedUser_validRole() {
        final User authUser = new User(USER_ID);
        final Authority userRole = new Authority();
        userRole.setAuthority("admin");
        authUser.addAuthority(userRole);
        expect(userRepository.get(USER_ID)).andReturn(authUser).anyTimes();
        replay(userRepository);

        service.setAuthenticatedUser(USER_ID);
        assertThat((User) SecurityContextHolder.getContext().getAuthentication().getPrincipal(),
View Full Code Here

Examples of org.apache.rave.portal.model.impl.UserImpl.addAuthority()

        template.setExpired(true);
        template.setLocked(true);
        template.setOpenId("TEST_O");
        template.setForgotPasswordHash("TEST_P");
        template.setForgotPasswordTime(new Date());
        template.addAuthority(new AuthorityImpl(new SimpleGrantedAuthority("HOO")));


        JpaUser jpaTemplate = converter.convert(template);

        assertThat(jpaTemplate, is(not(sameInstance(template))));
View Full Code Here

Examples of org.apache.rave.portal.model.impl.UserImpl.addAuthority()

    @Test
    public void setAuthenticatedUser_validRole() {
        final User authUser = new UserImpl(USER_ID);
        final Authority userRole = new AuthorityImpl();
        userRole.setAuthority("admin");
        authUser.addAuthority(userRole);
        expect(userRepository.get(USER_ID)).andReturn(authUser).anyTimes();
        replay(userRepository);

        service.setAuthenticatedUser(USER_ID);
        assertThat((User) SecurityContextHolder.getContext().getAuthentication().getPrincipal(),
View Full Code Here

Examples of org.apache.rave.portal.model.impl.UserImpl.addAuthority()

        template.setExpired(true);
        template.setLocked(true);
        template.setOpenId("TEST_O");
        template.setForgotPasswordHash("TEST_P");
        template.setForgotPasswordTime(new Date());
        template.addAuthority(new AuthorityImpl(new SimpleGrantedAuthority("HOO")));


        JpaUser jpaTemplate = converter.convert(template);

        assertThat(jpaTemplate, is(not(sameInstance(template))));
View Full Code Here

Examples of org.apache.rave.portal.model.impl.UserImpl.addAuthority()

    @Test
    public void setAuthenticatedUser_validRole() {
        final User authUser = new UserImpl(USER_ID);
        final Authority userRole = new AuthorityImpl();
        userRole.setAuthority("admin");
        authUser.addAuthority(userRole);
        expect(userRepository.get(USER_ID)).andReturn(authUser).anyTimes();
        replay(userRepository);

        service.setAuthenticatedUser(USER_ID);
        assertThat((User) SecurityContextHolder.getContext().getAuthentication().getPrincipal(),
View Full Code Here

Examples of org.apache.rave.portal.model.impl.UserImpl.addAuthority()

        template.setExpired(true);
        template.setLocked(true);
        template.setOpenId("TEST_O");
        template.setForgotPasswordHash("TEST_P");
        template.setForgotPasswordTime(new Date());
        template.addAuthority(new AuthorityImpl(new SimpleGrantedAuthority("HOO")));


        JpaUser jpaTemplate = converter.convert(template);

        assertThat(jpaTemplate, is(not(sameInstance(template))));
View Full Code Here

Examples of org.apache.rave.portal.model.impl.UserImpl.addAuthority()

    @Test
    public void setAuthenticatedUser_validRole() {
        final User authUser = new UserImpl(USER_ID);
        final Authority userRole = new AuthorityImpl();
        userRole.setAuthority("admin");
        authUser.addAuthority(userRole);
        expect(userRepository.get(USER_ID)).andReturn(authUser).anyTimes();
        replay(userRepository);

        service.setAuthenticatedUser(USER_ID);
        assertThat((User) SecurityContextHolder.getContext().getAuthentication().getPrincipal(),
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.