Examples of RealmConfigXMLProcessor


Examples of org.wso2.carbon.user.core.config.RealmConfigXMLProcessor

        ds.setDriverClassName(dbDriver);
        ds.setUsername(dbUsername);
        ds.setPassword(dbPassword);

        try {
            RealmConfiguration realmConfig = new RealmConfigXMLProcessor()
                    .buildRealmConfigurationFromFile();
            UserStoreManager userStore = new JDBCUserStoreManager(ds, realmConfig, 0, true);
            userStore.updateCredentialByAdmin(username, password);
            System.out.println("Password updated successfully.");
        } catch (UserStoreException ex) {
View Full Code Here

Examples of org.wso2.carbon.user.core.config.RealmConfigXMLProcessor

        }

    }

    private RealmConfiguration loadDefaultRealmConfigs() throws UserStoreException {
        RealmConfigXMLProcessor processor = new RealmConfigXMLProcessor();
        RealmConfiguration config = processor.buildRealmConfigurationFromFile();
        return config;
    }
View Full Code Here

Examples of org.wso2.carbon.user.core.config.RealmConfigXMLProcessor

        RealmService realmService = ctx.getRealmService();
        TenantManager tenantManager = realmService.getTenantManager();

        String userMgtXML = getUserManagementConfigurationPath();

        RealmConfigXMLProcessor processor = new RealmConfigXMLProcessor();
        RealmConfiguration realmConfig = processor.buildRealmConfiguration(new FileInputStream(
                userMgtXML));

        Tenant tenant = new Tenant();
        tenant.setDomain("wso2.org");
        tenant.setRealmConfig(realmConfig);
View Full Code Here

Examples of org.wso2.carbon.user.core.config.RealmConfigXMLProcessor

        boolean active = result.getBoolean("UM_ACTIVE");
        Date createdDate = new Date(result.getTimestamp(
            "UM_CREATED_DATE").getTime());
        InputStream is = result.getBinaryStream("UM_USER_CONFIG");
                 
          RealmConfigXMLProcessor processor = new RealmConfigXMLProcessor();
          RealmConfiguration realmConfig = processor.buildRealmConfiguration(is);
          realmConfig.setTenantId(id);
         
        tenant = new Tenant();
        tenant.setId(id);
        tenant.setDomain(domain);
View Full Code Here

Examples of org.wso2.carbon.user.core.config.RealmConfigXMLProcessor

    private RealmConfiguration buildBootStrapRealmConfig() throws UserStoreException {
        this.parentElement = getConfigurationElement();
        OMElement realmElement = parentElement.getFirstChildWithName(new QName(
                UserCoreConstants.RealmConfig.LOCAL_NAME_REALM));
        RealmConfigXMLProcessor rmProcessor = new RealmConfigXMLProcessor();
        rmProcessor.setSecretResolver(parentElement);
        return rmProcessor.buildRealmConfiguration(realmElement);
    }
View Full Code Here

Examples of org.wso2.carbon.user.core.config.RealmConfigXMLProcessor

    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

Examples of org.wso2.carbon.user.core.config.RealmConfigXMLProcessor

        creator.createRegistryDatabase();
        tenantMan = new JDBCTenantManager(ds, "super.com");
    }

    public void doTenantStuff() throws Exception{
        RealmConfigXMLProcessor processor = new RealmConfigXMLProcessor();
        RealmConfiguration realmConfig = processor.buildRealmConfiguration(new FileInputStream(CarbonUtils.getUserMgtXMLPath()));
        Tenant[] tarray = TenantTestUtil.createTenant(realmConfig);

        assertEquals(1,tenantMan.addTenant(tarray[0]));
        assertEquals(2,tenantMan.addTenant(tarray[1]));
        assertEquals(3,tenantMan.addTenant(tarray[2]));
View Full Code Here

Examples of org.wso2.carbon.user.core.config.RealmConfigXMLProcessor

        dataSource.setDriverClassName("org.h2.Driver");

        try {
            DatabaseCreator creator = new DatabaseCreator(dataSource);
            creator.createRegistryDatabase();
            RealmConfigXMLProcessor builder = new RealmConfigXMLProcessor();
            InputStream inStream = new FileInputStream(
                    "src/test/resources/user-test/user-mgt-registry-test.xml");
            try {
                bootstrapRealmConfig = builder.buildRealmConfiguration(inStream);
            } finally {
                inStream.close();
            }
        } catch (Exception e) {
            String msg = "Failed to initialize the user manager. " + e.getMessage();
View Full Code Here

Examples of org.wso2.carbon.user.core.config.RealmConfigXMLProcessor

        DatabaseCreator creator = new DatabaseCreator(ds);
        creator.createRegistryDatabase();
       
        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

Examples of org.wso2.carbon.user.core.config.RealmConfigXMLProcessor

    public void doSQLQueryStuff() throws IOException, UserStoreException {

        InputStream inStream = this.getClass().getClassLoader().getResource(JDBCRealmTest.JDBC_TEST_USERMGT_XML).openStream();

        RealmConfigXMLProcessor realmConfigProcessor = new RealmConfigXMLProcessor();
        realmConfig = realmConfigProcessor.buildRealmConfiguration(inStream);

        assertEquals(realmConfig.getUserStoreProperty(JDBCRealmConstants.ADD_ROLE), null);
        assertEquals(realmConfig.getUserStoreProperty(JDBCRealmConstants.SELECT_USER), JDBCRealmConstants.SELECT_USER_SQL);
        realmConfig.setUserStoreProperties(JDBCRealmUtil.getSQL(realmConfig.getUserStoreProperties()));
        assertEquals(realmConfig.getUserStoreProperty(JDBCRealmConstants.ADD_ROLE), JDBCRealmConstants.ADD_ROLE_SQL);
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.