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
-
Constructor Summary
ConstructorsConstructorDescriptionExternalAttachment(URI url, BearerAccessToken accessToken, long expiresIn, Digest digest, String description) Creates a new external attachment. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the optional access token of type Bearer for retrieving the attachment.Returns the cryptographic digest for the document content.longReturns the number of seconds until the attachment becomes unavailable and / or the access token becomes invalid.getURL()Returns the attachment URL.inthashCode()static ExternalAttachmentparse(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.JSONObjectReturns 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,nullif 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,nullif 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,
nullif 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:AttachmentReturns a JSON object representation of this attachment.- Overrides:
toJSONObjectin classAttachment- Returns:
- The JSON object.
-
equals
- Overrides:
equalsin classAttachment
-
hashCode
- Overrides:
hashCodein 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.
-