Package org.cyclos.impl.access
Interface DeviceConfirmationServiceLocal
-
- All Superinterfaces:
DeviceConfirmationService,Service
public interface DeviceConfirmationServiceLocal extends DeviceConfirmationService
Local interface for device confirmations.
-
-
Field Summary
-
Fields inherited from interface org.cyclos.services.access.DeviceConfirmationService
DEVICE_CONFIRMATION_VALUE_PREFIX
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description TrustedDevicecheck(String id, CreateDeviceConfirmationParams params)Checks if the confirmation was APPROVED and also its QR-content matches the generated from theCreateDeviceConfirmationParamsparameter.DeviceConfirmationVOcreate(CreateDeviceConfirmationParams params, BasicUser creatorUser, BasicUser ownerUser, boolean unmaskIds)Creates a new pending for approval device confirmation for the owner user.DeviceConfirmationfind(String id)Returns the device confirmation with a given id, throwingEntityNotFoundExceptionif the id isn't found.static BasicUsergetCreatorUserAttr(CreateDeviceConfirmationParams params)The creator user attribute is used in some cases where the confirmation's owner user is different than the user who created the confirmation (e.g in a receive payment the creator is the payee)Map<MessageKey,Object>getQRFields(DeviceConfirmationType type, Map<DeviceConfirmationField,Object> canonicalValues)Returns a map with the fields used to generated the QR content for a given device confirmation typedefault booleanisDeviceConfirmation(String confirmationPassword)Returns true if the password represents a device confirmation.voidregisterFeedback(String value)Registers both commit and rollback listeners to send feedback via push notification for this device confirmationstatic voidsetCreatorUserAttr(CreateDeviceConfirmationParams params, BasicUser user)TrustedDevicevalidate(String id, long deviceId, String hmac)Validates a PENDING confirmation with a device to ensure the device is a valid trusted device.-
Methods inherited from interface org.cyclos.services.access.DeviceConfirmationService
approve, barcode, create, getApprovalData, load, reject, remove
-
-
-
-
Method Detail
-
getCreatorUserAttr
static BasicUser getCreatorUserAttr(CreateDeviceConfirmationParams params)
The creator user attribute is used in some cases where the confirmation's owner user is different than the user who created the confirmation (e.g in a receive payment the creator is the payee)
-
setCreatorUserAttr
static void setCreatorUserAttr(CreateDeviceConfirmationParams params, BasicUser user)
-
check
TrustedDevice check(String id, CreateDeviceConfirmationParams params) throws InvalidDeviceConfirmationException
Checks if the confirmation was APPROVED and also its QR-content matches the generated from theCreateDeviceConfirmationParamsparameter. Also, if the confirmation was found and is approved then it's removed.- Returns:
- the device used to approve the given confirmation
- Throws:
InvalidDeviceConfirmationException- if the confirmation was not found or is invalid. The possible values contained in the exception are:InvalidDeviceConfirmationResult.INVALID_CONFIRMATIONandInvalidDeviceConfirmationResult.MAX_CHECK_ATTEMPTS_REACHED.
This method blocks the user if the max attempts was reached.
-
create
DeviceConfirmationVO create(CreateDeviceConfirmationParams params, BasicUser creatorUser, BasicUser ownerUser, boolean unmaskIds)
Creates a new pending for approval device confirmation for the owner user. If the ids present in the 'params' object are masked then set the 'unmaskIds' flag to true. If a 'creatorUser' is given then the push-notification will be send to that user instead of to the owner user.
-
find
DeviceConfirmation find(String id)
Returns the device confirmation with a given id, throwingEntityNotFoundExceptionif the id isn't found.
-
getQRFields
Map<MessageKey,Object> getQRFields(DeviceConfirmationType type, Map<DeviceConfirmationField,Object> canonicalValues)
Returns a map with the fields used to generated the QR content for a given device confirmation type- Parameters:
canonicalValues- the values obtained after parsing theCreateDeviceConfirmationParams.FIELDSmap NOTE: This method is used by the associated junit-test class (that was the reason to be placed in the local interface)
-
isDeviceConfirmation
default boolean isDeviceConfirmation(String confirmationPassword)
Returns true if the password represents a device confirmation.
-
registerFeedback
void registerFeedback(String value)
Registers both commit and rollback listeners to send feedback via push notification for this device confirmation
-
validate
TrustedDevice validate(String id, long deviceId, String hmac) throws InvalidDeviceConfirmationException
Validates a PENDING confirmation with a device to ensure the device is a valid trusted device. This method perform the same validation as forDeviceConfirmationService.approve(String, long, String)but immediately remove the confirmation and do not send any push-notification if the validation success.- Returns:
- the device associated to the given id
- Throws:
InvalidDeviceConfirmationException
-
-