Skip to content

Commit 5412a1b

Browse files
committed
Adding new VS2019 files
1 parent 955b108 commit 5412a1b

File tree

5 files changed

+329
-0
lines changed

5 files changed

+329
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net6.0</TargetFramework>
6+
<RootNamespace>JWT_Console</RootNamespace>
7+
<DocuSignAuthType>JWT</DocuSignAuthType>
8+
</PropertyGroup>
9+
10+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
11+
<OutputPath>bin\Debug\net6.0</OutputPath>
12+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
13+
</PropertyGroup>
14+
<ItemGroup>
15+
<Compile Remove="DocuSign\**" />
16+
<EmbeddedResource Remove="DocuSign\**" />
17+
<None Remove="DocuSign\**" />
18+
</ItemGroup>
19+
20+
<ItemGroup>
21+
<Compile Include="..\DSHelper.cs" Link="DSHelper.cs" />
22+
<Compile Include="..\ExamplesAPIType.cs" Link="ExamplesAPIType.cs" />
23+
<Compile Include="..\JWTAuth.cs" Link="JWTAuth.cs" />
24+
<Compile Include="..\launcher-csharp\eSignature\Examples\SigningViaEmail.cs" Link="SigningViaEmail.cs" />
25+
</ItemGroup>
26+
27+
<ItemGroup>
28+
<None Include="..\.editorconfig" Link=".editorconfig" />
29+
</ItemGroup>
30+
31+
<ItemGroup>
32+
<PackageReference Include="DocuSign.eSign.dll" Version="6.0.0" />
33+
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.7.0" />
34+
<PackageReference Include="System.Runtime.Caching" Version="4.7.0" />
35+
</ItemGroup>
36+
37+
</Project>
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<LangVersion>8.0</LangVersion>
6+
<RootNamespace>DocuSign.CodeExamples</RootNamespace>
7+
</PropertyGroup>
8+
9+
<PropertyGroup Condition=" '$(RunConfiguration)' == 'CodeExamples' " />
10+
11+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
12+
<OutputPath>bin\Debug\net6.0</OutputPath>
13+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
14+
</PropertyGroup>
15+
<ItemGroup>
16+
<None Remove="eSignature\Controllers\EgController.cs~RF9bf1e5d.TMP" />
17+
</ItemGroup>
18+
19+
<ItemGroup>
20+
<Compile Include="..\ExamplesAPIType.cs" Link="ExamplesAPIType.cs" />
21+
<Compile Include="..\launcher-csharp\Common\SetViewBagAttribute.cs" Link="Common\SetViewBagAttribute.cs" />
22+
<Compile Include="..\launcher-csharp\EmbeddedSigningCeremony.cs" Link="EmbeddedSigningCeremony.cs" />
23+
<Compile Include="..\launcher-csharp\eSignature\Controllers\Eg001EmbeddedSigningController.cs" Link="eSignature\Controllers\Eg001EmbeddedSigningController.cs" />
24+
<Compile Include="..\launcher-csharp\eSignature\Models\DSConfiguration.cs" Link="eSignature\Models\DSConfiguration.cs" />
25+
<Compile Include="..\launcher-csharp\eSignature\Models\LauncherTexts.cs" Link="eSignature\ModelsForManifest\LauncherTexts.cs" />
26+
<Compile Include="..\launcher-csharp\eSignature\Models\ModelsToReadManifest\AdditionalPage.cs" Link="eSignature\ModelsForManifest\AdditionalPage.cs" />
27+
<Compile Include="..\launcher-csharp\eSignature\Models\ModelsToReadManifest\APIs.cs" Link="eSignature\ModelsForManifest\APIs.cs" />
28+
<Compile Include="..\launcher-csharp\eSignature\Models\ModelsToReadManifest\CodeExampleText.cs" Link="eSignature\ModelsForManifest\CodeExampleText.cs" />
29+
<Compile Include="..\launcher-csharp\eSignature\Models\ModelsToReadManifest\CustomErrorTexts.cs" Link="eSignature\ModelsForManifest\CustomErrorTexts.cs" />
30+
<Compile Include="..\launcher-csharp\eSignature\Models\ModelsToReadManifest\Forms.cs" Link="eSignature\ModelsForManifest\Forms.cs" />
31+
<Compile Include="..\launcher-csharp\eSignature\Models\ModelsToReadManifest\HelpingTexts.cs" Link="eSignature\ModelsForManifest\HelpingTexts.cs" />
32+
<Compile Include="..\launcher-csharp\eSignature\Models\ModelsToReadManifest\Inputs.cs" Link="eSignature\ModelsForManifest\Inputs.cs" />
33+
<Compile Include="..\launcher-csharp\eSignature\Models\ModelsToReadManifest\LinkToAPIMethods.cs" Link="eSignature\ModelsForManifest\LinkToAPIMethods.cs" />
34+
<Compile Include="..\launcher-csharp\eSignature\Models\ModelsToReadManifest\LoginPage.cs" Link="eSignature\ModelsForManifest\LoginPage.cs" />
35+
<Compile Include="..\launcher-csharp\eSignature\Models\ModelsToReadManifest\ManifestGroup.cs" Link="eSignature\ModelsForManifest\ManifestGroup.cs" />
36+
<Compile Include="..\launcher-csharp\eSignature\Models\ModelsToReadManifest\ManifestStructure.cs" Link="eSignature\ModelsForManifest\ManifestStructure.cs" />
37+
<Compile Include="..\launcher-csharp\eSignature\Models\ModelsToReadManifest\RedirectsToOtherCodeExamples.cs" Link="eSignature\ModelsForManifest\RedirectsToOtherCodeExamples.cs" />
38+
<Compile Include="..\launcher-csharp\eSignature\Models\ModelsToReadManifest\SelectAPIPage.cs" Link="eSignature\ModelsForManifest\SelectAPIPage.cs" />
39+
<Compile Include="..\launcher-csharp\eSignature\Models\ModelsToReadManifest\SupportingTexts.cs" Link="eSignature\ModelsForManifest\SupportingTexts.cs" />
40+
<Compile Include="..\launcher-csharp\eSignature\Models\Session.cs" Link="eSignature\Models\Session.cs" />
41+
<Compile Include="..\launcher-csharp\eSignature\Models\User.cs" Link="eSignature\Models\User.cs" />
42+
</ItemGroup>
43+
44+
<ItemGroup>
45+
<None Include="..\.editorconfig" Link=".editorconfig" />
46+
<None Include="..\launcher-csharp\_ViewImports.cshtml" Link="_ViewImports.cshtml" />
47+
</ItemGroup>
48+
49+
<ItemGroup>
50+
<PackageReference Include="DocuSign.eSign.dll" Version="6.0.0" />
51+
<PackageReference Include="Microsoft.AspNetCore.Session" Version="2.2.0" />
52+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.0-preview1.19506.2" />
53+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.0-preview1.19506.2">
54+
<PrivateAssets>all</PrivateAssets>
55+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
56+
</PackageReference>
57+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />
58+
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" />
59+
<PackageReference Include="System.Configuration.ConfigurationManager" Version="5.0.0" />
60+
</ItemGroup>
61+
62+
<ItemGroup>
63+
<Folder Include="eSignature\ModelsForManifest\" />
64+
<Folder Include="wwwroot\css\" />
65+
</ItemGroup>
66+
67+
</Project>

