Skip to content
Snippets Groups Projects
Commit e9cb49ea authored by Marcel Nellesen's avatar Marcel Nellesen
Browse files

Merge branch 'Hotfix/711-prodShib' into 'master'

Hotfix/711-prodShib

See merge request coscine/api/sts!44
parents 5a4cbc14 2af61100
Branches
Tags v1.11.3
1 merge request!44Hotfix/711-prodShib
......@@ -9,8 +9,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Coscine.ApiCommons" Version="1.7.0" />
<PackageReference Include="Coscine.Database" Version="1.17.0" />
<PackageReference Include="Coscine.ApiCommons" Version="1.7.1" />
<PackageReference Include="Coscine.Database" Version="1.19.0" />
<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" />
......
......@@ -3,19 +3,16 @@ using Coscine.Api.STS.Data;
using Coscine.Api.STS.Security;
using Coscine.Api.STS.Utils;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Sustainsys.Saml2;
using Sustainsys.Saml2.Metadata;
using System;
using System.Linq;
namespace Coscine.Api.STS
{
public class Startup : AbstractStartup
public class Startup : AbstractDefaultStartup
{
public Startup()
{
......@@ -24,7 +21,7 @@ namespace Coscine.Api.STS
public override void ConfigureServicesExtensionLate(IServiceCollection services)
{
base.ConfigureServicesExtension(services);
base.ConfigureServicesExtensionLate(services);
services.AddDbContext<CoscineDbContext>(
options =>
......@@ -35,11 +32,7 @@ namespace Coscine.Api.STS
.AddEntityFrameworkStores<CoscineDbContext>()
.AddDefaultTokenProviders();
services.AddAuthentication(x =>
{
x.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
x.DefaultSignOutScheme = CookieAuthenticationDefaults.AuthenticationScheme;
})
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddCookie()
.AddSaml2(options =>
{
......
......@@ -12,7 +12,7 @@ namespace Coscine.Api.STS.Utils
{
{ "urn:oid:2.16.840.1.113730.3.1.241", "DisplayName" },
{ "urn:oid:2.5.4.4", "Surname" },
{ "urn:oid:2.5.4.42", "Givenname" },
{ "urn:oid:1.3.6.1.4.1.5540.2.1.96", "Givenname" },
{ "urn:oid:0.9.2342.19200300.100.1.3", "EmailAddress" },
{ "urn:oid:1.3.6.1.4.1.5923.1.1.1.9", "Entitlement" },
{ "urn:oid:2.5.4.10", "Organization" },
......@@ -23,12 +23,12 @@ namespace Coscine.Api.STS.Utils
switch (identifier)
{
case "urn:oid:2.16.840.1.113730.3.1.241":
user.DisplayName = (string) value;
user.DisplayName = (string)value;
break;
case "urn:oid:2.5.4.4":
user.Surname = (string)value;
break;
case "urn:oid:2.5.4.42":
case "urn:oid:1.3.6.1.4.1.5540.2.1.96":
user.Givenname = (string)value;
break;
case "urn:oid:0.9.2342.19200300.100.1.3":
......@@ -55,6 +55,10 @@ namespace Coscine.Api.STS.Utils
{
SetUserAttribute(user, key, principal.FindFirstValue(key));
}
if (user.DisplayName == null)
{
user.DisplayName = user.Givenname + " " + user.Surname;
}
return user;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment