Fix ALF-10402: PUB: Access tokens are not being stored in encrypted properties

- NOTE: this fix means that any existing publishing channels in the repo will cease to work and will cause the publishing generally to have problems. If you have publishing channels in your repo then you must remove them following this fix. This can be done by either cleaning your repo out completely or deleting the node underneath "Data Dictionary/Publishing Root" (it has a UUID as its name).

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30646 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Brian Remmington
2011-09-20 13:49:36 +00:00
parent d8b5f09911
commit 10abd069bc
26 changed files with 419 additions and 204 deletions

View File

@@ -31,6 +31,7 @@ import java.util.Map;
import java.util.TreeMap;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.node.encryption.MetadataEncryptor;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.publishing.channels.Channel;
import org.alfresco.service.cmr.publishing.channels.ChannelService;
@@ -57,6 +58,7 @@ public class ChannelServiceImpl implements ChannelService
private DictionaryService dictionaryService;
private ChannelHelper channelHelper;
private PublishingRootObject rootObject;
private MetadataEncryptor encryptor;
/**
* @param nodeService
@@ -92,6 +94,11 @@ public class ChannelServiceImpl implements ChannelService
this.channelHelper = channelHelper;
}
public void setEncryptor(MetadataEncryptor encryptor)
{
this.encryptor = encryptor;
}
/**
* {@inheritDoc}
*/
@@ -126,7 +133,7 @@ public class ChannelServiceImpl implements ChannelService
String message = "Channel Type: " + channelTypeId + " does not exist!";
throw new IllegalArgumentException(message);
}
HashMap<QName, Serializable> actualProps = new HashMap<QName, Serializable>();
Map<QName, Serializable> actualProps = new HashMap<QName, Serializable>();
if (properties != null)
{
actualProps.putAll(properties);
@@ -134,6 +141,7 @@ public class ChannelServiceImpl implements ChannelService
actualProps.put(ContentModel.PROP_NAME, name);
actualProps.put(PROP_CHANNEL_TYPE_ID, channelType.getId());
actualProps.put(PublishingModel.PROP_AUTHORISATION_COMPLETE, Boolean.FALSE);
actualProps = encryptor.encrypt(actualProps);
NodeRef channelNode = channelHelper.createChannelNode(channelContainer, channelType, name, actualProps);
return channelHelper.buildChannelObject(channelNode, this);
}