Bonjour à tous.
Je suis en train de développer une application qu'utilise la package SAML2.dll (qui j'ai téléchargé avec NuGet). Afin de bien configurer ma solution, il faut rajouter quelques sections dans le fichier Web.config :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| <?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="saml2" type="SAML2.Config.Saml2Section, SAML2" />
</configSections>
<connectionStrings>...</connectionStrings>
<appSettings>...</appSettings>
<system.web>...</system.web>
<system.webServer>
<modules>
<remove name="FormsAuthentication" />
</modules>
<handlers>
<remove name="SAML2.Protocol.Saml20SignonHandler" />
<remove name="SAML2.Protocol.Saml20LogoutHandler" />
<remove name="SAML2.Protocol.Saml20MetadataHandler" />
<add name="SAML2.Protocol.Saml20SignonHandler" verb="*" path="Login.ashx" type="SAML2.Protocol.Saml20SignonHandler, SAML2" />
<add name="SAML2.Protocol.Saml20LogoutHandler" verb="*" path="Logout.ashx" type="SAML2.Protocol.Saml20LogoutHandler, SAML2" />
<add name="SAML2.Protocol.Saml20MetadataHandler" verb="*" path="Metadata.ashx" type="SAML2.Protocol.Saml20MetadataHandler, SAML2" />
</handlers>
</system.webServer>
<runtime>...</runtime>
<entityFramework>...</entityFramework>
<saml2>
<serviceProvider id="urn:issuer" server="http://localhost:3301/">
<endpoints>
<endpoint localpath="Login.ashx" type="signon" redirectUrl="~/AuthenticatedHomePage" />
<endpoint localpath="Logout.ashx" type="logout" redirectUrl="~/HomePage" />
<endpoint localpath="Metadata.ashx" type="metadata" />
</endpoints>
<nameIdFormats allowCreate="true">
<add format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient" />
</nameIdFormats>
<authenticationContexts comparison="Exact">
<add context="urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport" referenceType="AuthnContextClassRef" />
</authenticationContexts>
</serviceProvider>
<identityProviders metadata="C:\Users\myUser\Desktop\testMetadata\metadata_Kit_net.xml" />
<metadata>
<contacts>
<contact type="Administrative" company="" givenName="" surName="" email="" phone="" />
</contacts>
<requestedAttributes>
<add name="urn:cn" />
</requestedAttributes>
</metadata>
</saml2>
</configuration> |
Mon soucis est que la session <saml2> n'a aucune balise qu'est reconnue, c'est-à-dire, j{ai 39 messages du type (une pour chaque balise de saml2) :
Impossible de trouver les informations de schéma pour l'élément 'saml2'.
Impossible de trouver les informations de schéma pour l'élément 'serviceProvider'.
Impossible de trouver des informations de schéma pour l'attribut 'id'.
...
J'ai regardé le code source de ma dll (SAML2.dll) et il contient les définitions de ces balises (comme indiqué dans la première partie du fichier Web.config : <section name="saml2" type="SAML2.Config.Saml2Section, SAML2" />) :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| using System.Configuration;
namespace SAML2.Config
{
/// <summary>
/// SAML2 Configuration Section.
/// </summary>
public class Saml2Section : ConfigurationSection
{
/// <summary>
/// Gets the section name.
/// </summary>
public static string Name { get { return "saml2"; } }
#region Elements
/// <summary>
/// Gets or sets the actions to perform on successful processing.
/// </summary>
/// <value>The actions.</value>
[ConfigurationProperty("actions")]
public ActionCollection Actions
{
get { return (ActionCollection)base["actions"]; }
set { base["actions"] = value; }
}
/// <summary>
/// Gets or sets the identity providers.
/// </summary>
/// <value>The identity providers.</value>
[ConfigurationProperty("identityProviders")]
public IdentityProviderCollection IdentityProviders
{
get { return (IdentityProviderCollection)base["identityProviders"]; }
set { base["identityProviders"] = value; }
}
/// <summary>
/// Gets or sets the metadata.
/// </summary>
/// <value>The metadata.</value>
[ConfigurationProperty("metadata")]
public MetadataElement Metadata
{
get { return (MetadataElement)base["metadata"]; }
set { base["metadata"] = value; }
}
/// <summary>
/// Gets or sets the service provider.
/// </summary>
/// <value>The service provider.</value>
[ConfigurationProperty("serviceProvider")]
public ServiceProviderElement ServiceProvider
{
get { return (ServiceProviderElement)base["serviceProvider"]; }
set { base["serviceProvider"] = value; }
}
... |
Je pense que ça me pose des soucis lors de l'exécution de mon application, car si j'appelle l'URL http://localhost:3301/Login.ashx, j'ai un erreur que dit :
{"Attribut 'localpath' non reconnu. Notez que les noms d'attributs respectent la casse. (c:\\users\\myUser\\documents\\visual studio 2013\\Projects\\saml20app\\saml20app\\web.config line 98)"}, et c'est justement la ligne
<endpoint localpath="Login.ashx" type="signon" redirectUrl="~/AuthenticatedHomePage" />
Est-ce que quelqu'un pourrait m'aider à résoudre cette erreur ?
Je vous remercie d'avance pour votre aide,
Marc
Partager