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__/ ...@@ -268,3 +268,6 @@ __pycache__/
tools/* tools/*
!tools/packages.config !tools/packages.config
dist/ dist/
# linq2db clutter
src/.tools/*
...@@ -33,8 +33,8 @@ namespace Coscine.STS.Controllers ...@@ -33,8 +33,8 @@ namespace Coscine.STS.Controllers
if (ModelState.IsValid) if (ModelState.IsValid)
{ {
var claimsPrincipal = ORCiDHandler.VerifiyORCiDJWT(model.ORCiD_JWT); var claimsPrincipal = ORCiDHandler.VerifiyORCiDJWT(model.ORCiD_JWT);
string surName = ""; string surname = "";
string givenName = ""; string givenname = "";
string ORCiD = ""; string ORCiD = "";
foreach (var claim in claimsPrincipal.Claims) foreach (var claim in claimsPrincipal.Claims)
{ {
...@@ -44,11 +44,11 @@ namespace Coscine.STS.Controllers ...@@ -44,11 +44,11 @@ namespace Coscine.STS.Controllers
} }
else if(claim.Type == ClaimTypes.Surname) else if(claim.Type == ClaimTypes.Surname)
{ {
surName = claim.Value; surname = claim.Value;
} }
else if(claim.Type == ClaimTypes.GivenName) else if(claim.Type == ClaimTypes.GivenName)
{ {
givenName = claim.Value; givenname = claim.Value;
} }
} }
...@@ -67,8 +67,10 @@ namespace Coscine.STS.Controllers ...@@ -67,8 +67,10 @@ namespace Coscine.STS.Controllers
UserPlainModel userPlainModel = new UserPlainModel(Program.Configuration); UserPlainModel userPlainModel = new UserPlainModel(Program.Configuration);
var user = new User var user = new User
{ {
DisplayName = surName + " " + givenName, DisplayName = givenname + " " + surname,
EmailAddress = ORCiD + "@orcid.org" EmailAddress = ORCiD + "@orcid.org",
Surname = surname,
Givenname = givenname
}; };
userPlainModel.Insert(user); userPlainModel.Insert(user);
externalIdModel.Insert(new ExternalId externalIdModel.Insert(new ExternalId
......
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <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" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.Authentication" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Abstractions" 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