Apply Role security to WSO2 ESB Proxy using Java API

浪子不回头ぞ 提交于 2019-12-25 03:28:45

问题


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:


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");
}


来源:https://stackoverflow.com/questions/25567198/apply-role-security-to-wso2-esb-proxy-using-java-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!