Class RemoteCredentialsServiceImpl
- java.lang.Object
-
- org.alfresco.repo.remotecredentials.RemoteCredentialsServiceImpl
-
- All Implemented Interfaces:
RemoteCredentialsService
public class RemoteCredentialsServiceImpl extends java.lang.Object implements RemoteCredentialsService
An Implementation of theRemoteCredentialsService- Since:
- Odin
- Author:
- Nick Burch
-
-
Constructor Summary
Constructors Constructor Description RemoteCredentialsServiceImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BaseCredentialsInfocreatePersonCredentials(java.lang.String remoteSystem, BaseCredentialsInfo credentials)Stores a newBaseCredentialsInfofor the current userBaseCredentialsInfocreateSharedCredentials(java.lang.String remoteSystem, BaseCredentialsInfo credentials)Stores a newBaseCredentialsInfofor shared use.voiddeleteCredentials(BaseCredentialsInfo credentialsInfo)Deletes an existingBaseCredentialsInfofrom the repositoryprotected java.util.Map<org.alfresco.service.namespace.QName,RemoteCredentialsInfoFactory>getCredentialsFactories()Provides a read only copy of the credentials factories, useful in unit testsBaseCredentialsInfogetPersonCredentials(java.lang.String remoteSystem)Fetches the credentials for the current user for the specified System.protected org.alfresco.service.cmr.repository.NodeRefgetSharedContainerNodeRef(boolean required)Gets the NodeRef of the holder of shared credentials remote systems.protected static java.lang.StringgetSharedCredentialsSystemContainerName()Unit testing use only!protected static org.alfresco.service.namespace.QNamegetSharedCredentialsSystemContainerQName()org.alfresco.query.PagingResults<? extends BaseCredentialsInfo>listAllCredentials(java.lang.String remoteSystem, org.alfresco.service.namespace.QName credentialsType, org.alfresco.query.PagingRequest paging)Lists all Credentials that the user has access to for the given Remote Systemorg.alfresco.query.PagingResults<java.lang.String>listAllRemoteSystems(org.alfresco.query.PagingRequest paging)Lists all the Remote Systems for which the user has credentials, either personal ones or shared onesorg.alfresco.query.PagingResults<? extends BaseCredentialsInfo>listPersonCredentials(java.lang.String remoteSystem, org.alfresco.service.namespace.QName credentialsType, org.alfresco.query.PagingRequest paging)Lists all Credentials for the current user for the given Remote Systemorg.alfresco.query.PagingResults<java.lang.String>listPersonRemoteSystems(org.alfresco.query.PagingRequest paging)Lists all Remote Systems for which credentials are stored for the current userorg.alfresco.query.PagingResults<? extends BaseCredentialsInfo>listSharedCredentials(java.lang.String remoteSystem, org.alfresco.service.namespace.QName credentialsType, org.alfresco.query.PagingRequest paging)Lists all Credentials that are shared with the current user for the given Remote Systemorg.alfresco.query.PagingResults<java.lang.String>listSharedRemoteSystems(org.alfresco.query.PagingRequest paging)Lists all Remote Systems for which the user has access to shared credentialsvoidregisterCredentialsFactory(org.alfresco.service.namespace.QName credentialsType, RemoteCredentialsInfoFactory factory)Registers a new Factory to produceBaseCredentialsInfoobjects for a given data type.voidsetCredentialsFactories(java.util.Map<java.lang.String,RemoteCredentialsInfoFactory> factories)Registers a number of new factoriesvoidsetDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)voidsetNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)voidsetNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)voidsetPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)voidsetRepositoryHelper(Repository repositoryHelper)protected static voidsetSharedCredentialsSystemContainerName(java.lang.String container)Unit testing use only! Used to avoid tests affecting the real system containerBaseCredentialsInfoupdateCredentials(BaseCredentialsInfo credentials)Updates an existingBaseCredentialsInfo.BaseCredentialsInfoupdateCredentialsAuthenticationSucceeded(boolean succeeded, BaseCredentialsInfo credentials)Records if the most recent Authentication attempt with a given set of credentials worked or not.
-
-
-
Method Detail
-
setNodeService
public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
-
setNamespaceService
public void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)
-
setPermissionService
public void setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)
-
setDictionaryService
public void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
-
setRepositoryHelper
public void setRepositoryHelper(Repository repositoryHelper)
-
setCredentialsFactories
public void setCredentialsFactories(java.util.Map<java.lang.String,RemoteCredentialsInfoFactory> factories)
Registers a number of new factories
-
registerCredentialsFactory
public void registerCredentialsFactory(org.alfresco.service.namespace.QName credentialsType, RemoteCredentialsInfoFactory factory)Registers a new Factory to produceBaseCredentialsInfoobjects for a given data type. This provides an alternative tosetCredentialsFactories(Map)to allow the registering of a new type without overriding all of them.- Parameters:
credentialsType- The object typefactory- The Factory to use to create this type with
-
getCredentialsFactories
protected java.util.Map<org.alfresco.service.namespace.QName,RemoteCredentialsInfoFactory> getCredentialsFactories()
Provides a read only copy of the credentials factories, useful in unit tests
-
getSharedContainerNodeRef
protected org.alfresco.service.cmr.repository.NodeRef getSharedContainerNodeRef(boolean required)
Gets the NodeRef of the holder of shared credentials remote systems. This is stored under system Protected, so that unit tests can make use of it
-
deleteCredentials
public void deleteCredentials(BaseCredentialsInfo credentialsInfo)
Description copied from interface:RemoteCredentialsServiceDeletes an existingBaseCredentialsInfofrom the repository- Specified by:
deleteCredentialsin interfaceRemoteCredentialsService
-
createPersonCredentials
public BaseCredentialsInfo createPersonCredentials(java.lang.String remoteSystem, BaseCredentialsInfo credentials)
Description copied from interface:RemoteCredentialsServiceStores a newBaseCredentialsInfofor the current user- Specified by:
createPersonCredentialsin interfaceRemoteCredentialsService
-
createSharedCredentials
public BaseCredentialsInfo createSharedCredentials(java.lang.String remoteSystem, BaseCredentialsInfo credentials)
Description copied from interface:RemoteCredentialsServiceStores a newBaseCredentialsInfofor shared use. Permissions should then be set to control access to these.- Specified by:
createSharedCredentialsin interfaceRemoteCredentialsService
-
getPersonCredentials
public BaseCredentialsInfo getPersonCredentials(java.lang.String remoteSystem)
Description copied from interface:RemoteCredentialsServiceFetches the credentials for the current user for the specified System. If multiple credentials exist, the first is returned, so this should only be used for systems where a user is restricted to only one set of credentials per system.- Specified by:
getPersonCredentialsin interfaceRemoteCredentialsService- Returns:
- The Credentials, or Null if none exist for the current user
-
updateCredentials
public BaseCredentialsInfo updateCredentials(BaseCredentialsInfo credentials)
Description copied from interface:RemoteCredentialsServiceUpdates an existingBaseCredentialsInfo. The type must not change.- Specified by:
updateCredentialsin interfaceRemoteCredentialsService
-
updateCredentialsAuthenticationSucceeded
public BaseCredentialsInfo updateCredentialsAuthenticationSucceeded(boolean succeeded, BaseCredentialsInfo credentials)
Description copied from interface:RemoteCredentialsServiceRecords if the most recent Authentication attempt with a given set of credentials worked or not.- Specified by:
updateCredentialsAuthenticationSucceededin interfaceRemoteCredentialsService
-
listAllRemoteSystems
public org.alfresco.query.PagingResults<java.lang.String> listAllRemoteSystems(org.alfresco.query.PagingRequest paging)
Description copied from interface:RemoteCredentialsServiceLists all the Remote Systems for which the user has credentials, either personal ones or shared ones- Specified by:
listAllRemoteSystemsin interfaceRemoteCredentialsService
-
listPersonRemoteSystems
public org.alfresco.query.PagingResults<java.lang.String> listPersonRemoteSystems(org.alfresco.query.PagingRequest paging)
Description copied from interface:RemoteCredentialsServiceLists all Remote Systems for which credentials are stored for the current user- Specified by:
listPersonRemoteSystemsin interfaceRemoteCredentialsService
-
listSharedRemoteSystems
public org.alfresco.query.PagingResults<java.lang.String> listSharedRemoteSystems(org.alfresco.query.PagingRequest paging)
Description copied from interface:RemoteCredentialsServiceLists all Remote Systems for which the user has access to shared credentials- Specified by:
listSharedRemoteSystemsin interfaceRemoteCredentialsService
-
listSharedCredentials
public org.alfresco.query.PagingResults<? extends BaseCredentialsInfo> listSharedCredentials(java.lang.String remoteSystem, org.alfresco.service.namespace.QName credentialsType, org.alfresco.query.PagingRequest paging)
Description copied from interface:RemoteCredentialsServiceLists all Credentials that are shared with the current user for the given Remote System- Specified by:
listSharedCredentialsin interfaceRemoteCredentialsService- Parameters:
remoteSystem- The Remote System to return credentials forcredentialsType- Optional type (including child subtypes) of the credentials to filter by
-
listPersonCredentials
public org.alfresco.query.PagingResults<? extends BaseCredentialsInfo> listPersonCredentials(java.lang.String remoteSystem, org.alfresco.service.namespace.QName credentialsType, org.alfresco.query.PagingRequest paging)
Description copied from interface:RemoteCredentialsServiceLists all Credentials for the current user for the given Remote System- Specified by:
listPersonCredentialsin interfaceRemoteCredentialsService- Parameters:
remoteSystem- The Remote System to return credentials forcredentialsType- Optional type (including child subtypes) of the credentials to filter by
-
listAllCredentials
public org.alfresco.query.PagingResults<? extends BaseCredentialsInfo> listAllCredentials(java.lang.String remoteSystem, org.alfresco.service.namespace.QName credentialsType, org.alfresco.query.PagingRequest paging)
Description copied from interface:RemoteCredentialsServiceLists all Credentials that the user has access to for the given Remote System- Specified by:
listAllCredentialsin interfaceRemoteCredentialsService- Parameters:
remoteSystem- The Remote System to return credentials forcredentialsType- Optional type (including child subtypes) of the credentials to filter by
-
getSharedCredentialsSystemContainerName
protected static java.lang.String getSharedCredentialsSystemContainerName()
Unit testing use only!
-
getSharedCredentialsSystemContainerQName
protected static org.alfresco.service.namespace.QName getSharedCredentialsSystemContainerQName()
-
setSharedCredentialsSystemContainerName
protected static void setSharedCredentialsSystemContainerName(java.lang.String container)
Unit testing use only! Used to avoid tests affecting the real system container
-
-