|
|
|
@ -95,7 +95,7 @@ public class AuthenticationHandler extends AbstractHandler {
|
|
|
|
|
log.debug("Verify Cert:\n" + mdmSignature);
|
|
|
|
|
}
|
|
|
|
|
URI certVerifyUrl = new URI(iotServerConfiguration.getVerificationEndpoint() + "ios");
|
|
|
|
|
Map<String, String> certVerifyHeaders = this.setHeaders(this.restInvoker);
|
|
|
|
|
Map<String, String> certVerifyHeaders = this.setHeaders();
|
|
|
|
|
|
|
|
|
|
Certificate certificate = new Certificate();
|
|
|
|
|
certificate.setPem(mdmSignature);
|
|
|
|
@ -127,7 +127,7 @@ public class AuthenticationHandler extends AbstractHandler {
|
|
|
|
|
|
|
|
|
|
String deviceType = this.getDeviceType(messageContext.getTo().getAddress().trim());
|
|
|
|
|
URI certVerifyUrl = new URI(iotServerConfiguration.getVerificationEndpoint() + deviceType);
|
|
|
|
|
Map<String, String> certVerifyHeaders = this.setHeaders(this.restInvoker);
|
|
|
|
|
Map<String, String> certVerifyHeaders = this.setHeaders();
|
|
|
|
|
Certificate certificate = new Certificate();
|
|
|
|
|
certificate.setPem(subjectDN);
|
|
|
|
|
certificate.setTenantId(tenantId);
|
|
|
|
@ -157,7 +157,7 @@ public class AuthenticationHandler extends AbstractHandler {
|
|
|
|
|
}
|
|
|
|
|
String deviceType = this.getDeviceType(messageContext.getTo().getAddress().trim());
|
|
|
|
|
URI certVerifyUrl = new URI(iotServerConfiguration.getVerificationEndpoint() + deviceType);
|
|
|
|
|
Map<String, String> certVerifyHeaders = this.setHeaders(this.restInvoker);
|
|
|
|
|
Map<String, String> certVerifyHeaders = this.setHeaders();
|
|
|
|
|
|
|
|
|
|
Certificate certificate = new Certificate();
|
|
|
|
|
certificate.setPem(encodedPem);
|
|
|
|
@ -184,9 +184,6 @@ public class AuthenticationHandler extends AbstractHandler {
|
|
|
|
|
} catch (URISyntaxException e) {
|
|
|
|
|
log.error("Error while processing certificate.", e);
|
|
|
|
|
return false;
|
|
|
|
|
} catch (APIMCertificateMGTException e) {
|
|
|
|
|
log.error("Error while processing certificate.", e);
|
|
|
|
|
return false;
|
|
|
|
|
} catch (CertificateException e) {
|
|
|
|
|
log.error("Certificate issue occurred when generating converting PEM to x509Certificate", e);
|
|
|
|
|
return false;
|
|
|
|
@ -212,9 +209,9 @@ public class AuthenticationHandler extends AbstractHandler {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Map<String, String> setHeaders(RESTInvoker restInvoker) throws APIMCertificateMGTException {
|
|
|
|
|
private Map<String, String> setHeaders() {
|
|
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
|
|
String accessToken = Utils.getAccessToken(iotServerConfiguration, restInvoker);
|
|
|
|
|
String accessToken = Utils.getBase64EncodedToken(iotServerConfiguration);
|
|
|
|
|
map.put(AUTHORIZATION, BEARER + accessToken);
|
|
|
|
|
map.put(CONTENT_TYPE, "application/json");
|
|
|
|
|
return map;
|
|
|
|
|