Commit c6c27878 authored by Roeland Luykx's avatar Roeland Luykx

fix dotnet demo after changes of idp user auth to artifact binding

git-svn-id: https://svn.code.sf.net/p/ehealthconnector/code/trunk@1722 e99adb7c-5e35-42fd-8d1b-cdb378af05e8
parent 7d53d531
......@@ -36,10 +36,12 @@ using org.ehealth_connector.security.communication.ch.ppq.config;
using org.ehealth_connector.security.communication.ch.ppq.config.impl;
using org.ehealth_connector.security.communication.config;
using org.ehealth_connector.security.communication.config.impl;
using org.ehealth_connector.security.communication.clients.impl;
using org.ehealth_connector.security.communication.impl;
using org.ehealth_connector.security.communication.xua;
using org.ehealth_connector.security.communication.xua.impl;
using org.ehealth_connector.security.communication.xua.impl.ch;
using org.ehealth_connector.security.core;
using org.ehealth_connector.security.crypt;
using org.ehealth_connector.security.deserialization.impl;
......@@ -472,7 +474,7 @@ namespace eHealthConnectorDemo
*/
private void doDemoAuthenticationIdpHttpPostProtoHandler(String protocolHandlerName,
String aSignKey, String aOuputPath, String enpointUrl, String assertionUrl,
String validatingAlias)
String validatingAlias, String artResolvingUrl)
{
txtLog.AppendText("Executing IdP authentication by HTTP-POST to " + enpointUrl
+ " with protocol handler " + assertionUrl + "\n");
......@@ -531,7 +533,7 @@ namespace eHealthConnectorDemo
txtLog.AppendText("Send User Authentication Request to IdP ("
+ clientConfiguration.getUrl() + ") ...\n");
Response response = null;
Object response = null;
try
{
response = client.invokeUserAuthentication(authnRequest, clientConfiguration);
......@@ -548,16 +550,64 @@ namespace eHealthConnectorDemo
}
if (response != null) {
txtLog.AppendText("Transaction successfully completed.\n");
if (StringUtils.isEmpty(aOuputPath)) {
demoXuaOutputLogger.logOut(response);
} else {
demoXuaOutputLogger.toFile(response, aOuputPath);
if (response is Response) {
txtLog.AppendText("Transaction successfully completed.\n");
if (StringUtils.isEmpty(aOuputPath))
{
demoXuaOutputLogger.logOut((Response)response);
}
else
{
demoXuaOutputLogger.toFile((Response)response, aOuputPath);
}
// verify the reponse
verifyResponse((Response)response, validatingAlias);
} else if (response is String) {
ArtifactResolve artifactResolve = new ArtifactResolveBuilderImpl() //
.id(UUID.randomUUID().toString().replace("-", "")) //
.issuer("ehc demo") //
.issueInstant(Calendar.getInstance()) //
.artifact((String)response) //
.create();
signCryptModule.signArtifactResolve(artifactResolve, signingAlias);
if (StringUtils.isEmpty(aOuputPath))
{
demoXuaOutputLogger.logOut(artifactResolve);
}
else
{
demoXuaOutputLogger.toFile(artifactResolve, aOuputPath);
}
SoapClientConfig resolveClientConfig = new SoapClientConfigBuilderImpl()//
.url(artResolvingUrl)//
.soapVersion(SoapClientConfig.SoapVersion.SOAP_11)//
.create();
SimpleArtifactResolveClient resolveClient = new SimpleArtifactResolveClient(
resolveClientConfig);
ArtifactResponse artifactResponse = resolveClient.send(artifactResolve);
if (StringUtils.isEmpty(aOuputPath))
{
demoXuaOutputLogger.logOut(artifactResponse);
}
else
{
demoXuaOutputLogger.toFile(artifactResponse, aOuputPath);
}
verifyResponse((Response)artifactResponse.getResponses().get(0), validatingAlias);
}
// verify the reponse
verifyResponse(response, validatingAlias);
} else
}
else
{
txtLog.AppendText("Transaction failed. See logfile for more information.\n");
}
}
} catch (Exception e) {
......@@ -706,7 +756,7 @@ namespace eHealthConnectorDemo
// invoke the authentication request.
txtLog.AppendText("Send User Authentication Request to IdP ("
+ clientConfiguration.getUrl() + ") ...\n");
Response response = client.invokeUserAuthentication(authnRequest,
Response response = (Response)client.invokeUserAuthentication(authnRequest,
clientConfiguration);
if (response != null)
......@@ -1006,7 +1056,7 @@ namespace eHealthConnectorDemo
// invoke the authentication request.
txtLog.AppendText(
"Send AuthnRequest to IdP (" + clientConfiguration.getUrl() + ") ...\n");
Response response = client.invokeUserAuthentication(authnRequest,
Response response = (Response)client.invokeUserAuthentication(authnRequest,
clientConfiguration);
if (response != null)
......@@ -1052,7 +1102,7 @@ namespace eHealthConnectorDemo
{
doDemoAuthenticationIdpHttpPostProtoHandler(protocolHandlerName, aSignKey, aOuputPath,
"http://fed.hin.ch/saml/2.0/epd/", "ehcdemo://localhost.localdomain",
VALIDATING_ALIAS_HIN);
VALIDATING_ALIAS_HIN, "https://fed.hintest.ch/nevisauth/services/artifactresolution");
}
/**
......@@ -1072,7 +1122,7 @@ namespace eHealthConnectorDemo
String assertionUrl = "ehcdemo://authresponse";
doDemoAuthenticationIdpHttpPostProtoHandler(protocolHandlerName, aSignKey, aOuputPath,
"http://projects.suisse-open-exchange.healthcare/idp-simulator/idp/auth",
assertionUrl, VALIDATING_ALIAS_SOE);
assertionUrl, VALIDATING_ALIAS_SOE, null);
}
......
......@@ -158,6 +158,34 @@ namespace eHealthConnectorDemo
}
}
public void logOut(ArtifactResolve artifactResolve)
{
try
{
ArtifactResolveSerializerImpl serializer = new ArtifactResolveSerializerImpl();
String xmlString = serializer.toXmlString(artifactResolve);
txtLog.AppendText(xmlString + "\n");
}
catch (java.lang.Throwable t) {
log.trace("Error", t);
}
}
public void logOut(ArtifactResponse artifactResponse)
{
try
{
ArtifactResponseSerializerImpl serializer = new ArtifactResponseSerializerImpl();
String xmlString = serializer.toXmlString(artifactResponse);
txtLog.AppendText(xmlString + "\n");
}
catch (java.lang.Throwable t) {
log.trace("Error", t);
}
}
/**
* Logs the given request to the configured output
*
......
......@@ -5,4 +5,4 @@ regedit /s rsc\demoXua\idp\scripts\ehcdemo.reg
REM request idp simulator for idp assertion
"%JAVA_HOME%"\bin\java -jar target\ehealthconnectorDemo.jar DemoXua --IdpProtoSoe -y=ehcdemo -o=xuademo-out/idp
"%JAVA_HOME%"\bin\java -jar target\ehealthconnectorDemo.jar DemoXua --IdpProtoHin -y=ehcdemo -k=rsc/demoXua/security/ehs_gazelle.p12:testit:pkcs12:"ehs gazelle xua demo" -o=test-files
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment