Package org.cyclos.services.access
Interface DeviceConfirmationService
-
- All Superinterfaces:
Service
- All Known Subinterfaces:
DeviceConfirmationServiceLocal
public interface DeviceConfirmationService extends Service
Service interface for device confirmations.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEVICE_CONFIRMATION_VALUE_PREFIXPrefix used when confirming an action with a device.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidapprove(String id, long deviceId, @NotNull String hmac)Approves a confirmation through a trusted device.SerializableInputStreambarcode(@NotNull DeviceConfirmationBarcodeParams params)Generates a two-dimensional barcode (QR code), only if the confirmation was not already approved nor rejected, containing a URL of the form:
cyclos://confirm?id=confirmation_id&op=i18n_confirmation_type&fields=Label1:Value1|Label2:Value2...
If any of the labels / values contains a ':' or '|' char then they are escaped with a '\' (e.i 'Business One | Big' -> 'Business One \| Big') E.g
cyclos://confirm?id=-6959640208566238428&op=Payment confirmation&fields=from:b1|to:b2|amount:50 units)DeviceConfirmationVOcreate(@NotNull CreateDeviceConfirmationParams params)Creates a new pending for approval device confirmation for the logged user.DeviceConfirmationApprovalDatagetApprovalData(Long deviceId)Return data for approve / reject device confirmations for the given device idDeviceConfirmationVOload(String id)Load a device confirmation by id for the logged user.voidreject(String id, long deviceId, @NotNull String hmac)Same asapprove(String, long, String)but for confirmation rejection.voidremove(String id)Removes a confirmation for the logged user.
-
-
-
Field Detail
-
DEVICE_CONFIRMATION_VALUE_PREFIX
static final String DEVICE_CONFIRMATION_VALUE_PREFIX
Prefix used when confirming an action with a device. The final value (i.e the confirmation password) will be of the form 'confirmation:confirmation_id'.- See Also:
- Constant Field Values
-
-
Method Detail
-
approve
void approve(String id, long deviceId, @NotNull @NotNull String hmac) throws FrameworkException, InvalidDeviceConfirmationException
Approves a confirmation through a trusted device. This operation can be invoked as guests or with a logged user, if guest the final user running the approve will be the device's owner.- Parameters:
id- the identification of the confirmation being approved.deviceId- the identification of the trusted device used to approve.hmac- the Hash-based Message Authentication Code used to verify the authentication of the confirmation and device.
The cryptographic hash function used to compute the HMAC is SHA-256.- Throws:
InvalidDeviceConfirmationException- if the confirmation was not found or is invalid. The possible values contained in the exception are:InvalidDeviceConfirmationResult.INVALID_CONFIRMATIONandInvalidDeviceConfirmationResult.INVALID_DEVICE.
This method doesn't block the user because there is no max tries to check for.FrameworkException
-
barcode
SerializableInputStream barcode(@NotNull @NotNull DeviceConfirmationBarcodeParams params) throws FrameworkException
Generates a two-dimensional barcode (QR code), only if the confirmation was not already approved nor rejected, containing a URL of the form:
cyclos://confirm?id=confirmation_id&op=i18n_confirmation_type&fields=Label1:Value1|Label2:Value2...
If any of the labels / values contains a ':' or '|' char then they are escaped with a '\' (e.i 'Business One | Big' -> 'Business One \| Big') E.g
cyclos://confirm?id=-6959640208566238428&op=Payment confirmation&fields=from:b1|to:b2|amount:50 units)- Throws:
FrameworkException
-
create
DeviceConfirmationVO create(@NotNull @NotNull CreateDeviceConfirmationParams params) throws FrameworkException
Creates a new pending for approval device confirmation for the logged user.- Throws:
FrameworkException
-
getApprovalData
DeviceConfirmationApprovalData getApprovalData(Long deviceId)
Return data for approve / reject device confirmations for the given device id- Returns:
-
load
DeviceConfirmationVO load(String id) throws FrameworkException
Load a device confirmation by id for the logged user.- Throws:
FrameworkException
-
reject
void reject(String id, long deviceId, @NotNull @NotNull String hmac) throws FrameworkException, InvalidDeviceConfirmationException
Same asapprove(String, long, String)but for confirmation rejection.
-
remove
void remove(String id) throws FrameworkException
Removes a confirmation for the logged user.- Throws:
FrameworkException
-
-