0
votes

I am looking for a way to apply Role based security on existing Proxy WSDLs of WSO2 ESB using Java API.

Using org.wso2.carbon.proxyadmin.stub.ProxyServiceAdminStub I could manage to enable security for unsecured proxy service, but unable to find a way to apply Role based security (please note the roles are coming from WSO2 Identity Server). I understand it's possible to perform this action with Wso2 ESB management console, but is there is a way to handle it through Java API? Any carbon backend web service available?

1
While introspecting WSO2 SVN security came across this client, code [SecurityAdminServiceStub][1] May be this is the security management web service of WSO2 that 'am looking for... not sure! [1]: svn.wso2.org/repos/wso2/carbon/platform/trunk/components/… - karun

1 Answers

0
votes

Sample Client here

This helped in disabling and enabling security as well as applying Role based security for a given proxy service. This is what I was looking for. Hope it helps some one out there...

public void applySecurity(String serviceName, String policyId,
   String[] userGroups, String[] trustedKeyStoreArray,
   String privateStore)
   throws SecurityAdminServiceSecurityConfigExceptionException, RemoteException {
      ApplySecurity applySecurity;
      applySecurity = new ApplySecurity();
      applySecurity.setServiceName(serviceName);
      applySecurity.setPolicyId("scenario" + policyId);
      applySecurity.setTrustedStores(trustedKeyStoreArray);
      applySecurity.setPrivateStore(privateStore);
      applySecurity.setUserGroupNames(userGroups);
      securityAdminServiceStub.applySecurity(applySecurity);
      log.info("Security Applied");
}