I'm trying to create authentication mechanism on WSO2 IS and I have a trouble as following : - I implemented to remote_user as the below link and the result is OK. I can login and access WSO API from console
https://svn.wso2.org/repos/wso2/people/asela/user-mgt/remote-user-api/4.2.X/
But When I tried on webpage , I can't authenticate to WSO IS. the following is my code for this :
public void init() throws AxisFault{
userName = HDConstants.USER_NAME;
password = HDConstants.PASSWORD;
backEndServerURL = HDConstants.SERVER_URL;
setKeyStore();
configCtx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
}
public void setKeyStore() {
System.setProperty("javax.net.ssl.trustStore", HDConstants.TRUST_STORE_PATH);
System.setProperty("javax.net.ssl.trustStorePassword", HDConstants.TRUST_STORE_PASSWORD);
System.setProperty("javax.net.ssl.trustStoreType", HDConstants.TRUST_STORE_TYPE);
}
public boolean authenticateUser(String userName, String password) throws Exception {
String serviceURL = null;
ServiceClient client = null;
Options option = null;
boolean isAuthenticated = false;
AuthenticationAdminStub authStub = null;
serviceURL = backEndServerURL + "AuthenticationAdmin";
authStub = new AuthenticationAdminStub(configCtx, serviceURL);
client = authStub._getServiceClient();
option = client.getOptions();
option.setManageSession(true);
option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, authCookie);
isAuthenticated = authStub.login(userName, password, HDConstants.APP_ID);
authCookie = (String) authStub._getServiceClient().getServiceContext()
.getProperty(HTTPConstants.COOKIE_STRING);
System.out.println(" Auth Cookie ==== " + authCookie);
return isAuthenticated;
}
`
and the in the controller I used below code to call authenticate method:
AuthenticationServiceClient authenticationServiceClient = new AuthenticationServiceClient();
authenticationServiceClient.init();
authenticationServiceClient.authenticateUser("admin", "admin");
But the result is not good. The system inform that :
at org.apache.axis2.deployment.AxisConfigBuilder.processTransportSenders(AxisConfigBuilder.java:688)
at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:124)
at org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:887)
at org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(FileSystemConfigurator.java:116)
at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:64)
at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:210)
at com.home.hduser.wsois.AuthenticationServiceClient.init(AuthenticationServiceClient.java:29)
I don't know why I can authenticate on console but can't on webapp
and the full trace error attached in the file below : https://drive.google.com/open?id=0B9zEqmu0HBunSlp3X0dpWC1YU0E
I appreciate your help in this case. Thanks