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