WSO2 authentication certificates

194 views Asked by At

Is it possible to use authentication certificates to connect to WSO2 (CEP) Admin Services?

https://localhost:9443/services/UserAdmin?wsdl

If yes, so how to do this?

1

There are 1 answers

0
Abimaran Kugathasan On

Accessing Admin Services APIs are common for all the WSO2 products. You have to use the public certificate used by the product inorder to communicate on SSL.

You may refer the following sample

import org.wso2.carbon.authenticator.stub.LoginAuthenticationExceptionException;  
import org.wso2.carbon.authenticator.stub.LogoutAuthenticationExceptionException;  
import org.wso2.carbon.service.mgt.stub.types.carbon.ServiceMetaData;  
import org.wso2.carbon.service.mgt.stub.types.carbon.ServiceMetaDataWrapper;  

import java.rmi.RemoteException;  

public class ListServices {  
  public static void main(String[] args)  
      throws RemoteException, LoginAuthenticationExceptionException,  
          LogoutAuthenticationExceptionException {  
    System.setProperty("javax.net.ssl.trustStore", "$CEP_HOME/repository/resources/security/wso2carbon.jks");  
    System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon");  
    System.setProperty("javax.net.ssl.trustStoreType", "JKS");  
    String backEndUrl = "https://localhost:9443";  

    LoginAdminServiceClient login = new LoginAdminServiceClient(backEndUrl);  
    String session = login.authenticate("admin", "admin");  
    ServiceAdminClient serviceAdminClient = new ServiceAdminClient(backEndUrl, session);  
    ServiceMetaDataWrapper serviceList = serviceAdminClient.listServices();  
    System.out.println("Service Names:");  
    for (ServiceMetaData serviceData : serviceList.getServices()) {  
      System.out.println(serviceData.getName());  
    }  

    login.logOut();  
  }  
}

For more information, check here