org.wso2.carbon.integration.common.admin.client.SecurityAdminServiceClient Java Examples

The following examples show how to use org.wso2.carbon.integration.common.admin.client.SecurityAdminServiceClient. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ESBIntegrationTest.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
protected void applySecurity(String serviceName, int policyId, String[] userGroups)
        throws SecurityAdminServiceSecurityConfigExceptionException, RemoteException, InterruptedException {
    SecurityAdminServiceClient securityAdminServiceClient = new SecurityAdminServiceClient(
            contextUrls.getBackEndUrl(), sessionCookie);
    //  if (FrameworkFactory.getFrameworkProperties(ProductConstant.ESB_SERVER_NAME).getEnvironmentSettings().is_runningOnStratos()) {

    //      securityAdminServiceClient.applySecurity(serviceName, policyId + "", userGroups,
    //    new String[]{"service.jks"}, "service.jks");
    //  } else {
    securityAdminServiceClient
            .applySecurity(serviceName, policyId + "", userGroups, new String[] { "wso2carbon.jks" },
                           "wso2carbon.jks");
    //  }
    log.info("Security Scenario " + policyId + " Applied");

    Thread.sleep(1000);

}
 
Example #2
Source File: SecureDataServiceTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
private void secureService(int policyId)
        throws SecurityAdminServiceSecurityConfigExceptionException, RemoteException, InterruptedException,
        XPathExpressionException {
    SecurityAdminServiceClient securityAdminServiceClient = new SecurityAdminServiceClient(
            dssContext.getContextUrls().getBackEndUrl(), sessionCookie);
    if (TestConfigurationProvider.isPlatform()) {
        //todo
        /*securityAdminServiceClient.applySecurity(serviceName, policyId + "", new String[]{"admin"},
                                                 new String[]{userInfo.getDomain().replace('.', '-') + ".jks"},
                                                 userInfo.getDomain().replace('.', '-') + ".jks");*/
    } else {
        securityAdminServiceClient.applySecurity(serviceName, policyId + "", new String[] { "admin" },
                new String[] { "wso2carbon.jks" }, "wso2carbon.jks");
    }
    log.info("Security Scenario " + policyId + " Applied");

    Thread.sleep(1000);

}
 
Example #3
Source File: ESBPOXSecurityWithInvalidGroupTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
private void applySecurity(String scenarioNumber, String serviceName, String userGroup)
        throws Exception {

    securityAdminServiceClient = new SecurityAdminServiceClient
            (contextUrls.getBackEndUrl(), userInfo.getUserName(), userInfo.getPassword());

    String path = TestConfigurationProvider.getKeyStoreLocation();
    String KeyStoreName = path.substring(path.lastIndexOf(File.separator) + 1, path.length());
    if (userGroup != null) {
        USER_GROUP = userGroup;
    }
    securityAdminServiceClient.applySecurity(serviceName, scenarioNumber, new String[]{USER_GROUP},
                                             new String[]{KeyStoreName}, KeyStoreName);
    Thread.sleep(2000);

}
 
Example #4
Source File: ESBPOXSecurityWithInvalidGroupTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
private void applySecurity(String scenarioNumber, String serviceName, String userGroup) throws Exception {

        securityAdminServiceClient = new SecurityAdminServiceClient(contextUrls.getBackEndUrl(), userInfo.getUserName(),
                userInfo.getPassword());

        String path = TestConfigurationProvider.getKeyStoreLocation();
        String KeyStoreName = path.substring(path.lastIndexOf(File.separator) + 1, path.length());
        if (userGroup != null) {
            USER_GROUP = userGroup;
        }
        securityAdminServiceClient
                .applySecurity(serviceName, scenarioNumber, new String[] { USER_GROUP }, new String[] { KeyStoreName },
                        KeyStoreName);
        Thread.sleep(2000);

    }
 
Example #5
Source File: ESBIntegrationTest.java    From product-ei with Apache License 2.0 6 votes vote down vote up
protected void applySecurity(String serviceName, int policyId, String[] userGroups)
		throws SecurityAdminServiceSecurityConfigExceptionException, RemoteException,
		       InterruptedException {
	SecurityAdminServiceClient securityAdminServiceClient = new SecurityAdminServiceClient(contextUrls.getBackEndUrl(), sessionCookie);
	//  if (FrameworkFactory.getFrameworkProperties(ProductConstant.ESB_SERVER_NAME).getEnvironmentSettings().is_runningOnStratos()) {

	//      securityAdminServiceClient.applySecurity(serviceName, policyId + "", userGroups,
	//    new String[]{"service.jks"}, "service.jks");
	//  } else {
	securityAdminServiceClient.applySecurity(serviceName, policyId + "", userGroups,
											 new String[]{"wso2carbon.jks"}, "wso2carbon.jks");
	//  }
	log.info("Security Scenario " + policyId + " Applied");

	Thread.sleep(1000);

}
 
