Skip to content

Commit 9a51a7a

Browse files
fix: fixed an inaccuracy in the protocol implementation
1 parent 740c562 commit 9a51a7a

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

HwProj.APIGateway/HwProj.APIGateway.API/Lti/Controllers/LtiDeepLinkingReturnController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public async Task<IActionResult> OnDeepLinkingReturnAsync([FromForm] IFormCollec
4242
}
4343

4444
var unverifiedToken = Handler.ReadJwtToken(tokenString);
45-
var clientId = unverifiedToken.Subject;
45+
var clientId = unverifiedToken.Issuer;
4646

4747
var tool = toolService.GetByClientId(clientId);
4848
if (tool == null)
@@ -58,7 +58,7 @@ public async Task<IActionResult> OnDeepLinkingReturnAsync([FromForm] IFormCollec
5858
Handler.ValidateToken(tokenString, new TokenValidationParameters
5959
{
6060
ValidateIssuer = true,
61-
ValidIssuer = tool.issuer,
61+
ValidIssuer = tool.ClientId,
6262
ValidateAudience = true,
6363
ValidAudience = ltiPlatformOptions.Value.Issuer,
6464
ValidateLifetime = true,

HwProj.APIGateway/HwProj.APIGateway.API/Lti/Controllers/MockToolController.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ private record MockTask(string Id, string Title, string Description, int Score);
3636
static MockToolController()
3737
{
3838
var rsa = RSA.Create(2048);
39-
var keyId = "mock-tool-key-id";
39+
const string keyId = "mock-tool-key-id";
4040
SigningKey = new RsaSecurityKey(rsa) { KeyId = keyId };
4141
}
4242

@@ -172,8 +172,7 @@ public IActionResult SubmitDeepLinkingSelection(
172172

173173
var payload = new JwtPayload
174174
{
175-
{ "iss", ToolIss },
176-
{ "sub", ToolNameId },
175+
{ "iss", ToolNameId },
177176
{ "aud", platformIssuer },
178177
{ "iat", DateTimeOffset.UtcNow.ToUnixTimeSeconds() },
179178
{ "exp", DateTimeOffset.UtcNow.AddMinutes(5).ToUnixTimeSeconds() },

0 commit comments

Comments
 (0)