Skip to content

Commit 95108a6

Browse files
committed
2 parents 833f9cc + cdd83f1 commit 95108a6

File tree

20 files changed

+1773
-1563
lines changed

20 files changed

+1773
-1563
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ dotnet_diagnostic.SA1651.severity = error
346346
dotnet_diagnostic.SA1648.severity = error
347347

348348
# SA1649: File name should match first type name
349-
dotnet_diagnostic.SA1649.severity = error
349+
dotnet_diagnostic.SA1649.severity = suggestion
350350

351351
# SA1640: File header should have valid company text
352352
dotnet_diagnostic.SA1640.severity = error

ExamplesAPIType.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ public enum ExamplesApiType
3737
/// </summary>
3838
[Description("aeg")]
3939
Admin = 4,
40+
41+
/// <summary>
42+
/// Connect API
43+
/// </summary>
44+
[Description("con")]
45+
Connect = 5,
4046
}
4147

4248
public static class ExamplesApiTypeExtensions

ExamplesApiTypeExtensions.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ public enum ExamplesApiType
3737
/// </summary>
3838
[Description("aeg")]
3939
Admin = 4,
40+
41+
/// <summary>
42+
/// Connect API
43+
/// </summary>
44+
[Description("con")]
45+
Connect = 5,
4046
}
4147

4248
public static class ExamplesApiTypeExtensions

JWT-Console/App.config.Example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
<add key="ClientId" value="{INTEGRATION_KEY_JWT}"/>
55
<add key="AuthServer" value="account-d.docusign.com"/>
66
<add key="ImpersonatedUserID" value="{IMPERSONATED_USER_ID}"/>
7-
<add key="PrivateKeyFile" value="..\..\..\private.key"/>
7+
<add key="PrivateKeyFile" value="../../../private.key"/>
88
</appSettings>
99
</configuration>

JWT-Console/JWT-Console.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
</ItemGroup>
1919

2020
<ItemGroup>
21-
<Compile Include="..\ExamplesApiTypeExtensions.cs" Link="ExamplesApiTypeExtensions.cs" />
2221
<Compile Include="..\DSHelper.cs" Link="DSHelper.cs" />
22+
<Compile Include="..\ExamplesAPIType.cs" Link="ExamplesAPIType.cs" />
2323
<Compile Include="..\JWTAuth.cs" Link="JWTAuth.cs" />
2424
<Compile Include="..\launcher-csharp\eSignature\Examples\SigningViaEmail.cs" Link="SigningViaEmail.cs" />
2525
</ItemGroup>

JWT-Console/Program.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,14 @@ static void Main(string[] args)
4242
// build a URL to provide consent for this Integration Key and this userId
4343
string url = "https://" + ConfigurationManager.AppSettings["AuthServer"] + "/oauth/auth?response_type=code" + caret + "&scope=impersonation%20signature" + caret +
4444
"&client_id=" + ConfigurationManager.AppSettings["ClientId"] + caret + "&redirect_uri=" + DevCenterPage;
45-
Console.WriteLine($"Consent is required - launching browser (URL is {url.Replace(caret, "")})");
45+
46+
string consentRequiredMessage = $"Consent is required - launching browser (URL is {url})";
47+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
48+
{
49+
consentRequiredMessage = consentRequiredMessage.Replace(caret, "");
50+
}
51+
52+
Console.WriteLine(consentRequiredMessage);
4653

4754
// Start new browser window for login and consent to this app by DocuSign user
4855
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))

Quick_ACG/Quick_ACG.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</ItemGroup>
1818

1919
<ItemGroup>
20-
<Compile Include="..\ExamplesApiTypeExtensions.cs" Link="ExamplesApiTypeExtensions.cs" />
20+
<Compile Include="..\ExamplesAPIType.cs" Link="ExamplesAPIType.cs" />
2121
<Compile Include="..\launcher-csharp\Common\SetViewBagAttribute.cs" Link="Common\SetViewBagAttribute.cs" />
2222
<Compile Include="..\launcher-csharp\EmbeddedSigningCeremony.cs" Link="EmbeddedSigningCeremony.cs" />
2323
<Compile Include="..\launcher-csharp\eSignature\Controllers\EmbeddedSigningCeremony.cs" Link="eSignature\Controllers\EmbeddedSigningCeremony.cs" />

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,13 @@ Also, in order to select JSON Web Token authentication in the launcher, in launc
117117
1. When prompted, log in to your DocuSign developer account. If this is your first time using the app, select **ACCEPT** at the consent window.
118118
1. Select your desired code example.
119119