Example #6
Source File: SecureDataServiceTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
private void secureService(int policyId)
        throws SecurityAdminServiceSecurityConfigExceptionException, RemoteException,
               InterruptedException, XPathExpressionException {
    SecurityAdminServiceClient securityAdminServiceClient = new SecurityAdminServiceClient(dssContext.getContextUrls().getBackEndUrl(),sessionCookie);
    if (TestConfigurationProvider.isPlatform()) {
        //todo
        /*securityAdminServiceClient.applySecurity(serviceName, policyId + "", new String[]{"admin"},
                                                 new String[]{userInfo.getDomain().replace('.', '-') + ".jks"},
                                                 userInfo.getDomain().replace('.', '-') + ".jks");*/
    } else {
        securityAdminServiceClient.applySecurity(serviceName, policyId + "", new String[]{"admin"},
                                                 new String[]{"wso2carbon.jks"}, "wso2carbon.jks");
    }
    log.info("Security Scenario " + policyId + " Applied");

    Thread.sleep(1000);

}
 
Example #7
Source File: CARBON15261JsonFormatterTest.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
private void secureService()
        throws SecurityAdminServiceSecurityConfigExceptionException, RemoteException, InterruptedException,
        XPathExpressionException {
    SecurityAdminServiceClient securityAdminServiceClient = new SecurityAdminServiceClient(
            dssContext.getContextUrls().getBackEndUrl(), sessionCookie);
    securityAdminServiceClient.applySecurity(serviceName, Integer.toString(1) + "", new String[] { "admin" },
            new String[] { "wso2carbon.jks" }, "wso2carbon.jks");
    log.info("Security Scenario Applied");
    Thread.sleep(6000);

}
 
Example #8
Source File: ChangingPoliciesTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
private void disableSecurity()
        throws SecurityAdminServiceSecurityConfigExceptionException, RemoteException,
               XPathExpressionException {
    SecurityAdminServiceClient securityAdminServiceClient = new SecurityAdminServiceClient(
            context.getContextUrls().getBackEndUrl(), sessionCookie);
    securityAdminServiceClient.disableSecurity("StockQuoteProxy");
}
 
Example #9
Source File: ESBPOXSecurityByAdminTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
private void applySecurity(String scenarioNumber, String serviceName, String userGroup)
        throws Exception {

    securityAdminServiceClient = new SecurityAdminServiceClient
            (context.getContextUrls().getBackEndUrl(), userInfo.getUserName(), userInfo.getPassword());

    String path = TestConfigurationProvider.getKeyStoreLocation();
    String KeyStoreName = path.substring(path.lastIndexOf(File.separator) + 1, path.length());
    if (userGroup != null) {
        USER_GROUP = userGroup;
    }
    securityAdminServiceClient.applySecurity(serviceName, scenarioNumber, new String[]{USER_GROUP},
                                             new String[]{KeyStoreName}, KeyStoreName);
    Thread.sleep(2000);
}
 
Example #10
Source File: ESBPOXSecurityGetMethodTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
private void applySecurity(String scenarioNumber, String serviceName, String userGroup)
        throws Exception {

    securityAdminServiceClient = new SecurityAdminServiceClient
            (contextUrls.getBackEndUrl(), userInfo.getUserName(), userInfo.getPassword());

    String path = TestConfigurationProvider.getKeyStoreLocation();
    String KeyStoreName = path.substring(path.lastIndexOf(File.separator) + 1, path.length());
    if (userGroup != null) {
        USER_GROUP = userGroup;
    }
    securityAdminServiceClient.applySecurity(serviceName, scenarioNumber, new String[]{USER_GROUP},
                                             new String[]{KeyStoreName}, KeyStoreName);
    Thread.sleep(2000);
}
 
Example #11
Source File: ESBPOXSecurityByUserTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
private void applySecurity(String scenarioNumber, String serviceName, String userGroup)
        throws Exception {

    securityAdminServiceClient = new SecurityAdminServiceClient
            (contextUrls.getBackEndUrl(), userInfo.getUserName(), userInfo.getPassword());

    String path = TestConfigurationProvider.getKeyStoreLocation();
    String KeyStoreName = path.substring(path.lastIndexOf(File.separator) + 1, path.length());
    if (userGroup != null) {
        USER_GROUP = userGroup;
    }
    securityAdminServiceClient.applySecurity(serviceName, scenarioNumber, new String[]{USER_GROUP},
                                             new String[]{KeyStoreName}, KeyStoreName);
    Thread.sleep(2000);
}
 
