Skip to content
Snippets Groups Projects
Commit 060d3b6b authored by L. Ellenbeck's avatar L. Ellenbeck
Browse files

Fix: Add and change surname and givenname (coscine/issues#280)

parent 9487a8ef
No related branches found
No related tags found
No related merge requests found
......@@ -268,3 +268,6 @@ __pycache__/
tools/*
!tools/packages.config
dist/
# linq2db clutter
src/.tools/*
......@@ -33,8 +33,8 @@ namespace Coscine.STS.Controllers
if (ModelState.IsValid)
{
var claimsPrincipal = ORCiDHandler.VerifiyORCiDJWT(model.ORCiD_JWT);
string surName = "";
string givenName = "";
string surname = "";
string givenname = "";
string ORCiD = "";
foreach (var claim in claimsPrincipal.Claims)
{
......@@ -44,11 +44,11 @@ namespace Coscine.STS.Controllers
}
else if(claim.Type == ClaimTypes.Surname)
{
surName = claim.Value;
surname = claim.Value;
}
else if(claim.Type == ClaimTypes.GivenName)
{
givenName = claim.Value;
givenname = claim.Value;
}
}
......@@ -67,8 +67,10 @@ namespace Coscine.STS.Controllers
UserPlainModel userPlainModel = new UserPlainModel(Program.Configuration);
var user = new User
{
DisplayName = surName + " " + givenName,
EmailAddress = ORCiD + "@orcid.org"
DisplayName = givenname + " " + surname,
EmailAddress = ORCiD + "@orcid.org",
Surname = surname,
Givenname = givenname
};
userPlainModel.Insert(user);
externalIdModel.Insert(new ExternalId
......
......@@ -9,7 +9,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Coscine.ApiCommons" Version="1.2.0" />
<PackageReference Include="Coscine.ApiCommons" Version="1.2.1" />
<PackageReference Include="Coscine.Database" Version="1.5.1" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Abstractions" Version="2.2.0" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment