Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/SDK/AuthenticationClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ public string GetSessionIdForUserAuthenticationToken(string userAuthenticationTo
return authenticationService.GetSessionIdForUserAuthenticationToken(userAuthenticationToken);
}

public string BuildRedirectToDesignerForUserAuthenticationToken(string userAuthenticationToken, PackageId packageId) {
return authenticationService.BuildRedirectToDesignerForUserAuthenticationToken(userAuthenticationToken, packageId);
public string BuildRedirectToDesignerForUserAuthenticationToken(string userAuthenticationToken, PackageId packageId, string profile = null) {
return authenticationService.BuildRedirectToDesignerForUserAuthenticationToken(userAuthenticationToken, packageId, profile);
}

public string GetSessionIdForSenderAuthenticationToken(string senderAuthenticationToken) {
return authenticationService.GetSessionIdForSenderAuthenticationToken(senderAuthenticationToken);
}

public string BuildRedirectToDesignerForSender(string senderAuthenticationToken, PackageId packageId) {
return authenticationService.BuildRedirectToDesignerForSender(senderAuthenticationToken, packageId);
public string BuildRedirectToDesignerForSender(string senderAuthenticationToken, PackageId packageId, string profile = null) {
return authenticationService.BuildRedirectToDesignerForSender(senderAuthenticationToken, packageId, profile);
}

public string BuildRedirectToPackageViewForSender(string userAuthenticationToken, PackageId packageId) {
Expand Down
2 changes: 1 addition & 1 deletion src/SDK/Internal/UrlTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public class UrlTemplate
public static readonly string AUTHENTICATION_PATH_FOR_SIGNER_AUTHENTICATION_TOKEN_WITH_REDIRECT = "?signerAuthenticationToken={signerAuthenticationToken}&target={redirectUrl}";

// Webpage redirect urls
public static readonly string DESIGNER_REDIRECT_PATH = "/designer/{packageId}";
public static readonly string DESIGNER_REDIRECT_PATH = "/transaction/{packageId}/designer";
public static readonly string PACKAGE_VIEW_REDIRECT_PATH = "/packages/{packageId}";
public static readonly string SIGNING_REDIRECT_PATH = "/transaction/{packageId}/sign";

Expand Down
22 changes: 19 additions & 3 deletions src/SDK/Services/AuthenticationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,21 @@ public string GetSessionIdForUserAuthenticationToken(string userAuthenticationTo
}
}

public string BuildRedirectToDesignerForUserAuthenticationToken(string userAuthenticationToken, PackageId packageId)
public string BuildRedirectToDesignerForUserAuthenticationToken(string userAuthenticationToken, PackageId packageId, string profile)
{
try {
string redirectPath = webpageTemplate.UrlFor(UrlTemplate.DESIGNER_REDIRECT_PATH)
.Replace("{packageId}", packageId.Id)
.Build();
string encodedRedirectPath = HttpUtility.UrlEncode(redirectPath);

if (!string.IsNullOrWhiteSpace(profile))
{
redirectPath = redirectPath.Contains("?") ?
$"{redirectPath}&profile={profile}" :
$"{redirectPath}?profile={profile}";
}

string encodedRedirectPath = HttpUtility.UrlEncode(redirectPath);
string path = authenticationTemplate.UrlFor(UrlTemplate.AUTHENTICATION_PATH_FOR_USER_AUTHENTICATION_TOKEN_WITH_REDIRECT)
.Replace("{authenticationToken}", userAuthenticationToken)
.Replace("{redirectUrl}", encodedRedirectPath)
Expand Down Expand Up @@ -80,12 +88,20 @@ public string GetSessionIdForSenderAuthenticationToken(string senderAuthenticati
}
}

public string BuildRedirectToDesignerForSender(string senderAuthenticationToken, PackageId packageId)
public string BuildRedirectToDesignerForSender(string senderAuthenticationToken, PackageId packageId, string profile)
{
try {
string redirectPath = webpageTemplate.UrlFor(UrlTemplate.DESIGNER_REDIRECT_PATH)
.Replace("{packageId}", packageId.Id)
.Build();

if (!string.IsNullOrWhiteSpace(profile))
{
redirectPath = redirectPath.Contains("?") ?
$"{redirectPath}&profile={profile}" :
$"{redirectPath}?profile={profile}";
}

string encodedRedirectPath = HttpUtility.UrlEncode(redirectPath);
string path = authenticationTemplate.UrlFor(UrlTemplate.AUTHENTICATION_PATH_FOR_SENDER_AUTHENTICATION_TOKEN_WITH_REDIRECT)
.Replace("{senderAuthenticationToken}", senderAuthenticationToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public DownloadedFile DownloadAttachmentFile(string packageId, string attachment

public DownloadedFile DownloadAttachmentFile(string packageId, string attachmentId, Int32 fileId)
{
string path = template.UrlFor(UrlTemplate.ATTACHMENT_REQUIREMENT_PATH)
string path = template.UrlFor(UrlTemplate.ATTACHMENT_FILE_PATH)
.Replace("{packageId}", packageId)
.Replace("{attachmentId}", attachmentId)
.Replace("{fileId}", fileId.ToString())
Expand Down