120+
## Authorization Code Grant embedded signing example:
121+
1. Double click the Quick_ACG.csproj (or Quick_ACG-2019.csproj for VS 2109) file in the Quick_ACG folder of your Quickstart project.
122+
1. Select the green Play IIS Express button.
123+
120124
## JWT grant remote signing project
121-
See [DocuSign Quickstart overview](https://developers.docusign.com/docs/esign-rest-api/quickstart/overview/) on the DocuSign Developer Center for more information on how to run the JWT grant remote signing project.
125+
1. Double click the JWT-Console.csproj (or JWT-Console-2019.csproj for VS 2109) file in the JWT-Console folder of your Quickstart project.
126+
1. Select the green Play JWT Console button.
122127

123128
## Payments code example
124129
To use the payments code example, create a test payment gateway on the [Payments](https://admindemo.docusign.com/authenticate?goTo=payments) page in your developer account. See [Configure a payment gateway](./PAYMENTS_INSTALLATION.md) for details.
@@ -133,4 +138,4 @@ This repository uses the MIT License. See [LICENSE](./LICENSE) for details.
133138

134139
### Pull Requests
135140
Pull requests are welcomed. Pull requests will only be considered if their content
136-
uses the MIT License.
141+
uses the MIT License.

launcher-csharp/Common/RequestItemsService.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,10 @@ public string IdentifyApiOfCodeExample(string eg)
251251
{
252252
currentApiType = ExamplesApiType.Admin.ToString();
253253
}
254+
else if (eg.Contains(ExamplesApiType.Connect.ToKeywordString()))
255+
{
256+
currentApiType = ExamplesApiType.Connect.ToString();
257+
}
254258
else
255259
{
256260
currentApiType = ExamplesApiType.ESignature.ToString();
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// <copyright file="ValidateWebhookMessage.cs" company="DocuSign">
2+
// Copyright (c) DocuSign. All rights reserved.
3+
// </copyright>
4+
5+
namespace DocuSign.CodeExamples.Connect.Controllers
6+
{
7+
using DocuSign.CodeExamples.Common;
8+
using DocuSign.CodeExamples.Controllers;
9+
using DocuSign.CodeExamples.Models;
10+
using DocuSign.Connect.Examples;
11+
using Microsoft.AspNetCore.Mvc;
12+
13+
[Area("Connect")]
14+
[Route("con001")]
15+
public class ValidateWebhookMessage : EgController
16+
{
17+
public ValidateWebhookMessage(DsConfiguration config, LauncherTexts launcherTexts, IRequestItemsService requestItemsService)
18+
: base(config, launcherTexts, requestItemsService)
19+
{
20+
this.CodeExampleText = this.GetExampleText(this.EgName, ExamplesApiType.Connect);
21+
this.ViewBag.title = this.CodeExampleText.ExampleName;
22+
}
23+
24+
public override string EgName => "con001";
25+
26+
[SetViewBag]
27+
[HttpPost]
28+
[ValidateAntiForgeryToken]
29+
public ActionResult ValidateMessageUsing(string hmacSecret, string jsonPayload)
30+
{
31+
jsonPayload = jsonPayload.Replace("\\", string.Empty);
32+
33+
string hashedOutput = HMACValidation.ComputeHash(hmacSecret, jsonPayload);
34+
35+
this.ViewBag.h1 = this.CodeExampleText.ExampleName;
36+
this.ViewBag.message = this.CodeExampleText.ResultsPageText.Replace("{0}", hashedOutput);
37+
38+
return this.View("example_done");
39+
}
40+
}
41+
}

0 commit comments

Comments
 (0)