Skip to content

Commit 030ffb5

Browse files
committed
modify check token logic
1 parent fc94130 commit 030ffb5

15 files changed

+163
-7
lines changed

eg-03-csharp-auth-code-grant-core/Controllers/Eg001EmbeddedSigningController.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@ public Eg001EmbeddedSigningController(DSConfiguration config, IRequestItemsServi
2929
[HttpPost]
3030
public IActionResult Create(string signerEmail, string signerName)
3131
{
32+
bool tokenOk = CheckToken(3);
33+
if (!tokenOk)
34+
{
35+
// We could store the parameters of the requested operation
36+
// so it could be restarted automatically.
37+
// But since it should be rare to have a token issue here,
38+
// we'll make the user re-enter the form data after
39+
// authentication.
40+
RequestItemsService.EgName = EgName;
41+
return Redirect("/ds/mustAuthenticate");
42+
}
3243
var session = RequestItemsService.Session;
3344
var user = RequestItemsService.User;
3445
// Step 1. Create the envelope definition

eg-03-csharp-auth-code-grant-core/Controllers/Eg002SigningViaEmailController.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ public Eg002SigningViaEmailController(DSConfiguration config, IRequestItemsServi
2626
[HttpPost]
2727
public IActionResult Create(string signerEmail, string signerName, string ccEmail, string ccName)
2828
{
29+
bool tokenOk = CheckToken(3);
30+
if (!tokenOk)
31+
{
32+
// We could store the parameters of the requested operation
33+
// so it could be restarted automatically.
34+
// But since it should be rare to have a token issue here,
35+
// we'll make the user re-enter the form data after
36+
// authentication.
37+
RequestItemsService.EgName = EgName;
38+
return Redirect("/ds/mustAuthenticate");
39+
}
2940
var session = RequestItemsService.Session;
3041
var user = RequestItemsService.User;
3142
EnvelopeDefinition env = MakeEnvelope(signerEmail, signerName, ccEmail, ccName);

eg-03-csharp-auth-code-grant-core/Controllers/Eg003ListEnvelopesController.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ public Eg003ListEnvelopesController(DSConfiguration config, IRequestItemsService
2626
[HttpPost]
2727
public IActionResult Create(string signerEmail, string signerName)
2828
{
29+
bool tokenOk = CheckToken(3);
30+
if (!tokenOk)
31+
{
32+
// We could store the parameters of the requested operation
33+
// so it could be restarted automatically.
34+
// But since it should be rare to have a token issue here,
35+
// we'll make the user re-enter the form data after
36+
// authentication.
37+
RequestItemsService.EgName = EgName;
38+
return Redirect("/ds/mustAuthenticate");
39+
}
2940
var session = RequestItemsService.Session;
3041
var user = RequestItemsService.User;
3142
var config = new Configuration(new ApiClient(session.BasePath + "/restapi"));

eg-03-csharp-auth-code-grant-core/Controllers/Eg004EnvelopeInfoController.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@ public Eg004EnvelopeInfoController(DSConfiguration config, IRequestItemsService
2424
[HttpPost]
2525
public IActionResult Create(string signerEmail, string signerName)
2626
{
27+
bool tokenOk = CheckToken(3);
28+
if (!tokenOk)
29+
{
30+
// We could store the parameters of the requested operation
31+
// so it could be restarted automatically.
32+
// But since it should be rare to have a token issue here,
33+
// we'll make the user re-enter the form data after
34+
// authentication.
35+
RequestItemsService.EgName = EgName;
36+
return Redirect("/ds/mustAuthenticate");
37+
}
2738
var session = RequestItemsService.Session;
2839
var user = RequestItemsService.User;
2940
var config = new Configuration(new ApiClient(session.BasePath + "/restapi"));

eg-03-csharp-auth-code-grant-core/Controllers/Eg005EnvelopeRecipientsController.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ public Eg005EnvelopeRecipientsController(DSConfiguration config, IRequestItemsSe
2020
[HttpPost]
2121
public IActionResult Create(string signerEmail, string signerName)
2222
{
23+
bool tokenOk = CheckToken(3);
24+
if (!tokenOk)
25+
{
26+
// We could store the parameters of the requested operation
27+
// so it could be restarted automatically.
28+
// But since it should be rare to have a token issue here,
29+
// we'll make the user re-enter the form data after
30+
// authentication.
31+
RequestItemsService.EgName = EgName;
32+
return Redirect("/ds/mustAuthenticate");
33+
}
2334
var session = RequestItemsService.Session;
2435
var user = RequestItemsService.User;
2536
var config = new Configuration(new ApiClient(session.BasePath + "/restapi"));

eg-03-csharp-auth-code-grant-core/Controllers/Eg006EnvelopeDocsController.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ public Eg006EnvelopeDocsController(DSConfiguration config, IRequestItemsService
2222
[HttpPost]
2323
public IActionResult Create(string signerEmail, string signerName)
2424
{
25+
bool tokenOk = CheckToken(3);
26+
if (!tokenOk)
27+
{
28+
// We could store the parameters of the requested operation
29+
// so it could be restarted automatically.
30+
// But since it should be rare to have a token issue here,
31+
// we'll make the user re-enter the form data after
32+
// authentication.
33+
RequestItemsService.EgName = EgName;
34+
return Redirect("/ds/mustAuthenticate");
35+
}
2536
var session = RequestItemsService.Session;
2637
var user = RequestItemsService.User;
2738
var config = new Configuration(new ApiClient(session.BasePath + "/restapi"));

eg-03-csharp-auth-code-grant-core/Controllers/Eg007EnvelopeGetDocController.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,19 @@ public Eg007EnvelopeGetDocController(DSConfiguration config, IRequestItemsServic
1818
public override string EgName => "eg007";
1919

2020
[HttpPost]
21-
public FileResult Create(string docSelect)
21+
public ActionResult Create(string docSelect)
2222
{
23+
bool tokenOk = CheckToken(3);
24+
if (!tokenOk)
25+
{
26+
// We could store the parameters of the requested operation
27+
// so it could be restarted automatically.
28+
// But since it should be rare to have a token issue here,
29+
// we'll make the user re-enter the form data after
30+
// authentication.
31+
RequestItemsService.EgName = EgName;
32+
return Redirect("/ds/mustAuthenticate");
33+
}
2334
var session = RequestItemsService.Session;
2435
var user = RequestItemsService.User;
2536
var config = new Configuration(new ApiClient(session.BasePath + "/restapi"));

eg-03-csharp-auth-code-grant-core/Controllers/Eg008CreateTemplateController.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,18 @@ public Eg008CreateTemplateController(DSConfiguration config, IRequestItemsServic
2121

2222
[HttpPost]
2323
public IActionResult Create()
24-
{
24+
{
25+
bool tokenOk = CheckToken(3);
26+
if (!tokenOk)
27+
{
28+
// We could store the parameters of the requested operation
29+
// so it could be restarted automatically.
30+
// But since it should be rare to have a token issue here,
31+
// we'll make the user re-enter the form data after
32+
// authentication.
33+
RequestItemsService.EgName = EgName;
34+
return Redirect("/ds/mustAuthenticate");
35+
}
2536
string templateName = "Example Signer and CC template";
2637
var session = RequestItemsService.Session;
2738
var user = RequestItemsService.User;

eg-03-csharp-auth-code-grant-core/Controllers/Eg009UseTemplateController.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ public Eg009UseTemplateController(DSConfiguration config, IRequestItemsService r
2323
[HttpPost]
2424
public IActionResult Create(string signerEmail, string signerName, string ccEmail, string ccName)
2525
{
26+
bool tokenOk = CheckToken(3);
27+
if (!tokenOk)
28+
{
29+
// We could store the parameters of the requested operation
30+
// so it could be restarted automatically.
31+
// But since it should be rare to have a token issue here,
32+
// we'll make the user re-enter the form data after
33+
// authentication.
34+
RequestItemsService.EgName = EgName;
35+
return Redirect("/ds/mustAuthenticate");
36+
}
2637
var session = RequestItemsService.Session;
2738
var user = RequestItemsService.User;
2839
var config = new Configuration(new ApiClient(session.BasePath + "/restapi"));

eg-03-csharp-auth-code-grant-core/Controllers/Eg010SendBinaryDocsController.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ public Eg010SendBinaryDocsController(DSConfiguration config, IRequestItemsServic
2626
[HttpPost]
2727
public IActionResult Create(string signerEmail, string signerName, string ccEmail, string ccName)
2828
{
29+
bool tokenOk = CheckToken(3);
30+
if (!tokenOk)
31+
{
32+
// We could store the parameters of the requested operation
33+
// so it could be restarted automatically.
34+
// But since it should be rare to have a token issue here,
35+
// we'll make the user re-enter the form data after
36+
// authentication.
37+
RequestItemsService.EgName = EgName;
38+
return Redirect("/ds/mustAuthenticate");
39+
}
2940
// Step 1. Make the envelope JSON request body
3041
dynamic envelope = MakeEnvelope(signerEmail, signerName, ccEmail, ccName);
3142

0 commit comments

Comments
 (0)