Package org.springframework.security.core.authority

Examples of org.springframework.security.core.authority.SimpleGrantedAuthority


        personProfileSubPage.setOwnerId(user.getId());
        personProfileSubPage.setPageType(PageType.PERSON_PROFILE);
        personProfileSubPage.setParentPage(personProfilePage);

        grantedAuthoritiesList = new ArrayList<GrantedAuthority>();
        grantedAuthoritiesList.add(new SimpleGrantedAuthority("ROLE_USER"));
    }
View Full Code Here


        verify(mockAuthentication);
    }

    @Test
    public void testHasPermission_3args_administer_hasAdminRole() {
        grantedAuthoritiesList.add(new SimpleGrantedAuthority(AuthenticationUtils.ROLE_ADMIN));

        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
        replay(mockAuthentication);
        assertThat(defaultPagePermissionEvaluator.hasPermission(mockAuthentication, page, Permission.ADMINISTER), is(true));
        verify(mockAuthentication);
View Full Code Here

        page.setOwnerId(user.getId());
        widget = new WidgetImpl(VALID_WIDGET_ID);
        widget.setOwnerId(VALID_USER_ID);
        widget.setWidgetStatus(WidgetStatus.PUBLISHED);
        grantedAuthoritiesList = new ArrayList<GrantedAuthority>();
        grantedAuthoritiesList.add(new SimpleGrantedAuthority("ROLE_USER"));
    }
View Full Code Here

        verify(mockAuthentication);
    }

    @Test
    public void testHasPermission_3args_administer_hasAdminRole() {
        grantedAuthoritiesList.add(new SimpleGrantedAuthority(AuthenticationUtils.ROLE_ADMIN));
        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
        replay(mockAuthentication);
        assertThat(defaultWidgetPermissionEvaluator.hasPermission(mockAuthentication, widget, ModelPermissionEvaluator.Permission.ADMINISTER), is(true));
        verify(mockAuthentication);
    }
View Full Code Here

        page.setId(VALID_PAGE_ID);
        page.setOwnerId(user.getId());
        region = new RegionImpl(VALID_REGION_ID);
        region.setPage(page);
        grantedAuthoritiesList = new ArrayList<GrantedAuthority>();
        grantedAuthoritiesList.add(new SimpleGrantedAuthority("ROLE_USER"));
    }
View Full Code Here

        verify(mockAuthentication);
    }

    @Test
    public void testHasPermission_3args_administer_hasAdminRole() {
        grantedAuthoritiesList.add(new SimpleGrantedAuthority(AuthenticationUtils.ROLE_ADMIN));
        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
        replay(mockAuthentication);
        assertThat(defaultRegionPermissionEvaluator.hasPermission(mockAuthentication, region, ModelPermissionEvaluator.Permission.ADMINISTER), is(true));
        verify(mockAuthentication);
    }
View Full Code Here

        region = new RegionImpl(VALID_REGION_ID);
        region.setPage(page);
        regionWidget = new RegionWidgetImpl(VALID_REGION_WIDGET_ID);
        regionWidget.setRegion(region);
        grantedAuthoritiesList = new ArrayList<GrantedAuthority>();
        grantedAuthoritiesList.add(new SimpleGrantedAuthority("ROLE_USER"));
    }
View Full Code Here

        verify(mockAuthentication);
    }

    @Test
    public void testHasPermission_3args_administer_hasAdminRole() {
        grantedAuthoritiesList.add(new SimpleGrantedAuthority(AuthenticationUtils.ROLE_ADMIN));
        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
        replay(mockAuthentication);
        assertThat(defaultRegionWidgetPermissionEvaluator.hasPermission(mockAuthentication, regionWidget, Permission.ADMINISTER), is(true));
        verify(mockAuthentication);
    }
View Full Code Here

        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

        user2.setId(VALID_USER_ID2);
        user2.setUsername(VALID_USERNAME2);

        mockAuthentication = createMock(Authentication.class);
        grantedAuthoritiesList = new ArrayList<GrantedAuthority>();
        grantedAuthoritiesList.add(new SimpleGrantedAuthority("ROLE_USER"));

    }
View Full Code Here

TOP

Related Classes of org.springframework.security.core.authority.SimpleGrantedAuthority

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.