Package org.acegisecurity.providers

Examples of org.acegisecurity.providers.TestingAuthenticationToken


   *
   * @see org.springframework.test.AbstractTransactionalSpringContextTests#onSetUpBeforeTransaction()
   */
  protected void onSetUpBeforeTransaction() throws Exception {
    SecurityContextHolder.getContext().setAuthentication(
        new TestingAuthenticationToken(new Object(), new Object(), new GrantedAuthority[] {}));

  }
View Full Code Here


    public void testParser39InRoleRule() {

        SecurityContext context = new SecurityContextImpl();
        GrantedAuthority[] roles = new GrantedAuthority[] { new GrantedAuthorityImpl("ADMIN_ROLE"),
                new GrantedAuthorityImpl("USER_ROLE") };
        context.setAuthentication(new TestingAuthenticationToken("username", "username", roles));
        SecurityContextHolder.setContext(context);

        String text = "{firstName: inRole('USER_ROLE') == true : 'Current user must be in USER_ROLE'}";
        assertTrue(validate(new Person(30, "Steven"), text));
    }
View Full Code Here

    @Override
    protected void setUp() throws Exception {
        super.setUp();

        rwUser = new TestingAuthenticationToken("rw", "supersecret", new XACMLRole[] {
                new XACMLRole("READER"), new XACMLRole("WRITER") });
        roUser = new TestingAuthenticationToken("ro", "supersecret",
                new XACMLRole[] { new XACMLRole("READER") });
        anonymous = new TestingAuthenticationToken("anonymous", "",
                new XACMLRole[] { new XACMLRole(XACMLConstants.AnonymousRole) });
        milUser = new TestingAuthenticationToken("military", "supersecret",
                new XACMLRole[] { new XACMLRole("MILITARY") });
        root = new TestingAuthenticationToken("admin", "geoserver",
                new XACMLRole[] { new XACMLRole(XACMLConstants.AdminRole) });

    }
View Full Code Here

        poly.setUserData("EPSG:4326");
        readerDetails.setGeometryRestriction(poly);

        GeoXACMLConfig.getXACMLRoleAuthority().transformUserDetails(readerDetails);

        Authentication reader = new TestingAuthenticationToken(readerDetails, "pwreader",
                readerDetails.getAuthorities());
        SecurityContextHolder.getContext().setAuthentication(reader);
        // ///////
        GeoXACMLConfig.getXACMLRoleAuthority().prepareRoles(reader);

        // //////
        XACMLRole readerRole = (XACMLRole) reader.getAuthorities()[0];

        RequestCtx request = GeoXACMLConfig.getRequestCtxBuilderFactory()
                .getResourceInfoRequestCtxBuilder(readerRole, europe, AccessMode.READ)
                .createRequestCtx();
View Full Code Here

    @Override
    protected void setUp() throws Exception {
        super.setUp();

        rwUser = new TestingAuthenticationToken("rw", "supersecret", new XACMLRole[] {
                new XACMLRole("READER"), new XACMLRole("WRITER") });
        roUser = new TestingAuthenticationToken("ro", "supersecret",
                new XACMLRole[] { new XACMLRole("READER") });
        anonymous = new TestingAuthenticationToken("anonymous", "",
                new XACMLRole[] { new XACMLRole(XACMLConstants.AnonymousRole) });
        milUser = new TestingAuthenticationToken("military", "supersecret",
                new XACMLRole[] { new XACMLRole("MILITARY") });
        root = new TestingAuthenticationToken("admin", "geoserver",
                new XACMLRole[] { new XACMLRole(XACMLConstants.AdminRole) });

    }
View Full Code Here

                .bean("authenticationManager");
        List<AuthenticationProvider> list = new ArrayList<AuthenticationProvider>();
        list.add(new TestingAuthenticationProvider());
        providerManager.setProviders(list);

        Authentication admin = new TestingAuthenticationToken("admin", "geoserver",
                new GrantedAuthority[] { new XACMLRole("ROLE_ADMINISTRATOR") });
        // Authentication anonymous = new TestingAuthenticationToken("anonymous", null, null);
        SecurityContextHolder.getContext().setAuthentication(admin);

    }
View Full Code Here

    protected void setUp() throws Exception {

        super.setUp();
        GeoXACMLConfig.setPolicyRepsoitoryBaseDir("src/test/resources/urltest/");
        GeoXACMLConfig.reset();
        anonymous = new TestingAuthenticationToken("anonymous", "passwd",
                new XACMLRole[] { new XACMLRole(XACMLConstants.AnonymousRole) });
        admin = new TestingAuthenticationToken("admin", "passwd", new XACMLRole[] { new XACMLRole(
                XACMLConstants.AdminRole) });
        authenticated = new TestingAuthenticationToken("xy", "passwd",
                new XACMLRole[] { new XACMLRole(XACMLConstants.Authenticated) });
    }
View Full Code Here

    @Override
    protected void setUp() throws Exception {
        super.setUp();
       
        rwUser = new TestingAuthenticationToken("rw", "supersecret", new GrantedAuthority[] {
                new GrantedAuthorityImpl("READER"), new GrantedAuthorityImpl("WRITER") });
        roUser = new TestingAuthenticationToken("ro", "supersecret",
                new GrantedAuthority[] { new GrantedAuthorityImpl("READER") });
        anonymous = new TestingAuthenticationToken("anonymous", null, null);
        milUser = new TestingAuthenticationToken("military", "supersecret",
                new GrantedAuthority[] { new GrantedAuthorityImpl("MILITARY") });
        root = new TestingAuthenticationToken("admin", "geoserver", new GrantedAuthority[] { new GrantedAuthorityImpl(SecureTreeNode.ROOT_ROLE) });

        catalog = createNiceMock(Catalog.class);
        expect(catalog.getWorkspace((String) anyObject())).andReturn(
                createNiceMock(WorkspaceInfo.class)).anyTimes();
        replay(catalog);
View Full Code Here

        catalog = createNiceMock(Catalog.class);
        expect(catalog.getWorkspace((String) anyObject())).andReturn(
                createNiceMock(WorkspaceInfo.class)).anyTimes();
        replay(catalog);

        rwUser = new TestingAuthenticationToken("rw", "supersecret", new GrantedAuthority[] {
                new GrantedAuthorityImpl("READER"), new GrantedAuthorityImpl("WRITER") });
        roUser = new TestingAuthenticationToken("ro", "supersecret",
                new GrantedAuthority[] { new GrantedAuthorityImpl("READER") });
        anonymous = new TestingAuthenticationToken("anonymous", null, null);
        milUser = new TestingAuthenticationToken("military", "supersecret", new GrantedAuthority[] {
                new GrantedAuthorityImpl("MILITARY") });

    }
View Full Code Here

    private TestingAuthenticationToken anonymous;

    @Override
    protected void setUp() throws Exception {
        anonymous = new TestingAuthenticationToken("anonymous", null, null);
    }
View Full Code Here

TOP

Related Classes of org.acegisecurity.providers.TestingAuthenticationToken

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.