Package org.cyclos.security.access
Class DeviceConfirmationServiceSecurity
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.security.BaseServiceSecurity
-
- org.cyclos.security.access.DeviceConfirmationServiceSecurity
-
- All Implemented Interfaces:
DeviceConfirmationService,Service
@Security public class DeviceConfirmationServiceSecurity extends BaseServiceSecurity implements DeviceConfirmationService
Security forDeviceConfirmationService
-
-
Field Summary
-
Fields inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
authHandler, conversionHandler, customFieldValueHandler, entityManagerHandler, groupsHandler, productsHandler, restBeanPropertyMapping, userLocatorHandler
-
Fields inherited from class org.cyclos.impl.AbstractServerComponent
accountHandler, configurationHandler, dataTranslationHandler, notificationHandler, profileFieldHandler, transactionHandler, translationHandler
-
Fields inherited from interface org.cyclos.services.access.DeviceConfirmationService
DEVICE_CONFIRMATION_VALUE_PREFIX
-
-
Constructor Summary
Constructors Constructor Description DeviceConfirmationServiceSecurity()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapprove(long id, long deviceId, String hmac)Approves a confirmation through a trusted device.SerializableInputStreambarcode(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(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(Long id)Load a device confirmation by id for the logged user.voidreject(long id, long deviceId, String hmac)Same asDeviceConfirmationService.approve(long, long, String)but for confirmation rejection.voidremove(Long id)Removes a confirmation for the logged user.protected EntityCheck<?>resolveEntityCheck()Must be implemented in order to return theEntityCheckmanaged by this security component, or null if none-
Methods inherited from class org.cyclos.security.BaseServiceSecurity
checkGuest, checkId, checkIds, checkInternalName, checkLoggedIn, checkManagesUser, checkRelatesToUser, checkScope, checkVO, checkVOs, doInitialize, getEntityCheckRegistry, getUser, initialize
-
Methods inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
canManage, checkManagesUser, checkPermission, checkRelatesToUser, checkValue, clearAlreadyValidated, getBaseEntityManagerHandler, getConfiguration, getLoggedBasicUser, getLoggedUser, getProducts, getTranslatedName, getTranslatedValue, hasPermission, hasValue, inSameNetwork, inSameNetworkOrGlobal, isAdmin, isAlreadyValidated, isBroker, isGlobalAdmin, isGlobalAdminInNetwork, isGuest, isLoggedIn, isMember, isMemberOnly, isNetworkAdmin, isOperator, isRelatedToUser, isSystem, isUserManager, isUserManagerOf, message, message, permission, permission, permissionOptionalValue, permissionOptionalValue, toDate, toDateTime, validate
-
Methods inherited from class org.cyclos.impl.AbstractServerComponent
dataTranslationProxy, delete, detach, find, flush, from, getApplicationContext, getFormatter, getFormatter, getFormatter, getLogger, getRemoteAddress, getSessionData, mailContentBuilder, message, message, persist, processBatch, processBatch, refresh, remove, selectFrom, subQuery, update
-
-
-
-
Method Detail
-
approve
public void approve(long id, long deviceId, String hmac)Description copied from interface:DeviceConfirmationServiceApproves 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.- Specified by:
approvein interfaceDeviceConfirmationService- 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.
-
barcode
public SerializableInputStream barcode(DeviceConfirmationBarcodeParams params)
Description copied from interface:DeviceConfirmationServiceGenerates 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)- Specified by:
barcodein interfaceDeviceConfirmationService
-
create
public DeviceConfirmationVO create(CreateDeviceConfirmationParams params)
Description copied from interface:DeviceConfirmationServiceCreates a new pending for approval device confirmation for the logged user.- Specified by:
createin interfaceDeviceConfirmationService
-
getApprovalData
public DeviceConfirmationApprovalData getApprovalData(long deviceId)
Description copied from interface:DeviceConfirmationServiceReturn data for approve / reject device confirmations for the given device id- Specified by:
getApprovalDatain interfaceDeviceConfirmationService- Returns:
-
load
public DeviceConfirmationVO load(Long id) throws FrameworkException
Description copied from interface:DeviceConfirmationServiceLoad a device confirmation by id for the logged user.- Specified by:
loadin interfaceDeviceConfirmationService- Throws:
FrameworkException
-
reject
public void reject(long id, long deviceId, String hmac)Description copied from interface:DeviceConfirmationServiceSame asDeviceConfirmationService.approve(long, long, String)but for confirmation rejection.- Specified by:
rejectin interfaceDeviceConfirmationService
-
remove
public void remove(Long id)
Description copied from interface:DeviceConfirmationServiceRemoves a confirmation for the logged user.- Specified by:
removein interfaceDeviceConfirmationService
-
resolveEntityCheck
protected EntityCheck<?> resolveEntityCheck()
Description copied from class:BaseServiceSecurityMust be implemented in order to return theEntityCheckmanaged by this security component, or null if none- Specified by:
resolveEntityCheckin classBaseServiceSecurity
-
-