ALF-11550: Added service provider's redirect URL into JSON response from channels.POST and channel-reauth.POST webscripts. Adjusted the ChannelType interface as necessary to make this possible.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@32575 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Brian Remmington
2011-12-06 16:26:29 +00:00
parent b4c82b3048
commit 6d35044d27
5 changed files with 12 additions and 4 deletions

View File

@@ -90,7 +90,7 @@ public class AuthCallbackWebScript extends DeclarativeWebScript
if (ChannelType.AuthStatus.RETRY.equals(authStatus))
{
String authoriseUrl = channel.getChannelType().getAuthorisationUrl(channel, channelAuthHelper.getAuthoriseCallbackUrl(channelNodeRef));
String authoriseUrl = channel.getChannelType().getAuthorisationUrls(channel, channelAuthHelper.getAuthoriseCallbackUrl(channelNodeRef));
if (authoriseUrl == null)
{
authoriseUrl = channelAuthHelper.getDefaultAuthoriseUrl(channelNodeRef);

View File

@@ -23,6 +23,7 @@ import java.util.TreeMap;
import org.alfresco.repo.admin.SysAdminParams;
import org.alfresco.service.cmr.publishing.channels.Channel;
import org.alfresco.service.cmr.publishing.channels.ChannelType;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.util.UrlUtil;
@@ -71,8 +72,9 @@ public class ChannelAuthHelper
public Map<String, Object> buildAuthorisationModel(Channel channel)
{
String callbackUrl = getAuthoriseCallbackUrl(channel.getNodeRef());
String authoriseUrl = channel.getChannelType().getAuthorisationUrl(channel, callbackUrl);
String alfrescoCallbackUrl = getAuthoriseCallbackUrl(channel.getNodeRef());
ChannelType.AuthUrlPair authUrlPair = channel.getChannelType().getAuthorisationUrls(channel, alfrescoCallbackUrl);
String authoriseUrl = authUrlPair.authorisationRequestUrl;
if (authoriseUrl == null)
{
// If a channel type returns null as the authorise URL then we
@@ -84,7 +86,8 @@ public class ChannelAuthHelper
Map<String, Object> model = new TreeMap<String, Object>();
model.put("authoriseUrl", authoriseUrl);
model.put("channelId", channel.getId());
model.put("authCallbackUrl", callbackUrl);
model.put("authCallbackUrl", alfrescoCallbackUrl);
model.put("authRedirectUrl", authUrlPair.authorisationRedirectUrl);
return model;
}
}