-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from PiemP/signed_metadata
Endpoint per generazione metadata firmato
- Loading branch information
Showing
35 changed files
with
7,343 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
CIE.AspNetCore.Authentication/CIE.AspNetCore.Authentication/CieHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...etCore.Authentication/CIE.AspNetCore.Authentication/Extensions/CieSPMetadataMiddleware.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.Extensions.Options; | ||
using CIE.AspNetCore.Authentication.Models; | ||
using CIE.AspNetCore.Authentication.Models.ServiceProviders; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace CIE.AspNetCore.Authentication.Extensions | ||
{ | ||
internal class CieSPMetadataMiddleware | ||
{ | ||
private readonly RequestDelegate _next; | ||
|
||
public CieSPMetadataMiddleware(RequestDelegate next) | ||
{ | ||
_next = next; | ||
} | ||
|
||
public async Task Invoke(HttpContext context, IOptionsSnapshot<CieOptions> options, IServiceProvidersFactory serviceProvidersFactory) | ||
{ | ||
var serviceProviders = options.Value.ServiceProviders; | ||
|
||
serviceProviders.AddRange(await serviceProvidersFactory.GetServiceProviders()); | ||
|
||
var serviceProvider = serviceProviders.FirstOrDefault(m => | ||
context.Request.Path.Equals($"{options.Value.ServiceProvidersMetadataEndpointsBasePath}/{m.FileName}", System.StringComparison.OrdinalIgnoreCase)); | ||
if (serviceProvider is not null) | ||
{ | ||
var (result, contentType) = serviceProvider.Serialize(); | ||
context.Response.ContentType = contentType ?? "application/xml; charset=UTF-8"; | ||
await context.Response.WriteAsync(result); | ||
await context.Response.Body.FlushAsync(); | ||
return; | ||
} | ||
|
||
await _next(context); | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
CIE.AspNetCore.Authentication/CIE.AspNetCore.Authentication/Extensions/LoggingExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...ication/CIE.AspNetCore.Authentication/Models/ServiceProviders/AssertionConsumerService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace CIE.AspNetCore.Authentication.Models.ServiceProviders | ||
{ | ||
public class AssertionConsumerService | ||
{ | ||
public ProtocolBinding ProtocolBinding { get; set; } | ||
public string Location { get; set; } | ||
public ushort Index { get; set; } = 0; | ||
public bool IsDefault { get; set; } = true; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...cation/CIE.AspNetCore.Authentication/Models/ServiceProviders/AttributeConsumingService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace CIE.AspNetCore.Authentication.Models.ServiceProviders | ||
{ | ||
public class AttributeConsumingService | ||
{ | ||
public ushort Index { get; set; } = 0; | ||
public string ServiceName { get; set; } | ||
public string ServiceDescription { get; set; } | ||
public CieClaimTypes[] ClaimTypes { get; set; } | ||
} | ||
} |
Oops, something went wrong.