launcher-csharp - VS2019.sln

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.2.32526.322
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "launcher-csharp", "launcher-csharp\launcher-csharp.csproj", "{F6F2A6AC-A907-45EB-BE75-849E2B89E52E}"
7+
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JWT-Console", "JWT-Console\JWT-Console.csproj", "{0AD8FDB1-0A5F-4413-852C-49DD0217BBD0}"
9+
EndProject
10+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Quick_ACG", "Quick_ACG\Quick_ACG.csproj", "{38D6B7E2-7576-4D6D-AAEF-D8167051F2B0}"
11+
EndProject
12+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DB51B51C-3F00-413F-B0FA-1B933BA50D22}"
13+
ProjectSection(SolutionItems) = preProject
14+
.editorconfig = .editorconfig
15+
EndProjectSection
16+
EndProject
17+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "launcher-csharp.Tests", "launcher-csharp.Tests\launcher-csharp.Tests.csproj", "{431C1520-FA9A-4B94-8E41-758EB90B8CC4}"
18+
EndProject
19+
Global
20+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
21+
Debug|Any CPU = Debug|Any CPU
22+
Release|Any CPU = Release|Any CPU
23+
EndGlobalSection
24+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
25+
{F6F2A6AC-A907-45EB-BE75-849E2B89E52E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
26+
{F6F2A6AC-A907-45EB-BE75-849E2B89E52E}.Debug|Any CPU.Build.0 = Debug|Any CPU
27+
{F6F2A6AC-A907-45EB-BE75-849E2B89E52E}.Release|Any CPU.ActiveCfg = Release|Any CPU
28+
{F6F2A6AC-A907-45EB-BE75-849E2B89E52E}.Release|Any CPU.Build.0 = Release|Any CPU
29+
{0AD8FDB1-0A5F-4413-852C-49DD0217BBD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
30+
{0AD8FDB1-0A5F-4413-852C-49DD0217BBD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
31+
{0AD8FDB1-0A5F-4413-852C-49DD0217BBD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
32+
{0AD8FDB1-0A5F-4413-852C-49DD0217BBD0}.Release|Any CPU.Build.0 = Release|Any CPU
33+
{38D6B7E2-7576-4D6D-AAEF-D8167051F2B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
34+
{38D6B7E2-7576-4D6D-AAEF-D8167051F2B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
35+
{38D6B7E2-7576-4D6D-AAEF-D8167051F2B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
36+
{38D6B7E2-7576-4D6D-AAEF-D8167051F2B0}.Release|Any CPU.Build.0 = Release|Any CPU
37+
{431C1520-FA9A-4B94-8E41-758EB90B8CC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
38+
{431C1520-FA9A-4B94-8E41-758EB90B8CC4}.Debug|Any CPU.Build.0 = Debug|Any CPU
39+
{431C1520-FA9A-4B94-8E41-758EB90B8CC4}.Release|Any CPU.ActiveCfg = Release|Any CPU
40+
{431C1520-FA9A-4B94-8E41-758EB90B8CC4}.Release|Any CPU.Build.0 = Release|Any CPU
41+
EndGlobalSection
42+
GlobalSection(SolutionProperties) = preSolution
43+
HideSolutionNode = FALSE
44+
EndGlobalSection
45+
GlobalSection(ExtensibilityGlobals) = postSolution
46+
SolutionGuid = {4D55DE36-4AC1-4E20-8A32-D56A8EF4839C}
47+
EndGlobalSection
48+
EndGlobal
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
using DocuSign.eSign.Client;
2+
using DocuSign.eSign.Client.Auth;
3+
using System;
4+
using Xunit;
5+
using System.Runtime.InteropServices;
6+
using DocuSign.CodeExamples.Authentication;
7+
using DocuSign.CodeExamples.Common;
8+
9+
namespace launcher_csharp.Tests
10+
{
11+
public sealed class JwtLoginMethodUnitTest
12+
{
13+
private const string REDIRECT_URL = "https://developers.docusign.com/platform/auth/consent";
14+
15+
private const string RERUN_UNIT_TESTS = "Please, rerun the unit tests once consent has been provided.";
16+
17+
private const string CONSENT_REQUIRED = "consent_required";
18+
19+
[Theory]
20+
[InlineData(ExamplesAPIType.ESignature)]
21+
[InlineData(ExamplesAPIType.Monitor)]
22+
[InlineData(ExamplesAPIType.Click)]
23+
[InlineData(ExamplesAPIType.Rooms)]
24+
[InlineData(ExamplesAPIType.Admin)]
25+
public void RequestJWTUserToken_CorrectInputParameters_ReturnsOAuthToken(ExamplesAPIType apiType, TestConfig _testConfig = null)
26+
{
27+
_testConfig = _testConfig ?? new TestConfig();
28+
29+
// Arrange
30+
_testConfig.ApiClient = new DocuSignClient(_testConfig.Host);
31+
32+
try
33+
{
34+
// Act
35+
OAuth.OAuthToken tokenInfo = JWTAuth.AuthenticateWithJWT(
36+
apiType.ToString(),
37+
_testConfig.ClientId,
38+
_testConfig.ImpersonatedUserId,
39+
_testConfig.OAuthBasePath,
40+
_testConfig.PrivateKeyBytes
41+
);
42+
43+
OAuth.UserInfo userInfo = _testConfig.ApiClient.GetUserInfo(tokenInfo.access_token);
44+
45+
// Assert
46+
Assert.NotNull(userInfo?.Accounts);
47+
48+
var basePathAddition = "/restapi";
49+
var accountIsDefault = "true";
50+
51+
foreach (OAuth.UserInfo.Account item in userInfo.Accounts)
52+
{
53+
if (item.IsDefault == accountIsDefault)
54+
{
55+
_testConfig.AccountId = item.AccountId;
56+
_testConfig.BasePath = item.BaseUri;
57+
_testConfig.AccessToken = tokenInfo.access_token;
58+
_testConfig.ApiClient.SetBasePath(item.BaseUri + basePathAddition);
59+
break;
60+
}
61+
}
62+
63+
Assert.NotNull(_testConfig?.AccountId);
64+
Assert.NotNull(_testConfig?.BasePath);
65+
Assert.NotNull(_testConfig?.AccessToken);
66+
}
67+
catch (Exception e)
68+
{
69+
if (e.Message.ToLowerInvariant().Contains(CONSENT_REQUIRED))
70+
{
71+
_testConfig?.OpenUrlUsingConsoleWindow(BuildConsentUrl(apiType, _testConfig));
72+
73+
throw new Xunit.Sdk.XunitException(RERUN_UNIT_TESTS);
74+
}
75+
}
76+
}
77+
78+
private string BuildConsentUrl(ExamplesAPIType apiType, TestConfig _testConfig)
79+
{
80+
var scopes = "signature%20impersonation";
81+
if (apiType == ExamplesAPIType.Rooms)
82+
{
83+
scopes += "%20dtr.rooms.read%20dtr.rooms.write%20dtr.documents.read%20dtr.documents.write%20"
84+
+ "dtr.profile.read%20dtr.profile.write%20dtr.company.read%20dtr.company.write%20room_forms";
85+
}
86+
else if (apiType == ExamplesAPIType.Click)
87+
{
88+
scopes += "%20click.manage%20click.send";
89+
}
90+
else if (apiType == ExamplesAPIType.Admin)
91+
{
92+
scopes += "%20user_read%20user_write%20organization_read%20account_read%20group_read%20"
93+
+ "permission_read%20identity_provider_read%20domain_read";
94+
}
95+
96+
string caret = "";
97+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
98+
{
99+
caret = "^";
100+
}
101+
102+
return "https://" + _testConfig.OAuthBasePath + "/oauth/auth?response_type=code" + caret + "&scope=" + scopes
103+
+ caret + "&client_id=" + _testConfig.ClientId + caret + "&redirect_uri=" + REDIRECT_URL;
104+
}
105+
}
106+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<LangVersion>8.0</LangVersion>
6+
</PropertyGroup>
7+
8+
<PropertyGroup Condition=" '$(RunConfiguration)' == 'CodeExamples' " />
9+
10+
11+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
12+
<OutputPath>bin\Debug\net6.0</OutputPath>
13+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
14+
</PropertyGroup>
15+
<ItemGroup>
16+
<Compile Remove="Common\AuthCodeGrant.cs" />
17+
<Compile Remove="Common\JWTAuth.cs" />
18+
</ItemGroup>
19+
20+
<ItemGroup>
21+
<Content Remove="stylecop.json" />
22+
</ItemGroup>
23+
24+
<ItemGroup>
25+
<AdditionalFiles Include="stylecop.json" />
26+
</ItemGroup>
27+
28+
<ItemGroup>
29+
<Compile Include="..\DSHelper.cs" Link="DSHelper.cs" />
30+
<Compile Include="..\ExamplesAPIType.cs" Link="ExamplesAPIType.cs" />
31+
<Compile Include="..\JWTAuth.cs" Link="JWTAuth.cs" />
32+
</ItemGroup>
33+
34+
<ItemGroup>
35+
<None Include="..\.editorconfig" Link=".editorconfig" />
36+
</ItemGroup>
37+
38+
<ItemGroup>
39+
<PackageReference Include="DocuSign.Admin" Version="1.1.0" />
40+
<PackageReference Include="DocuSign.Click" Version="1.2.2" />
41+
<PackageReference Include="DocuSign.eSign.dll" Version="6.0.0" />
42+
<PackageReference Include="DocuSign.Monitor" Version="1.1.0" />
43+
<PackageReference Include="DocuSign.Rooms" Version="1.1.0" />
44+
<PackageReference Include="Microsoft.AspNetCore.Session" Version="2.2.0" />
45+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.0-preview1.19506.2" />
46+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.0-preview1.19506.2">
47+
<PrivateAssets>all</PrivateAssets>
48+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
49+
</PackageReference>
50+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />
51+
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" />
52+
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
53+
<PrivateAssets>all</PrivateAssets>
54+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
55+
</PackageReference>
56+
<PackageReference Include="System.Configuration.ConfigurationManager" Version="5.0.0" />
57+
</ItemGroup>
58+
59+
<ItemGroup>
60+
<Content Update="eSignature\Views\SendBulkEnvelopes\Eg031.cshtml">
61+
<Pack>$(IncludeRazorContentInPack)</Pack>
62+
</Content>
63+
<Content Update="Views\Shared\_HomeLayout.cshtml">
64+
<Pack>$(IncludeRazorContentInPack)</Pack>
65+
</Content>
66+
<Content Update="Views\Shared\_Layout.cshtml">
67+
<Pack>$(IncludeRazorContentInPack)</Pack>
68+
</Content>
69+
</ItemGroup>
70+
71+
</Project>

0 commit comments

Comments
 (0)