Package org.wso2.carbon.user.api

Examples of org.wso2.carbon.user.api.RealmConfiguration


       
        this.addIntialData(ds);
        RealmConfigXMLProcessor builder = new RealmConfigXMLProcessor();
        InputStream inStream = this.getClass().getClassLoader().getResource(
                "jdbc-readonly-test.xml").openStream();
        RealmConfiguration realmConfig = builder.buildRealmConfiguration(inStream);
        inStream.close();
        realm = new DefaultRealm();
        realm.init(realmConfig, ClaimTestUtil.getClaimTestData(), ClaimTestUtil
                .getProfileTestData(), 0);
        assertTrue(realm.getUserStoreManager().isExistingRole("adminx"));
View Full Code Here


    }

    public void testUserBasedAuthorization() throws RegistryException {

        // get the realm config to retrieve admin username, password
        RealmConfiguration realmConfig = ctx.getRealmService().getBootstrapRealmConfiguration();
        UserRegistry adminRegistry = embeddedRegistryService.getUserRegistry(
                realmConfig.getAdminUserName(), realmConfig.getAdminPassword());

        UserRealm adminRealm = adminRegistry.getUserRealm();

        Resource r1 = adminRegistry.newCollection();
View Full Code Here

    public void testRoleBasedAuthorization() throws RegistryException {

        //embeddedRegistryService = new InMemoryEmbeddedRegistryService();
        // get the realm config to retrieve admin username, password
        RealmConfiguration realmConfig = ctx.getRealmService().getBootstrapRealmConfiguration();
        UserRegistry adminRegistry = embeddedRegistryService.getUserRegistry(
                realmConfig.getAdminUserName(), realmConfig.getAdminPassword());
        UserRealm adminRealm = adminRegistry.getUserRealm();

        String r1Content = "R1";
        Resource r1 = adminRegistry.newResource();
        r1.setContent(r1Content.getBytes());
View Full Code Here

        creator.createRegistryDatabase();

        realm = new DefaultRealm();
        InputStream inStream = this.getClass().getClassLoader().getResource(
                JDBCRealmTest.JDBC_TEST_USERMGT_XML).openStream();
        RealmConfiguration realmConfig = TestRealmConfigBuilder
                .buildRealmConfigWithJDBCConnectionUrl(inStream, TEST_URL);
        realm.init(realmConfig, ClaimTestUtil.getClaimTestData(), ClaimTestUtil
                .getProfileTestData(), 0);
        ds.close();
    }
View Full Code Here

        Map<String, Object> properties = new HashMap<String, Object>();
        properties.put(UserCoreConstants.DATA_SOURCE, ds);

        RealmConfigXMLProcessor xmlProcessor = new RealmConfigXMLProcessor();
        InputStream stream = new FileInputStream("target/clear-resources/user-mgt-clear.xml");
        RealmConfiguration configuration = xmlProcessor.buildRealmConfiguration(stream);

        JDBCAuthorizationManager jdbcAuthnManager = new JDBCAuthorizationManager(configuration, properties, null, null, realm, 0);

        String[] roles = jdbcAuthnManager.getAllowedRolesForResource("/permission/admin", "ui.execute");
        assertEquals(roles.length,1);
View Full Code Here

    public void testCommentDelete() throws Exception {

        //embeddedRegistryService = new InMemoryEmbeddedRegistryService();
        // get the realm config to retrieve admin username, password
        RealmConfiguration realmConfig = ctx.getRealmService().getBootstrapRealmConfiguration();
        UserRegistry adminReg = embeddedRegistryService.getUserRegistry(
                realmConfig.getAdminUserName(), realmConfig.getAdminPassword());

        UserRealm adminRealm = adminReg.getUserRealm();
        adminRealm.getUserStoreManager().addRole("rolex", null, null);
        adminRealm.getUserStoreManager()
                .addUser("cu1", "cu1111", new String[]{"rolex"}, null, null);
View Full Code Here

        DatabaseCreator creator = new DatabaseCreator(ds);
        creator.createRegistryDatabase();

        realm = new DefaultRealm();
        InputStream inStream = this.getClass().getClassLoader().getResource(JDBCRealmTest.JDBC_TEST_USERMGT_XML).openStream();
        RealmConfiguration realmConfig = TestRealmConfigBuilder
                .buildRealmConfigWithJDBCConnectionUrl(inStream, TEST_URL);
        realm.init(realmConfig, ClaimTestUtil.getClaimTestData(), ClaimTestUtil
                .getProfileTestData(),0);
    }
View Full Code Here

       
        this.addIntialData(ds);
        RealmConfigXMLProcessor builder = new RealmConfigXMLProcessor();
        InputStream inStream = this.getClass().getClassLoader().getResource(
                "adv-jdbc-readonly-test.xml").openStream();
        RealmConfiguration realmConfig = builder.buildRealmConfiguration(inStream);
        inStream.close();
        realm = new DefaultRealm();
        realm.init(realmConfig, ClaimTestUtil.getClaimTestData(), ClaimTestUtil
                .getProfileTestData(), 0);
        assertTrue(realm.getUserStoreManager().isExistingRole("adminx"));
View Full Code Here

    public static final String JDBC_URL_PROPERTY_NAME = "url";

    public static RealmConfiguration buildRealmConfigWithJDBCConnectionUrl(InputStream inStream,
            String connectionUrl) throws UserStoreException {
        RealmConfigXMLProcessor builder = new RealmConfigXMLProcessor();
        RealmConfiguration realmConfig = builder.buildRealmConfiguration(inStream);
        Map<String, String> map = realmConfig.getRealmProperties();
        map.put(JDBC_URL_PROPERTY_NAME, connectionUrl);
        return realmConfig;
    }
View Full Code Here

        realm = new DefaultRealm();

        InputStream inStream = this.getClass().getClassLoader().getResource(
                JDBCRealmTest.JDBC_TEST_USERMGT_XML).openStream();
        RealmConfiguration realmConfig = TestRealmConfigBuilder
                .buildRealmConfigWithJDBCConnectionUrl(inStream, TEST_URL);
        realm.init(realmConfig, ClaimTestUtil.getClaimTestData(), ClaimTestUtil
                .getProfileTestData(), 0);
    }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.user.api.RealmConfiguration

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.