Package org.cyclos.security.access
Class AccessClientServiceSecurity
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.security.BaseServiceSecurity
-
- org.cyclos.security.CRUDServiceSecurity<AccessClientDTO,AccessClient,AccessClientData,AccessClientDataParams>
-
- org.cyclos.security.access.AccessClientServiceSecurity
-
- All Implemented Interfaces:
AccessClientService,CRUDService<AccessClientDTO,AccessClientData,AccessClientDataParams>,CRUDWithConfirmationPasswordService<AccessClientDTO,AccessClientData,AccessClientDataParams>,Service
@Security public class AccessClientServiceSecurity extends CRUDServiceSecurity<AccessClientDTO,AccessClient,AccessClientData,AccessClientDataParams> implements AccessClientService
Security layer forAccessClientService
-
-
Field Summary
-
Fields inherited from class org.cyclos.security.CRUDServiceSecurity
entityClass
-
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 AccessClientServiceSecurity()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ActivateAccessClientDTOactivate(String activationCode, String prefix)Activates an access client for the current user, using the given activation code.voidblock(AccessClientActionParams params)Blocks the given an access clientprotected voidcheckCreateNew(AccessClientDataParams params)Checks whether creating new entities with the given context parameters is allowed, throwingPermissionDeniedExceptionif notprotected voidcheckSearch()protected voidcustomizeData(AccessClientData data)Can be overridden in order to process the returned data object for the given entityprotected booleandoHasAccess(AccessClient entity, com.querydsl.core.types.Path<Boolean> path)protected booleandoHasAccess(AccessClient entity, com.querydsl.core.types.Path<Boolean> path, boolean forCreate)protected booleandoHasAccess(User user, AccessClientPrincipalType type, com.querydsl.core.types.Path<Boolean> path)protected booleandoHasAccess(User user, AccessClientPrincipalType type, com.querydsl.core.types.Path<Boolean> path, boolean forCreate)protected booleandoHasManageAccess(AccessClient entity)Should be implemented in order to return whether the caller is allowed to manage the given entity, for the given operationbooleandoHasViewAccess(AccessClient entity)Should be implemented in order to return whether the caller is allowed to view the given entity.StringgetActivationCode(AccessClientActionParams params)Returns the code which can be used to activate the access client, connecting an applicationprotected CRUDServiceLocal<AccessClient,AccessClientDTO,AccessClientData,AccessClientDataParams>getImplementation()Should be implemented in order to return the actual implementation of the serviceAccessClientsListDatagetListData(PrincipalTypeVO principalTypeVO, UserLocatorVO locator)Returns data for listing access clients of a given type and userAccessClientsSearchDatagetSearchData()Returns data for searching access clientsList<AccessClientTypeData>getTypeData(UserLocatorVO locator, ChannelVO channel)Returns data each access client type the authenticated user can see for the given user.booleanisAccessible(SessionData sessionData, AccessClient entity)Must be implemented in order to determine whether the given entity is accessible for the given session data.AccessClientVOlocate(AccessClientLocatorVO locator)Returns an access client by either id or token, but only if it belongs (or is managed by) the authenticated userPage<AccessClientDetailedVO>search(AccessClientQuery query)Searches for access clients according to the given criteriavoidunassign(AccessClientActionParams params)Unassigns the given access client from its connected applicationbooleanunassignCurrent(ActionWithConfirmationPassword action)Unassigns the access client in the current authorization.voidunblock(AccessClientActionParams params)Unblocks the given access client-
Methods inherited from class org.cyclos.security.CRUDServiceSecurity
canPerformOperation, canViewData, checkManageAccess, checkOperation, checkSave, checkViewAccess, find, getConfirmationPasswordInputForRemove, getData, getDataForNew, getEntityClass, hasManageAccess, hasViewAccess, load, onBeforeSave, remove, removeAll, removeAllWithConfirmationPassword, removeWithConfirmationPassword, resolveEntityCheck, save, saveWithConfirmationPassword
-
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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.cyclos.services.CRUDService
getData, getDataForNew, load, remove, removeAll, save
-
-
-
-
Method Detail
-
activate
public ActivateAccessClientDTO activate(String activationCode, String prefix) throws FrameworkException
Description copied from interface:AccessClientServiceActivates an access client for the current user, using the given activation code. It is possible to pass in a prefix (optional) to have it appended before the activation code itself. Returns a dto containing the principal type and a token which is then used to identify the remote application. The prefix is not returned. So, if for example, "123" is passed as prefix, and "ABCDEF", the token needed to be used on web service requests will be "123ABCDEF", but only "ABCDEF" is returned. If the prefix is null, no prefix is used.- Specified by:
activatein interfaceAccessClientService- Throws:
FrameworkException
-
block
public void block(AccessClientActionParams params) throws FrameworkException
Description copied from interface:AccessClientServiceBlocks the given an access client- Specified by:
blockin interfaceAccessClientService- Throws:
IllegalActionException- When the status is not activeFrameworkException
-
doHasViewAccess
public boolean doHasViewAccess(AccessClient entity)
Description copied from class:CRUDServiceSecurityShould be implemented in order to return whether the caller is allowed to view the given entity.- Specified by:
doHasViewAccessin classCRUDServiceSecurity<AccessClientDTO,AccessClient,AccessClientData,AccessClientDataParams>
-
getActivationCode
public String getActivationCode(AccessClientActionParams params) throws FrameworkException
Description copied from interface:AccessClientServiceReturns the code which can be used to activate the access client, connecting an application- Specified by:
getActivationCodein interfaceAccessClientService- Throws:
IllegalActionException- When the status is not unassignedFrameworkException
-
getListData
public AccessClientsListData getListData(PrincipalTypeVO principalTypeVO, UserLocatorVO locator) throws FrameworkException
Description copied from interface:AccessClientServiceReturns data for listing access clients of a given type and user- Specified by:
getListDatain interfaceAccessClientService- Throws:
FrameworkException
-
getSearchData
public AccessClientsSearchData getSearchData() throws FrameworkException
Description copied from interface:AccessClientServiceReturns data for searching access clients- Specified by:
getSearchDatain interfaceAccessClientService- Throws:
FrameworkException
-
getTypeData
public List<AccessClientTypeData> getTypeData(UserLocatorVO locator, ChannelVO channel) throws FrameworkException
Description copied from interface:AccessClientServiceReturns data each access client type the authenticated user can see for the given user. If a channel is passed in, will only return types that can be used to access it.- Specified by:
getTypeDatain interfaceAccessClientService- Throws:
FrameworkException
-
isAccessible
public boolean isAccessible(SessionData sessionData, AccessClient entity)
Description copied from class:CRUDServiceSecurityMust be implemented in order to determine whether the given entity is accessible for the given session data. This method shouldn't check the same condition asCRUDServiceSecurity.hasViewAccess(BaseEntity). If the only condition for an entity isCRUDServiceSecurity.hasViewAccess(BaseEntity), this method should return false.- Specified by:
isAccessiblein classCRUDServiceSecurity<AccessClientDTO,AccessClient,AccessClientData,AccessClientDataParams>
-
locate
public AccessClientVO locate(AccessClientLocatorVO locator) throws FrameworkException
Description copied from interface:AccessClientServiceReturns an access client by either id or token, but only if it belongs (or is managed by) the authenticated user- Specified by:
locatein interfaceAccessClientService- Throws:
FrameworkException
-
search
public Page<AccessClientDetailedVO> search(AccessClientQuery query) throws FrameworkException
Description copied from interface:AccessClientServiceSearches for access clients according to the given criteria- Specified by:
searchin interfaceAccessClientService- Throws:
FrameworkException
-
unassign
public void unassign(AccessClientActionParams params) throws FrameworkException
Description copied from interface:AccessClientServiceUnassigns the given access client from its connected application- Specified by:
unassignin interfaceAccessClientService- Throws:
IllegalActionException- When the status is unassignedFrameworkException
-
unassignCurrent
public boolean unassignCurrent(ActionWithConfirmationPassword action) throws FrameworkException
Description copied from interface:AccessClientServiceUnassigns the access client in the current authorization. No-op if not authorized as an access client. Returns true if an access client was found associated to the current session.- Specified by:
unassignCurrentin interfaceAccessClientService- Throws:
FrameworkException
-
unblock
public void unblock(AccessClientActionParams params) throws FrameworkException
Description copied from interface:AccessClientServiceUnblocks the given access client- Specified by:
unblockin interfaceAccessClientService- Throws:
IllegalActionException- When the status is not blockedFrameworkException
-
checkCreateNew
protected void checkCreateNew(AccessClientDataParams params)
Description copied from class:CRUDServiceSecurityChecks whether creating new entities with the given context parameters is allowed, throwingPermissionDeniedExceptionif not- Specified by:
checkCreateNewin classCRUDServiceSecurity<AccessClientDTO,AccessClient,AccessClientData,AccessClientDataParams>
-
checkSearch
protected void checkSearch()
-
customizeData
protected void customizeData(AccessClientData data)
Description copied from class:CRUDServiceSecurityCan be overridden in order to process the returned data object for the given entity- Overrides:
customizeDatain classCRUDServiceSecurity<AccessClientDTO,AccessClient,AccessClientData,AccessClientDataParams>
-
doHasAccess
protected boolean doHasAccess(AccessClient entity, com.querydsl.core.types.Path<Boolean> path)
-
doHasAccess
protected boolean doHasAccess(AccessClient entity, com.querydsl.core.types.Path<Boolean> path, boolean forCreate)
-
doHasAccess
protected boolean doHasAccess(User user, AccessClientPrincipalType type, com.querydsl.core.types.Path<Boolean> path)
-
doHasAccess
protected boolean doHasAccess(User user, AccessClientPrincipalType type, com.querydsl.core.types.Path<Boolean> path, boolean forCreate)
-
doHasManageAccess
protected boolean doHasManageAccess(AccessClient entity)
Description copied from class:CRUDServiceSecurityShould be implemented in order to return whether the caller is allowed to manage the given entity, for the given operation- Specified by:
doHasManageAccessin classCRUDServiceSecurity<AccessClientDTO,AccessClient,AccessClientData,AccessClientDataParams>
-
getImplementation
protected CRUDServiceLocal<AccessClient,AccessClientDTO,AccessClientData,AccessClientDataParams> getImplementation()
Description copied from class:CRUDServiceSecurityShould be implemented in order to return the actual implementation of the service- Specified by:
getImplementationin classCRUDServiceSecurity<AccessClientDTO,AccessClient,AccessClientData,AccessClientDataParams>
-
-