Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions AdvantageTool.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2019
# Visual Studio Version 16
VisualStudioVersion = 16.0.30204.135
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{777D9453-8256-4AD3-ADDF-BE34047DFFEB}"
ProjectSection(SolutionItems) = preProject
Expand All @@ -10,10 +10,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AdvantageTool", "src\AdvantageTool.csproj", "{4EBF015D-9B8C-4A2E-8A72-658F931718C0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LtiAdvantage", "..\..\LTI\LtiAdvantage\src\LtiAdvantage\LtiAdvantage.csproj", "{097C6757-60C8-44C2-B378-F9A8E3A08377}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LtiAdvantage.IdentityModel", "..\..\LTI\LtiAdvantage\src\LtiAdvantage.IdentityModel\LtiAdvantage.IdentityModel.csproj", "{C55CD2BF-0A0E-43F2-A285-E82904CCD727}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -24,14 +20,6 @@ Global
{4EBF015D-9B8C-4A2E-8A72-658F931718C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4EBF015D-9B8C-4A2E-8A72-658F931718C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4EBF015D-9B8C-4A2E-8A72-658F931718C0}.Release|Any CPU.Build.0 = Release|Any CPU
{097C6757-60C8-44C2-B378-F9A8E3A08377}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{097C6757-60C8-44C2-B378-F9A8E3A08377}.Debug|Any CPU.Build.0 = Debug|Any CPU
{097C6757-60C8-44C2-B378-F9A8E3A08377}.Release|Any CPU.ActiveCfg = Release|Any CPU
{097C6757-60C8-44C2-B378-F9A8E3A08377}.Release|Any CPU.Build.0 = Release|Any CPU
{C55CD2BF-0A0E-43F2-A285-E82904CCD727}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C55CD2BF-0A0E-43F2-A285-E82904CCD727}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C55CD2BF-0A0E-43F2-A285-E82904CCD727}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C55CD2BF-0A0E-43F2-A285-E82904CCD727}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
7 changes: 2 additions & 5 deletions src/AdvantageTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<ItemGroup>
<PackageReference Include="BuildBundlerMinifier" Version="2.8.391" />
<PackageReference Include="IdentityModel" Version="3.10.5" />
<PackageReference Include="LtiAdvantage" Version="0.1.1-alpha.0" />
<PackageReference Include="LtiAdvantage.IdentityModel" Version="0.1.1-alpha.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.5.1" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="RandomNameGeneratorLibrary" Version="1.2.2" />
Expand All @@ -20,11 +22,6 @@
<Folder Include="wwwroot\lib\" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\LTI\LtiAdvantage\src\LtiAdvantage.IdentityModel\LtiAdvantage.IdentityModel.csproj" />
<ProjectReference Include="..\..\..\LTI\LtiAdvantage\src\LtiAdvantage\LtiAdvantage.csproj" />
</ItemGroup>

<ItemGroup>
<WCFMetadata Include="Connected Services" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/Catalog.cshtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@page
@page "/Tool/Catalog"
@using AdvantageTool.Utility
@model CatalogModel
@{
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/Catalog.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public async Task<IActionResult> OnPostAssignActivities()
var credentials = PemHelper.SigningCredentialsFromPemString(platform.PrivateKey);
var jwt = handler.WriteToken(new JwtSecurityToken(new JwtHeader(credentials), response));

return Post("id_token", jwt, LtiRequest.DeepLinkingSettings.DeepLinkReturnUrl);
return Post("JWT", jwt, LtiRequest.DeepLinkingSettings.DeepLinkReturnUrl);
}

/// <summary>
Expand Down
4 changes: 3 additions & 1 deletion src/Pages/Components/LineItems/LineItemsViewComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ public async Task<IViewComponentResult> InvokeAsync(string idToken)

foreach (var lineItem in model.LineItems)
{
using (var response = await httpClient.GetAsync(lineItem.AgsLineItem.Id.EnsureTrailingSlash() + "results"))
var lineItemUri = new Uri(lineItem.AgsLineItem.Id);
var resultsUrl = $"{lineItemUri.GetLeftPart(UriPartial.Path)}/results{lineItemUri.Query}";
using (var response = await httpClient.GetAsync(resultsUrl))
{
if (!response.IsSuccessStatusCode)
{
Expand Down
44 changes: 6 additions & 38 deletions src/Pages/Tool.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using System.Threading.Tasks;
using AdvantageTool.Data;
using AdvantageTool.Utility;
using IdentityModel.Client;
using IdentityModel.Internal;
using LtiAdvantage;
using LtiAdvantage.AssignmentGradeServices;
Expand Down Expand Up @@ -277,11 +276,9 @@ public async Task<IActionResult> OnPostCreateLineItemAsync([FromForm(Name = "id_
return Page();
}

return Relaunch(
LtiRequest.Iss,
LtiRequest.UserId,
LtiRequest.ResourceLink.Id,
LtiRequest.Context.Id);
IdToken = idToken;

return Page();
}

/// <summary>
Expand Down Expand Up @@ -355,40 +352,11 @@ public async Task<IActionResult> OnPostPostScoreAsync([FromForm(Name = "id_token
return Page();
}

return Relaunch(
LtiRequest.Iss,
LtiRequest.UserId,
LtiRequest.ResourceLink.Id,
LtiRequest.Context.Id);
}

private RedirectResult Relaunch(string iss, string userId, string resourceLinkId, string contextId)
{
// Send request to tool's endpoint to initiate login
var values = new
{
// The issuer identifier for the platform
iss,

// The platform identifier for the user to login
login_hint = userId,

// The endpoint to be executed at the end of the OIDC authentication flow
target_link_uri = Url.Page("./Tool", null, null, Request.Scheme),

// The identifier of the LtiResourceLink message (or the deep link message, etc)
lti_message_hint = JsonConvert.SerializeObject(new
{
id = resourceLinkId,
messageType = Constants.Lti.LtiResourceLinkRequestMessageType,
courseId = contextId
})
};
IdToken = idToken;

var url = new RequestUrl(Url.Page("./OidcLogin")).Create(values);
return Redirect(url);
return Page();
}

/// <summary>
/// Return a <see cref="ContentResult"/> that automatically POSTs the values.
/// </summary>
Expand Down