Example #12
Source File: ESBPOXSecurityPostRequestTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
private void applySecurity(String scenarioNumber, String serviceName, String userGroup)
        throws Exception {

    securityAdminServiceClient = new SecurityAdminServiceClient
            (contextUrls.getBackEndUrl(), userInfo.getUserName(), userInfo.getPassword());

    String path = TestConfigurationProvider.getKeyStoreLocation();
    String KeyStoreName = path.substring(path.lastIndexOf(File.separator) + 1, path.length());
    if (userGroup != null) {
        USER_GROUP = userGroup;
    }
    securityAdminServiceClient.applySecurity(serviceName, scenarioNumber, new String[]{USER_GROUP},
                                             new String[]{KeyStoreName}, KeyStoreName);
    Thread.sleep(2000);
}
 
Example #13
Source File: ESBPOXSecurityByInvalidUserTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
private void applySecurity(String scenarioNumber, String serviceName, String userGroup)
        throws Exception {

    securityAdminServiceClient = new SecurityAdminServiceClient
            (context.getContextUrls().getBackEndUrl(), userInfo.getUserName(), userInfo.getPassword());

    String path = TestConfigurationProvider.getKeyStoreLocation();
    String KeyStoreName = path.substring(path.lastIndexOf(File.separator) + 1, path.length());
    if (userGroup != null) {
        USER_GROUP = userGroup;
    }
    securityAdminServiceClient.applySecurity(serviceName, scenarioNumber, new String[]{USER_GROUP},
                                             new String[]{KeyStoreName}, KeyStoreName);
    Thread.sleep(2000);
}
 
Example #14
Source File: SecureDataServiceSampleTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
private void secureServiceWithUT() throws Exception {
    SecurityAdminServiceClient securityAdminServiceClient = new SecurityAdminServiceClient(dssContext.getContextUrls().getBackEndUrl(), sessionCookie);
    securityAdminServiceClient.applySecurity(serviceName, "1", new String[]{userInfo.getUserName()},
                                                 new String[]{"wso2carbon.jks"}, "wso2carbon.jks");
    log.info("Security Scenario " + "1" + " Applied");
    Thread.sleep(2000);

}
 
Example #15
Source File: CARBON15261JsonFormatterTest.java    From product-ei with Apache License 2.0 5 votes vote down vote up
private void secureService()
        throws SecurityAdminServiceSecurityConfigExceptionException, RemoteException, InterruptedException,
               XPathExpressionException {
    SecurityAdminServiceClient securityAdminServiceClient =
            new SecurityAdminServiceClient(dssContext.getContextUrls().getBackEndUrl(), sessionCookie);
    securityAdminServiceClient.applySecurity(serviceName, Integer.toString(1) + "", new String[] { "admin" },
                                             new String[] { "wso2carbon.jks" }, "wso2carbon.jks");
    log.info("Security Scenario Applied");
    Thread.sleep(6000);

}
 
Example #16
Source File: ESBPOXSecurityByAdminTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
private void applySecurity(String scenarioNumber, String serviceName, String userGroup) throws Exception {

        securityAdminServiceClient = new SecurityAdminServiceClient(context.getContextUrls().getBackEndUrl(),
                userInfo.getUserName(), userInfo.getPassword());

        String path = TestConfigurationProvider.getKeyStoreLocation();
        String KeyStoreName = path.substring(path.lastIndexOf(File.separator) + 1, path.length());
        if (userGroup != null) {
            USER_GROUP = userGroup;
        }
        securityAdminServiceClient
                .applySecurity(serviceName, scenarioNumber, new String[] { USER_GROUP }, new String[] { KeyStoreName },
                        KeyStoreName);
        Thread.sleep(2000);
    }
 
Example #17
Source File: ESBPOXSecurityGetMethodTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
private void applySecurity(String scenarioNumber, String serviceName, String userGroup) throws Exception {

        securityAdminServiceClient = new SecurityAdminServiceClient(contextUrls.getBackEndUrl(), userInfo.getUserName(),
                userInfo.getPassword());

        String path = TestConfigurationProvider.getKeyStoreLocation();
        String KeyStoreName = path.substring(path.lastIndexOf(File.separator) + 1, path.length());
        if (userGroup != null) {
            USER_GROUP = userGroup;
        }
        securityAdminServiceClient
                .applySecurity(serviceName, scenarioNumber, new String[] { USER_GROUP }, new String[] { KeyStoreName },
                        KeyStoreName);
        Thread.sleep(2000);
    }
 
