Class ExternalAttachment
java.lang.Object
com.nimbusds.openid.connect.sdk.assurance.evidences.attachment.Attachment
com.nimbusds.openid.connect.sdk.assurance.evidences.attachment.ExternalAttachment
External attachment. Provides a
method
to retrieve
the remote content and verify its digest.
Related specifications:
- OpenID Connect for Identity Assurance 1.0, section 5.1.2.2.
-
Constructor Summary
ConstructorDescriptionExternalAttachment
(URI url, BearerAccessToken accessToken, long expiresIn, Digest digest, String description) Creates a new external attachment. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns the optional access token of type Bearer for retrieving the attachment.Returns the cryptographic digest for the document content.long
Returns the number of seconds until the attachment becomes unavailable and / or the access token becomes invalid.getURL()
Returns the attachment URL.int
hashCode()
static ExternalAttachment
parse
(net.minidev.json.JSONObject jsonObject) Parses an external attachment from the specified JSON object.retrieveContent
(int httpConnectTimeout, int httpReadTimeout) Retrieves the external attachment content and verifies its digest.net.minidev.json.JSONObject
Returns a JSON object representation of this attachment.Methods inherited from class com.nimbusds.openid.connect.sdk.assurance.evidences.attachment.Attachment
getDescriptionString, getType, parseList, toEmbeddedAttachment, toExternalAttachment
-
Constructor Details
-
ExternalAttachment
public ExternalAttachment(URI url, BearerAccessToken accessToken, long expiresIn, Digest digest, String description) Creates a new external attachment.- Parameters:
url
- The attachment URL. Must not benull
.accessToken
- Optional access token of type Bearer for retrieving the attachment,null
if none.expiresIn
- Number of seconds until the attachment becomes unavailable and / or the access token becomes invalid. Zero or negative if not specified.digest
- The cryptographic digest for the document content. Must not benull
.description
- The description,null
if not specified.
-
-
Method Details
-
getURL
Returns the attachment URL.- Returns:
- The attachment URL.
-
getBearerAccessToken
Returns the optional access token of type Bearer for retrieving the attachment.- Returns:
- The bearer access token,
null
if not specified.
-
getExpiresIn
Returns the number of seconds until the attachment becomes unavailable and / or the access token becomes invalid.- Returns:
- The number of seconds until the attachment becomes unavailable and / or the access token becomes invalid. Zero or negative if not specified.
-
getDigest
Returns the cryptographic digest for the document content.- Returns:
- The cryptographic digest.
-
retrieveContent
public Content retrieveContent(int httpConnectTimeout, int httpReadTimeout) throws IOException, NoSuchAlgorithmException, DigestMismatchException Retrieves the external attachment content and verifies its digest.- Parameters:
httpConnectTimeout
- The HTTP connect timeout, in milliseconds. Zero implies no timeout. Must not be negative.httpReadTimeout
- The HTTP response read timeout, in milliseconds. Zero implies no timeout. Must not be negative.- Returns:
- The retrieved content.
- Throws:
IOException
- If retrieval of the content failed.NoSuchAlgorithmException
- If the hash algorithm for the digest isn't supported.DigestMismatchException
- If the computed digest for the retrieved document doesn't match the expected.
-
toJSONObject
Description copied from class:Attachment
Returns a JSON object representation of this attachment.- Overrides:
toJSONObject
in classAttachment
- Returns:
- The JSON object.
-
equals
- Overrides:
equals
in classAttachment
-
hashCode
- Overrides:
hashCode
in classAttachment
-
parse
public static ExternalAttachment parse(net.minidev.json.JSONObject jsonObject) throws ParseException Parses an external attachment from the specified JSON object.- Parameters:
jsonObject
- The JSON object. Must not benull
.- Returns:
- The external attachment.
- Throws:
ParseException
- If parsing failed.
-