mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.alfresco.repo.publishing.facebook;
|
||||
|
||||
import org.alfresco.repo.node.encryption.MetadataEncryptor;
|
||||
import org.alfresco.repo.publishing.PublishingModel;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
@@ -34,6 +35,7 @@ public class FacebookPublishingHelper
|
||||
{
|
||||
private NodeService nodeService;
|
||||
private FacebookConnectionFactory connectionFactory;
|
||||
private MetadataEncryptor encryptor;
|
||||
|
||||
public void setNodeService(NodeService nodeService)
|
||||
{
|
||||
@@ -50,13 +52,19 @@ public class FacebookPublishingHelper
|
||||
return connectionFactory;
|
||||
}
|
||||
|
||||
public void setEncryptor(MetadataEncryptor encryptor)
|
||||
{
|
||||
this.encryptor = encryptor;
|
||||
}
|
||||
|
||||
public Connection<Facebook> getFacebookConnectionForChannel(NodeRef channelNode)
|
||||
{
|
||||
Connection<Facebook> connection = null;
|
||||
if (nodeService.exists(channelNode)
|
||||
&& nodeService.hasAspect(channelNode, FacebookPublishingModel.ASPECT_DELIVERY_CHANNEL))
|
||||
{
|
||||
String tokenValue = (String) nodeService.getProperty(channelNode, PublishingModel.PROP_OAUTH2_TOKEN);
|
||||
String tokenValue = (String) encryptor.decrypt(PublishingModel.PROP_OAUTH2_TOKEN, nodeService.getProperty(
|
||||
channelNode, PublishingModel.PROP_OAUTH2_TOKEN));
|
||||
Boolean danceComplete = (Boolean) nodeService.getProperty(channelNode, PublishingModel.PROP_AUTHORISATION_COMPLETE);
|
||||
|
||||
if (danceComplete)
|
||||
|
Reference in New Issue
Block a user