Example #18
Source File: ESBPOXSecurityByUserTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
private void applySecurity(String scenarioNumber, String serviceName, String userGroup) throws Exception {

        securityAdminServiceClient = new SecurityAdminServiceClient(contextUrls.getBackEndUrl(), userInfo.getUserName(),
                userInfo.getPassword());

        String path = TestConfigurationProvider.getKeyStoreLocation();
        String KeyStoreName = path.substring(path.lastIndexOf(File.separator) + 1, path.length());
        if (userGroup != null) {
            USER_GROUP = userGroup;
        }
        securityAdminServiceClient
                .applySecurity(serviceName, scenarioNumber, new String[] { USER_GROUP }, new String[] { KeyStoreName },
                        KeyStoreName);
        Thread.sleep(2000);
    }
 
Example #19
Source File: ESBPOXSecurityPostRequestTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
private void applySecurity(String scenarioNumber, String serviceName, String userGroup) throws Exception {

        securityAdminServiceClient = new SecurityAdminServiceClient(contextUrls.getBackEndUrl(), userInfo.getUserName(),
                userInfo.getPassword());

        String path = TestConfigurationProvider.getKeyStoreLocation();
        String KeyStoreName = path.substring(path.lastIndexOf(File.separator) + 1, path.length());
        if (userGroup != null) {
            USER_GROUP = userGroup;
        }
        securityAdminServiceClient
                .applySecurity(serviceName, scenarioNumber, new String[] { USER_GROUP }, new String[] { KeyStoreName },
                        KeyStoreName);
        Thread.sleep(2000);
    }
 
Example #20
Source File: ESBPOXSecurityByInvalidUserTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
private void applySecurity(String scenarioNumber, String serviceName, String userGroup) throws Exception {

        securityAdminServiceClient = new SecurityAdminServiceClient(context.getContextUrls().getBackEndUrl(),
                userInfo.getUserName(), userInfo.getPassword());

        String path = TestConfigurationProvider.getKeyStoreLocation();
        String KeyStoreName = path.substring(path.lastIndexOf(File.separator) + 1, path.length());
        if (userGroup != null) {
            USER_GROUP = userGroup;
        }
        securityAdminServiceClient
                .applySecurity(serviceName, scenarioNumber, new String[] { USER_GROUP }, new String[] { KeyStoreName },
                        KeyStoreName);
        Thread.sleep(2000);
    }
 
Example #21
Source File: SecureDataServiceSampleTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
private void secureServiceWithUT() throws Exception {
    SecurityAdminServiceClient securityAdminServiceClient = new SecurityAdminServiceClient(
            dssContext.getContextUrls().getBackEndUrl(), sessionCookie);
    securityAdminServiceClient.applySecurity(serviceName, "1", new String[] { userInfo.getUserName() },
            new String[] { "wso2carbon.jks" }, "wso2carbon.jks");
    log.info("Security Scenario " + "1" + " Applied");
    Thread.sleep(2000);

}
 
Example #22
Source File: SecuredProxySecuredBackEndTestCase.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
private void disableSecurity() throws SecurityAdminServiceSecurityConfigExceptionException, RemoteException {
    SecurityAdminServiceClient securityAdminServiceClient = new SecurityAdminServiceClient(
            contextUrls.getBackEndUrl(), sessionCookie);
    securityAdminServiceClient.disableSecurity("StockQuoteProxy");
}
 
Example #23
Source File: ChangingPoliciesTestCase.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
private void disableSecurity()
        throws SecurityAdminServiceSecurityConfigExceptionException, RemoteException, XPathExpressionException {
    SecurityAdminServiceClient securityAdminServiceClient = new SecurityAdminServiceClient(
            context.getContextUrls().getBackEndUrl(), sessionCookie);
    securityAdminServiceClient.disableSecurity("StockQuoteProxy");
}
 
Example #24
Source File: SecuredProxySecuredBackEndTestCase.java    From product-ei with Apache License 2.0 4 votes vote down vote up
private void disableSecurity()
        throws SecurityAdminServiceSecurityConfigExceptionException, RemoteException {
    SecurityAdminServiceClient securityAdminServiceClient = new SecurityAdminServiceClient(contextUrls.getBackEndUrl(), sessionCookie);
    securityAdminServiceClient.disableSecurity("StockQuoteProxy");
}