SSL Authentication
Posted: Mon Dec 17, 2012 9:52 am
Hi,
I'm hoping someone can point me in the right direction in how to pass a username and password through with an SSL connection.
It's for connection to VedaXML (online credit checks) if anyone has done that one before.
They have given me a user name and password to use for the http authentication. If I go to the URL used to submit the XML to (https://cta.vedaxml.com/sys1) I get the standard windows authentication/logon popup. I enter my credentials and all good - so I know those details are OK.
But how do pass that username and password through in presumably the header of my requests?
All requests I make just return with an error 401 Authorization Required. Access denied - Invalid user name or password. I have sent sample XML to Veda and the XML is fine, they said its the https authentication which is failing, and my software should just automatically pick this up from the certificate store. So thats where I'm now stuck.
The sample connection code for Java they gave includes the following portion on Authenticators for the username and password:
...
//configure local keystore properties
//note: Jave version 1.4 has JSSE included
//note: use Jave 'keytool' tool to manage keystore
System.setProperty( "javax.net.ssl.trustStore", ".keystore");
//set an Authenticator to generate username and password
Authenticator auth = new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication()
{
String username = "username";
String password = "password";
return new PasswordAuthentication( username, password.toCharArray() );
}
};
Authenticator.setDefault( auth );
//prepare and open an HTTP connection
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
....
I'm just using the TcpIpConnection classes, but can't find anything in doco or on the JadeSSLContext or JadeX509Certificate classes about usernames and passwords.
Can anyone point me in the right direction for how to do this within Jade.
Many thanks
Stephen
I'm hoping someone can point me in the right direction in how to pass a username and password through with an SSL connection.
It's for connection to VedaXML (online credit checks) if anyone has done that one before.
They have given me a user name and password to use for the http authentication. If I go to the URL used to submit the XML to (https://cta.vedaxml.com/sys1) I get the standard windows authentication/logon popup. I enter my credentials and all good - so I know those details are OK.
But how do pass that username and password through in presumably the header of my requests?
All requests I make just return with an error 401 Authorization Required. Access denied - Invalid user name or password. I have sent sample XML to Veda and the XML is fine, they said its the https authentication which is failing, and my software should just automatically pick this up from the certificate store. So thats where I'm now stuck.
The sample connection code for Java they gave includes the following portion on Authenticators for the username and password:
...
//configure local keystore properties
//note: Jave version 1.4 has JSSE included
//note: use Jave 'keytool' tool to manage keystore
System.setProperty( "javax.net.ssl.trustStore", ".keystore");
//set an Authenticator to generate username and password
Authenticator auth = new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication()
{
String username = "username";
String password = "password";
return new PasswordAuthentication( username, password.toCharArray() );
}
};
Authenticator.setDefault( auth );
//prepare and open an HTTP connection
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
....
I'm just using the TcpIpConnection classes, but can't find anything in doco or on the JadeSSLContext or JadeX509Certificate classes about usernames and passwords.
Can anyone point me in the right direction for how to do this within Jade.
Many thanks
Stephen