Top Description Inners Fields Constructors Methods
com.oracle.bmc.auth

public Class URLBasedX509CertificateSupplier

extends Object
implements X509CertificateSupplier, Refreshable
Class Inheritance
All Implemented Interfaces
javax.security.auth.Refreshable, com.oracle.bmc.auth.X509CertificateSupplier
Imports
java.io.BufferedReader, .ByteArrayInputStream, .IOException, .InputStream, .InputStreamReader, java.net.URL, .URLConnection, java.nio.charset.StandardCharsets, java.security.cert.CertificateException, .CertificateFactory, .X509Certificate, java.security.interfaces.RSAPrivateKey, java.util.Map, .Objects, java.util.concurrent.TimeUnit, java.util.concurrent.atomic.AtomicReference, java.util.stream.Collectors, jakarta.annotation.Nonnull, javax.security.auth.Refreshable, org.slf4j.Logger, com.oracle.bmc.auth.internal.X509CertificateWithOriginalPem, com.oracle.bmc.http.signing.internal.PEMFileRSAPrivateKeySupplier, com.oracle.bmc.util.StreamUtils

X509CertificateSupplier implementation that reads both certificate and private key off of URL. This class also provides a way to manually refresh the certificate and private key at any point.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
protected static final String
CERTIFICATE_URL_CONNECTION_READ_TIMEOUT_IN_MILLIS

Set the environment variables to configure read timeout and connection timeout (in milliseconds) for URL Connection

private static final String
protected static final String
private static final String
private final AtomicReference<X509CertificateSupplier.CertificateAndPrivateKeyPair>
certificateAndKeyPair

The certificate and the private key of certificate.

private final URLBasedX509CertificateSupplier.ResourceDetails
certificateDetails

The resource details of certificate.

private static final boolean
EXPERIMENTAL_SUPPRESS_X509_WORKAROUND

Provide a way for the application environment to disable the X509 workaround by setting a system property to "true".

private static final Logger
private final URLBasedX509CertificateSupplier.ResourceDetails
privateKeyDetails

The resource details of private key.

private final char[]
privateKeyPassphraseCharacters

The passphrase of private key.

Constructor Summary

AccessConstructor and Description
public
URLBasedX509CertificateSupplier(URLBasedX509CertificateSupplier.ResourceDetails
The certificate resource details
certificateResourceDetails
,
URLBasedX509CertificateSupplier.ResourceDetails
The private key resource details, may be null for intermediate certificates
privateKeyResourceDetails
,
char[]
The private key passphrase, may be null for unencrypted private keys
privateKeyPassphraseCharacters
)

Constructor.

public
URLBasedX509CertificateSupplier(URL
The certificate url
certificateUrl
,
URL
The private key url, may be null for intermediate certificates
privateKeyUrl
,
char[]
The private key passphrase, may be null for unencrypted private keys
privateKeyPassphraseCharacters
)

Constructor.

