Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- }
- `
- AuthenticationServiceClient authenticationServiceClient = new AuthenticationServiceClient();
- authenticationServiceClient.init();
- authenticationServiceClient.authenticateUser("admin", "admin");
- 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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement