Package ch.swisscom.mid.client.impl
Class MIDClientImpl
java.lang.Object
ch.swisscom.mid.client.impl.MIDClientImpl
- All Implemented Interfaces:
MIDClient,AutoCloseable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Disposes any internal resources allocated by this instance of the MID Client.pollForSignatureStatus(SignatureTracking signatureTracking) Poll for the status of a previously requested asynchronous MSS Signature.requestAsyncSignature(SignatureRequest request) Requests a MSS Signature to the connected Mobile ID service, using asynchronous communication (the method terminates immediately, returning a signature object that is mostly empty, with a inner signature tracking object; the caller is expected to poll for the status of this MSS Signature flow by repeatedly callingMIDClient.pollForSignatureStatus(SignatureTracking)with the aforementioned signature tracking object).requestProfile(ProfileRequest request) The profile of a mobile user can be queried using this method.requestSyncReceipt(SignatureTracking signatureTracking, ReceiptRequest request) A receipt can be sent to the mobile user that has just finished a digital signature.requestSyncSignature(SignatureRequest request) Requests a MSS Signature to the connected Mobile ID service, using synchronous communication (the client's thread is blocked until the final response is received; this could take a while, e.g.
-
Constructor Details
-
MIDClientImpl
- Throws:
ConfigurationException
-
-
Method Details
-
requestSyncSignature
Description copied from interface:MIDClientRequests a MSS Signature to the connected Mobile ID service, using synchronous communication (the client's thread is blocked until the final response is received; this could take a while, e.g. 80 seconds, so make sure that the HTTP response timeout is properly set in the client configuration otherwise a timeout will occur). The response is returned to the caller or, if something breaks during the communication, aMIDClientExceptionis thrown.- Specified by:
requestSyncSignaturein interfaceMIDClient- Parameters:
request- the MSS Signature request to send- Returns:
- the response, as received from the Mobile ID service.
-
requestAsyncSignature
Description copied from interface:MIDClientRequests a MSS Signature to the connected Mobile ID service, using asynchronous communication (the method terminates immediately, returning a signature object that is mostly empty, with a inner signature tracking object; the caller is expected to poll for the status of this MSS Signature flow by repeatedly callingMIDClient.pollForSignatureStatus(SignatureTracking)with the aforementioned signature tracking object). The method returns either with a response object and a tracking object to use in subsequent polls or by throwing an exception is something is misaligned.- Specified by:
requestAsyncSignaturein interfaceMIDClient- Parameters:
request- the MSS Signature request to send- Returns:
- a signature response object, containing the tracking element to use in subsequent polls.
-
pollForSignatureStatus
Description copied from interface:MIDClientPoll for the status of a previously requested asynchronous MSS Signature. The caller is expected to check theStatusobject from the returned response in order to learn about the current status of the signature flow. If the signature is not finished, the caller needs to poll again, with the same input tracking object.- Specified by:
pollForSignatureStatusin interfaceMIDClient- Parameters:
signatureTracking- the signature tracking object received from the call toMIDClient.requestAsyncSignature(SignatureRequest)- Returns:
- a response object that contains only the
Statuspopulated with an intermediary status value or the final signature response
-
requestSyncReceipt
public ReceiptResponse requestSyncReceipt(SignatureTracking signatureTracking, ReceiptRequest request) Description copied from interface:MIDClientA receipt can be sent to the mobile user that has just finished a digital signature. The call is synchronous and optional. Making such a call allows the AP to send a confirmation message to the mobile user (e.g. "Access granted").- Specified by:
requestSyncReceiptin interfaceMIDClient- Parameters:
signatureTracking- the signature tracking object received from the call toMIDClient.requestAsyncSignature(SignatureRequest)orMIDClient.requestSyncSignature(SignatureRequest)request- the request data additional to what thesignatureTrackingalready provides- Returns:
- a response object containing the status of the operation.
-
requestProfile
Description copied from interface:MIDClientThe profile of a mobile user can be queried using this method. No interaction with the mobile user is performed. The backend just returns whatever data is available for the designated mobile user. This operation is synchronous.- Specified by:
requestProfilein interfaceMIDClient- Parameters:
request- the profile request data- Returns:
- a response object containing the status outcome of the operation and the requested profile data.
-
close
public void close()Description copied from interface:MIDClientDisposes any internal resources allocated by this instance of the MID Client. This method should be used ONLY when the MID Client cannot be used anymore (e.g. it is really not needed and needs to go away). The implementation of MID Client should be thread-safe and resource pooled, so that it can be reused in as many threads and for as long as possible. Call this method only when your app is shutting down or you really don't need the client anymore.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceMIDClient
-