public
URLBasedX509CertificateSupplier(URL
The certificate url
certificateUrl
,
URL
The private key url, may be null for intermediate certificates
privateKeyUrl
,
String
The private key passphrase, may be null for unencrypted private keys
privateKeyPassphrase
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public X509Certificate

Returns:

The certificate, must not be null
getCertificate
()

Implements com.oracle.bmc.auth.X509CertificateSupplier.getCertificate.

Gets the certificate

public X509CertificateSupplier.CertificateAndPrivateKeyPair

Returns:

The certificate and private key pair.
getCertificateAndKeyPair
()

Implements com.oracle.bmc.auth.X509CertificateSupplier.getCertificateAndKeyPair.

Returns the X509 certificate and private key.

public RSAPrivateKey

Returns:

The private key
getPrivateKey
()

Implements com.oracle.bmc.auth.X509CertificateSupplier.getPrivateKey.

Corresponding private key of the certificate.

private static InputStream
public boolean

Returns:

false always.
isCurrent
()

Implements javax.security.auth.Refreshable.isCurrent.

So far we don't care whether the certificate is current or not.

private static X509Certificate

Returns:

the certificate
readCertificate
(String
the certificate
certificate
)

Read the certificate from a raw string.

private static RSAPrivateKey

Returns:

the private key
readPrivateKey
(final URLBasedX509CertificateSupplier.ResourceDetails
the private key resource details.
privateKeyResourceDetails
,
char[]
the private key passhprase
privateKeyPassphrase
)

Read the private key from url.

private static String
public void
refresh()

Implements javax.security.auth.Refreshable.refresh.

A method to refresh the X509 certificate.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CERTIFICATE_URL_CONNECTION_READ_TIMEOUT_IN_MILLISback to summary
protected static final String CERTIFICATE_URL_CONNECTION_READ_TIMEOUT_IN_MILLIS

Set the environment variables to configure read timeout and connection timeout (in milliseconds) for URL Connection

CERTIFICATE_URL_CONNECTION_READ_TIMEOUT_IN_MILLIS_VAR_NAMEback to summary
private static final String CERTIFICATE_URL_CONNECTION_READ_TIMEOUT_IN_MILLIS_VAR_NAME
CERTIFICATE_URL_CONNECTION_TIMEOUT_IN_MILLISback to summary
protected static final String CERTIFICATE_URL_CONNECTION_TIMEOUT_IN_MILLIS
CERTIFICATE_URL_CONNECTION_TIMEOUT_IN_MILLIS_VAR_NAMEback to summary
private static final String CERTIFICATE_URL_CONNECTION_TIMEOUT_IN_MILLIS_VAR_NAME
certificateAndKeyPairback to summary
private final AtomicReference<X509CertificateSupplier.CertificateAndPrivateKeyPair> certificateAndKeyPair

The certificate and the private key of certificate.

certificateDetailsback to summary
private final URLBasedX509CertificateSupplier.ResourceDetails certificateDetails

The resource details of certificate.

EXPERIMENTAL_SUPPRESS_X509_WORKAROUNDback to summary
private static final boolean EXPERIMENTAL_SUPPRESS_X509_WORKAROUND

Provide a way for the application environment to disable the X509 workaround by setting a system property to "true". On the command line, this can be done using `-Doci.sdk.experimental.suppressX509Workaround=true`

LOGback to summary
private static final Logger LOG
privateKeyDetailsback to summary
private final URLBasedX509CertificateSupplier.ResourceDetails privateKeyDetails

The resource details of private key.

privateKeyPassphraseCharactersback to summary
private final char[] privateKeyPassphraseCharacters

The passphrase of private key.

Constructor Detail

URLBasedX509CertificateSupplierback to summary
public URLBasedX509CertificateSupplier(URLBasedX509CertificateSupplier.ResourceDetails certificateResourceDetails, URLBasedX509CertificateSupplier.ResourceDetails privateKeyResourceDetails, char[] privateKeyPassphraseCharacters)

Constructor.

Parameters
certificateResourceDetails:URLBasedX509CertificateSupplier.ResourceDetails

The certificate resource details

privateKeyResourceDetails:URLBasedX509CertificateSupplier.ResourceDetails

The private key resource details, may be null for intermediate certificates

privateKeyPassphraseCharacters:char[]

The private key passphrase, may be null for unencrypted private keys

URLBasedX509CertificateSupplierback to summary
public URLBasedX509CertificateSupplier(URL certificateUrl, URL privateKeyUrl, char[] privateKeyPassphraseCharacters)

Constructor.

Parameters
certificateUrl:URL

The certificate url

privateKeyUrl:URL

The private key url, may be null for intermediate certificates

privateKeyPassphraseCharacters:char[]

The private key passphrase, may be null for unencrypted private keys

URLBasedX509CertificateSupplierback to summary
public URLBasedX509CertificateSupplier(URL certificateUrl, URL privateKeyUrl, String privateKeyPassphrase)

Constructor.

Parameters
certificateUrl:URL

The certificate url

privateKeyUrl:URL

The private key url, may be null for intermediate certificates

privateKeyPassphrase:String

The private key passphrase, may be null for unencrypted private keys

Annotations
@Deprecated

Method Detail

getCertificateback to summary
public X509Certificate getCertificate()

Implements com.oracle.bmc.auth.X509CertificateSupplier.getCertificate.

Gets the certificate

Returns:X509Certificate

The certificate, must not be null

Annotations
@Override
@Deprecated
getCertificateAndKeyPairback to summary
public X509CertificateSupplier.CertificateAndPrivateKeyPair getCertificateAndKeyPair()

Implements com.oracle.bmc.auth.X509CertificateSupplier.getCertificateAndKeyPair.

Returns the X509 certificate and private key. The X509 certificate will always be valid. The private key may be null for intermediate certificates. For leaf certificates, the private key will always be valid.

Returns:X509CertificateSupplier.CertificateAndPrivateKeyPair

The certificate and private key pair.

Annotations
@Override
getPrivateKeyback to summary
public RSAPrivateKey getPrivateKey()

Implements com.oracle.bmc.auth.X509CertificateSupplier.getPrivateKey.

Corresponding private key of the certificate. You must implement this method for leaf certificates (to sign the request made to the auth service to get a security token). For intermediate certificates, you can return null.

Returns:RSAPrivateKey

The private key

Annotations
@Override
@Deprecated
getResourceStreamback to summary
private static InputStream getResourceStream(final URLBasedX509CertificateSupplier.ResourceDetails resourceDetails) throws IOException
isCurrentback to summary
public boolean isCurrent()

Implements javax.security.auth.Refreshable.isCurrent.

So far we don't care whether the certificate is current or not.

Returns:boolean

false always.

Annotations
@Override
readCertificateback to summary
private static X509Certificate readCertificate(String certificate)

Read the certificate from a raw string.

Parameters
certificate:String

the certificate

Returns:X509Certificate

the certificate

readPrivateKeyback to summary
private static RSAPrivateKey readPrivateKey(final URLBasedX509CertificateSupplier.ResourceDetails privateKeyResourceDetails, char[] privateKeyPassphrase)

Read the private key from url.

Parameters
privateKeyResourceDetails:URLBasedX509CertificateSupplier.ResourceDetails

the private key resource details.

privateKeyPassphrase:char[]

the private key passhprase

Returns:RSAPrivateKey

the private key

readRawCertificateback to summary
private static String readRawCertificate(final URLBasedX509CertificateSupplier.ResourceDetails certificateResourceDetails)
refreshback to summary
public void refresh()

Implements javax.security.auth.Refreshable.refresh.

A method to refresh the X509 certificate.

Annotations
@Override
com.oracle.bmc.auth back to summary

public Class URLBasedX509CertificateSupplier.ResourceDetails

extends Object
Class Inheritance
  • java.lang.Object
  • com.oracle.bmc.auth.URLBasedX509CertificateSupplier.ResourceDetails

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private final Map<String, String>
headers

Headers to be sent along with the resource fetch request

private final URL
url

The url of the resource

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public static URLBasedX509CertificateSupplier.ResourceDetails.ResourceDetailsBuilder
protected boolean
canEqual(final Object other)

public boolean
equals(final Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public Map<String, String>
public URL
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

headersback to summary
private final Map<String, String> headers

Headers to be sent along with the resource fetch request

urlback to summary
private final URL url

The url of the resource

Constructor Detail

ResourceDetailsback to summary
pack-priv ResourceDetails(URL url, Map<String, String> headers)
Annotations
@java.beans.ConstructorProperties

Method Detail

builderback to summary
public static URLBasedX509CertificateSupplier.ResourceDetails.ResourceDetailsBuilder builder()
canEqualback to summary
protected boolean canEqual(final Object other)
equalsback to summary
public boolean equals(final Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

getHeadersback to summary
public Map<String, String> getHeaders()
getUrlback to summary
public URL getUrl()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

com.oracle.bmc.auth back to summary

public Class URLBasedX509CertificateSupplier.ResourceDetails.ResourceDetailsBuilder

extends Object
Class Inheritance
  • java.lang.Object
  • com.oracle.bmc.auth.URLBasedX509CertificateSupplier.ResourceDetails.ResourceDetailsBuilder

Field Summary

Modifier and TypeField and Description
private Map<String, String>
private URL

Constructor Summary

AccessConstructor and Description
pack-priv

Field Detail

headersback to summary
private Map<String, String> headers
urlback to summary
private URL url

Constructor Detail

ResourceDetailsBuilderback to summary
pack-priv ResourceDetailsBuilder()

Method Detail

buildback to summary
public URLBasedX509CertificateSupplier.ResourceDetails build()
headersback to summary
public URLBasedX509CertificateSupplier.ResourceDetails.ResourceDetailsBuilder headers(Map<String, String> headers)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

urlback to summary
public URLBasedX509CertificateSupplier.ResourceDetails.ResourceDetailsBuilder url(URL url)