I’m trying to configure a Soap Client to use Certificate from Smart card for authentication in Spring boot (java)

I'm trying to configure a Soap Client to use Certificate from Smart card for authentication in Spring boot (java) I can access the certificate by code:

private Certificate getCert() throws Exception { 
     KeyStore ks = KeyStore.getInstance("Windows-MY");
     ks.load(null, null); 
     String alias = "Hubba";
     return  ks.getCertificate(alias);
    }

but I'm not sure how to put this in the Soap client:

@Bean
public Jaxb2Marshaller marshaller() {
    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setContextPath("com.hubba.bu");
    return marshaller;
}

@Bean
public SoapClient soapClient(Jaxb2Marshaller marshaller) {
    SoapClient client = new SoapClient();
    client.setWebServiceTemplate(webServiceTemplate());
    return client;
}

@Bean
public WebServiceTemplate webServiceTemplate() {
  WebServiceTemplate webServiceTemplate = new WebServiceTemplate();
  webServiceTemplate.setMarshaller(marshaller());
  webServiceTemplate.setUnmarshaller(marshaller());
  webServiceTemplate.setDefaultUri("https://test.com/api");
}

Can someone advise me?



Read more here: https://stackoverflow.com/questions/64947199/im-trying-to-configure-a-soap-client-to-use-certificate-from-smart-card-for-aut

Content Attribution

This content was originally published by Bogdan Stefan at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: