-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added NPQAccessToken to gettrn journey
- Loading branch information
Showing
3 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
16 changes: 15 additions & 1 deletion
16
...ingRecordSystem/src/TeachingRecordSystem.AuthorizeAccess/Pages/RequestTrn/Index.cshtml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,24 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
using TeachingRecordSystem.UiCommon.FormFlow; | ||
|
||
namespace TeachingRecordSystem.AuthorizeAccess.Pages.RequestTrn; | ||
|
||
[Journey(RequestTrnJourneyState.JourneyName), ActivatesJourney, RequireJourneyInstance] | ||
public class IndexModel : PageModel | ||
public class IndexModel(IConfiguration configuration) : PageModel | ||
{ | ||
public JourneyInstance<RequestTrnJourneyState>? JourneyInstance { get; set; } | ||
|
||
[FromQuery] | ||
public string? AccessToken { get; set; } | ||
|
||
public ActionResult OnGet() | ||
{ | ||
var whitelistedAccessToken = configuration.GetRequiredValue("RequestTrnAccessToken"); | ||
if (!whitelistedAccessToken.Equals(AccessToken, StringComparison.Ordinal)) | ||
{ | ||
return BadRequest(); | ||
} | ||
return Page(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,6 @@ | |
"Microsoft.AspNetCore": "Fatal" | ||
} | ||
} | ||
} | ||
}, | ||
"RequestTrnAccessToken": "n8hhN5MSrNXxCzRo" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters