Package org.cyclos.security.access
Class TrustedDeviceServiceSecurity
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.security.BaseServiceSecurity
-
- org.cyclos.security.access.TrustedDeviceServiceSecurity
-
- All Implemented Interfaces:
TrustedDeviceService,Service
@Security public class TrustedDeviceServiceSecurity extends BaseServiceSecurity implements TrustedDeviceService
Security forTrustedDeviceService
-
-
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
-
-
Constructor Summary
Constructors Constructor Description TrustedDeviceServiceSecurity()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ActivateTrustedDeviceDTOactivate(TrustedDeviceActivationParams params)Activates a trusted device by code or if a trusted device is required for activation then use theTrustedDeviceActivationParams.DEVICE_IDandTrustedDeviceActivationParams.DEVICE_CONFIRMATION_IDto ensure the corresponding device confirmation was already approved (using another trusted device).TrustedDeviceActivationDatagetActivationData()Returns data required to activate a device for the logged user.PasswordInputDTOgetConfirmationPasswordInputForRemove(@NotNull Long id)Returns thePasswordInputDTOfor the confirmation password that would be required if removing the trusted device with the given idTrustedDeviceDatagetData(long id)Returns data about a trusted device.List<TrustedDeviceVO>list(UserLocatorVO locator)Returns the list of trusted devices for the given user (null resolves to the logged user).
Manager users must have thePermission.USER_TRUSTED_DEVICES_VIEWpermission.voidremove(Long id, String confirmationPassword)Removes a trusted device by id for the logged user.RequestActivationResultrequestActivationCode(@NotNull RequestDeviceActivationParams params)Requests for an activation code.protected EntityCheck<?>resolveEntityCheck()Must be implemented in order to return theEntityCheckmanaged by this security component, or null if nonevoidsave(TrustedDeviceDTO dto)Updates a given trusted device for the logged user.-
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, setAlreadyValidated, toDate, toDateTime, validate
-
Methods inherited from class org.cyclos.impl.AbstractServerComponent
dataTranslationProxy, dataTranslationProxy, delete, detach, doDataTranslationProxy, find, flush, from, getApplicationContext, getFormatter, getFormatter, getFormatter, getLogger, getRemoteAddress, getSessionData, mailContentBuilder, message, message, persist, processBatch, processBatch, refresh, remove, selectFrom, subQuery, update
-
-
-
-
Method Detail
-
activate
public ActivateTrustedDeviceDTO activate(TrustedDeviceActivationParams params) throws FrameworkException
Description copied from interface:TrustedDeviceServiceActivates a trusted device by code or if a trusted device is required for activation then use theTrustedDeviceActivationParams.DEVICE_IDandTrustedDeviceActivationParams.DEVICE_CONFIRMATION_IDto ensure the corresponding device confirmation was already approved (using another trusted device).- Specified by:
activatein interfaceTrustedDeviceService- Throws:
FrameworkException
-
getActivationData
public TrustedDeviceActivationData getActivationData() throws FrameworkException
Description copied from interface:TrustedDeviceServiceReturns data required to activate a device for the logged user.- Specified by:
getActivationDatain interfaceTrustedDeviceService- Throws:
FrameworkException
-
getConfirmationPasswordInputForRemove
public PasswordInputDTO getConfirmationPasswordInputForRemove(@NotNull @NotNull Long id) throws FrameworkException
Description copied from interface:TrustedDeviceServiceReturns thePasswordInputDTOfor the confirmation password that would be required if removing the trusted device with the given id- Specified by:
getConfirmationPasswordInputForRemovein interfaceTrustedDeviceService- Throws:
FrameworkException
-
getData
public TrustedDeviceData getData(long id) throws FrameworkException
Description copied from interface:TrustedDeviceServiceReturns data about a trusted device.- Specified by:
getDatain interfaceTrustedDeviceService- Throws:
FrameworkException
-
list
public List<TrustedDeviceVO> list(UserLocatorVO locator) throws FrameworkException
Description copied from interface:TrustedDeviceServiceReturns the list of trusted devices for the given user (null resolves to the logged user).
Manager users must have thePermission.USER_TRUSTED_DEVICES_VIEWpermission.- Specified by:
listin interfaceTrustedDeviceService- Throws:
FrameworkException
-
remove
public void remove(Long id, String confirmationPassword) throws FrameworkException
Description copied from interface:TrustedDeviceServiceRemoves a trusted device by id for the logged user.- Specified by:
removein interfaceTrustedDeviceService- Throws:
FrameworkException
-
requestActivationCode
public RequestActivationResult requestActivationCode(@NotNull @NotNull RequestDeviceActivationParams params) throws FrameworkException
Description copied from interface:TrustedDeviceServiceRequests for an activation code. This method can be used to request a code for the first time or as a new request for a given device. In case aRequestDeviceActivationParams.DEVICE_IDis given then the same existing code for that device will be send again and the the name won't be changed (it's ignored if given). Otherwise, a new pending trusted device will be created for the logged user and the code will be sent (in that case the name is required). (phone / e-mail). IfRequestDeviceActivationParams.MEDIUMisSendMedium.SMSthen the message will be send to the (required)RequestDeviceActivationParams.MOBILE_PHONE.- Specified by:
requestActivationCodein interfaceTrustedDeviceService- Returns:
- A VO with the following:
- The final name assigned to the device. It could be different to the input name if it's already in use
- The device id (required to re-send the code)
- The e-mail or the normalized mobile phone number that received the code
- The creation date
- Throws:
FrameworkException
-
save
public void save(TrustedDeviceDTO dto) throws FrameworkException
Description copied from interface:TrustedDeviceServiceUpdates a given trusted device for the logged user. It will be used from the mobile in the settings page.- Specified by:
savein interfaceTrustedDeviceService- Throws:
FrameworkException
-
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
-
-