in src/main/java/software/amazon/awssdk/crt/auth/credentials/X509CredentialsProvider.java [131:187]
private X509CredentialsProvider(X509CredentialsProviderBuilder builder) {
super();
String thingName = builder.getThingName();
String roleAlias = builder.getRoleAlias();
String endpoint = builder.getEndpoint();
if (thingName == null || roleAlias == null || endpoint == null) {
throw new IllegalArgumentException("X509CredentialsProvider - thingName, roleAlias, and endpoint must be non null");
}
ClientBootstrap clientBootstrap = builder.getClientBootstrap();
TlsContext tlsContext = builder.getTlsContext();
if (clientBootstrap == null || tlsContext == null) {
throw new IllegalArgumentException("X509CredentialsProvider - clientBootstrap and tlsContext must be non null");
}
int proxyConnectionType = 0;
long proxyTlsContextHandle = 0;
String proxyHost = null;
int proxyPort = 0;
int proxyAuthorizationType = 0;
String proxyAuthorizationUsername = null;
String proxyAuthorizationPassword = null;
HttpProxyOptions proxyOptions = builder.getProxyOptions();
if (proxyOptions != null) {
proxyConnectionType = proxyOptions.getConnectionType().getValue();
TlsContext proxyTlsContext = proxyOptions.getTlsContext();
if (proxyTlsContext != null) {
proxyTlsContextHandle = proxyTlsContext.getNativeHandle();
}
proxyHost = proxyOptions.getHost();
proxyPort = proxyOptions.getPort();
proxyAuthorizationType = proxyOptions.getAuthorizationType().getValue();
proxyAuthorizationUsername = proxyOptions.getAuthorizationUsername();
proxyAuthorizationPassword = proxyOptions.getAuthorizationPassword();
}
long nativeHandle = x509CredentialsProviderNew(
this,
clientBootstrap.getNativeHandle(),
tlsContext.getNativeHandle(),
thingName.getBytes(UTF8),
roleAlias.getBytes(UTF8),
endpoint.getBytes(UTF8),
proxyConnectionType,
proxyHost != null ? proxyHost.getBytes(UTF8) : null,
proxyPort,
proxyTlsContextHandle,
proxyAuthorizationType,
proxyAuthorizationUsername != null ? proxyAuthorizationUsername.getBytes(UTF8) : null,
proxyAuthorizationPassword != null ? proxyAuthorizationPassword.getBytes(UTF8) : null);
acquireNativeHandle(nativeHandle);
addReferenceTo(clientBootstrap);
addReferenceTo(tlsContext);
}