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

@@ -15,6 +15,7 @@
<dt>channelId</dt><dd>the identifier of the publishing channel</dd>
<dt>authoriseUrl</dt> <dd>The URL to send the user to in order for them to authorise access to the channel</dd>
<dt>authCallbackUrl</dt> <dd>The URL to return the channel authorisation details to</dd>
<dt>authRedirectUrl</dt> <dd>The URL that the channel service provider will try to redirect the user to</dd>
</dl>
]]></description>
<url>/api/publishing/channels/{store_protocol}/{store_id}/{node_id}/reauthorise</url>
@@ -47,6 +48,7 @@
"channelId": string,
"authoriseUrl": string
"authCallbackUrl": string
"authRedirectUrl": string
}
}
]]>

View File

@@ -15,6 +15,7 @@
<dt>pollUrl</dt> <dd>The URL to poll to discover whether the channel has been authorised</dd>
<dt>authoriseUrl</dt> <dd>The URL to send the user to in order for them to authorise access to the channel</dd>
<dt>authCallbackUrl</dt> <dd>The URL to return the channel authorisation details to</dd>
<dt>authRedirectUrl</dt> <dd>The URL to which the channel service provider will redirect the user upon authorisation</dd>
</dl>
]]></description>
@@ -49,6 +50,7 @@
"channelId": string,
"authoriseUrl": string
"authCallbackUrl": string
"authRedirectUrl": string
}
}
]]>

View File

@@ -153,6 +153,7 @@
"channelId" : "${channelId}",
"authoriseUrl": "${authoriseUrl}",
"authCallbackUrl": "${authCallbackUrl}"
"authRedirectUrl": "${authRedirectUrl}"
}
</#escape>
</#macro>

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;
}
}