Package org.cyclos.security.access
Class PinServiceSecurity
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.security.BaseServiceSecurity
-
- org.cyclos.security.access.PinServiceSecurity
-
- All Implemented Interfaces:
PinService,Service
@Security public class PinServiceSecurity extends BaseServiceSecurity implements PinService
Security forPinService
-
-
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 PinServiceSecurity()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapply(BasicUser user, UserPinsData data)UserPinsDatagetData(UserLocatorVO locator)Returns data regarding pins for the given user (null resolves to the logged user).PinDatagetEditData(PinLocatorVO locator)Returns data for editing a pin.PasswordInputDTOgetPasswordInputForCreate()Return the password input required to create a pin for the logged user.List<PinVO>list(UserLocatorVO locator)Returns the list of device pins for the given user (null resolves to the logged user).
Manager users must have thePermission.USER_PINS_VIEWpermission.PinDetailedVOlocate(PinLocatorVO locator)Locates a device pin, either by id or principal.voidremove(PinLocatorVO locator, CurrentCredentialsForPinManage currentCredentials)Removes the given pin.protected EntityCheck<?>resolveEntityCheck()Must be implemented in order to return theEntityCheckmanaged by this security component, or null if nonevoidsave(PinDTO dto)Updates a given device pin for the logged user.CreatePinDTOset(SetPinParams params)Creates a new pin or modify an existing for the logged user and associates it to the current principal type and password type.ValidationResultvalidate(@NotNull String value)Validates a value to be used as a pin for the logged user and the current channel.-
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
-
apply
public void apply(BasicUser user, UserPinsData data)
-
getData
public UserPinsData getData(UserLocatorVO locator) throws FrameworkException
Description copied from interface:PinServiceReturns data regarding pins for the given user (null resolves to the logged user).- Specified by:
getDatain interfacePinService- Throws:
FrameworkException
-
getEditData
public PinData getEditData(PinLocatorVO locator) throws FrameworkException
Description copied from interface:PinServiceReturns data for editing a pin.- Specified by:
getEditDatain interfacePinService- Parameters:
locator- Optional if authenticated with a pin. Otherwise it must not be null.- Throws:
FrameworkException
-
getPasswordInputForCreate
public PasswordInputDTO getPasswordInputForCreate() throws FrameworkException
Description copied from interface:PinServiceReturn the password input required to create a pin for the logged user.- Specified by:
getPasswordInputForCreatein interfacePinService- Throws:
FrameworkException
-
list
public List<PinVO> list(UserLocatorVO locator) throws FrameworkException
Description copied from interface:PinServiceReturns the list of device pins for the given user (null resolves to the logged user).
Manager users must have thePermission.USER_PINS_VIEWpermission.- Specified by:
listin interfacePinService- Throws:
FrameworkException
-
locate
public PinDetailedVO locate(PinLocatorVO locator)
Description copied from interface:PinServiceLocates a device pin, either by id or principal. For users other than the pin's owner (admin / brokers) thePermission.USER_PINS_VIEWpermission must be granted- Specified by:
locatein interfacePinService- Parameters:
locator- Optional if authenticated with a pin. Otherwise it must not be null.
-
remove
public void remove(PinLocatorVO locator, CurrentCredentialsForPinManage currentCredentials) throws FrameworkException
Description copied from interface:PinServiceRemoves the given pin. For managers (admin / brokers) thePermission.USER_PINS_MANAGEpermission must be granted. For the pin owner the action must be confirmed with the current login password for the current channel or the current pin. Only one of these is mandatory to be given.- Specified by:
removein interfacePinService- Parameters:
locator- Optional if authenticated with a pin. Otherwise it must not be null.- Throws:
FrameworkException
-
save
public void save(PinDTO dto) throws FrameworkException
Description copied from interface:PinServiceUpdates a given device pin for the logged user. It will be used from the mobile in the settings page. The given pin's name must be unique, otherwise it throws aValidationException- Specified by:
savein interfacePinService- Throws:
FrameworkException
-
set
public CreatePinDTO set(SetPinParams params) throws FrameworkException
Description copied from interface:PinServiceCreates a new pin or modify an existing for the logged user and associates it to the current principal type and password type. The result will contain the generated principal and a salt that must be prepended to the pin entered by the user when login. In case of a modification the current pin or login password must be given.- Specified by:
setin interfacePinService- Throws:
FrameworkException
-
validate
public ValidationResult validate(@NotNull @NotNull String value) throws FrameworkException
Description copied from interface:PinServiceValidates a value to be used as a pin for the logged user and the current channel.- Specified by:
validatein interfacePinService- Returns:
- null if the value is valid. Otherwise return the validation error.
- 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
-
-