IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Silverlight Discussion :

[Silverlight 4] Authentification Windows sur un serveur IIS 6.0


Sujet :

Silverlight

  1. #1
    Membre habitué
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    205
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Avril 2006
    Messages : 205
    Points : 125
    Points
    125
    Par défaut [Silverlight 4] Authentification Windows sur un serveur IIS 6.0
    Bonjour,

    Je voudrais déployer une application silverlight 4
    sur un serveur IIS 6 avec l'authentification windows intégrée.

    Pour ce faire j'ai lu beaucoup de tutoriel et je vous montre ma configuration :

    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <configSections>
    	  <sectionGroup name="system.serviceModel">
    	  <section name="domainServices" type="System.ServiceModel.DomainServices.Hosting.DomainServicesSection, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" allowDefinition="MachineToApplication" requirePermission="false" />
    	</sectionGroup>
      </configSections>
      <system.web>
     
    	<httpModules>
    	  <add name="DomainServiceModule" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    	</httpModules>
    	  <customErrors mode="Off"/>
    	<compilation debug="true" targetFramework="4.0">
    		<assemblies>
    		<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    	  </assemblies>
    	</compilation>
     
    	<roleManager enabled="true" defaultProvider="AspNetWindowsTokenRoleProvider"/>  
    	<authentication mode="Windows">
    		<forms name=".BusinessApplicationAnance_ASPXAUTH" />
    	</authentication>
     
      </system.web>
      <system.webServer>
    	<validation validateIntegratedModeConfiguration="true" />
    	<modules runAllManagedModulesForAllRequests="true">
    	  <add name="DomainServiceModule"
    	 preCondition="managedHandler"
    	 type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    	</modules>
      </system.webServer>
      <system.serviceModel>
     
    	  <bindings />
    	  <client />
    ...

    Comme vous pouvez le voir j'ai pas configuré le <membership /> et <profile />
    je ne trouve pas de tutoriel qui explique comment le configurer... Donc je ne sais pas si c'est à cause de ça...

    Voici le code applicatif pour l'authentification :

    Code c# : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
       public partial class App : Application
        {
            private BusyIndicator busyIndicator;
     
            /// <summary>
            /// Creates a new <see cref="App"/> instance.
            /// </summary>
            public App()
            {
                InitializeComponent();
     
                // Create a WebContext and add it to the ApplicationLifetimeObjects
                // collection.  This will then be available as WebContext.Current.
                WebContext webContext = new WebContext();
                //webContext.Authentication = new FormsAuthentication();
                webContext.Authentication = new WindowsAuthentication();
                this.ApplicationLifetimeObjects.Add(webContext);
            }
     
            private void Application_Startup(object sender, StartupEventArgs e)
            {
                // This will enable you to bind controls in XAML files to WebContext.Current
                // properties
                this.Resources.Add("WebContext", WebContext.Current);
     
                // This will automatically authenticate a user when using windows authentication
                // or when the user chose "Keep me signed in" on a previous login attempt
                WebContext.Current.Authentication.LoadUser(this.Application_UserLoaded, null);
     
                // Show some UI to the user while LoadUser is in progress
                this.InitializeRootVisual();
            }

    Je sais pas si il faut créer une connection dans le web.config vers le serveur de l'active directory et crée le provider pour le membership avec la connection...

    Quelqu'un pourrait il m'aider svp ??? Je deviens fou

    Merci d'avance !

  2. #2
    Membre expert
    Avatar de GuruuMeditation
    Homme Profil pro
    .Net Architect
    Inscrit en
    Octobre 2010
    Messages
    1 705
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : Belgique

    Informations professionnelles :
    Activité : .Net Architect
    Secteur : Conseil

    Informations forums :
    Inscription : Octobre 2010
    Messages : 1 705
    Points : 3 568
    Points
    3 568
    Par défaut
    Pour une authentification integrée windows avec SL4 il faut:

    Ajouter la ligne suivante dans le fichier config du WCF dans System.Servicemodel :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
    Decorer la classe implémentation du service avec :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
     [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    Et puis, dans ton service, tu peux ,par exemple, utiliser :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    HttpContext.Current.User.Identity.Name;
    Microsoft MVP : Windows Platform

    MCPD - Windows Phone Developer
    MCPD - Windows Developer 4

    http://www.guruumeditation.net

    “If debugging is the process of removing bugs, then programming must be the process of putting them in.”
    (Edsger W. Dijkstra)

  3. #3
    Membre habitué
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    205
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Avril 2006
    Messages : 205
    Points : 125
    Points
    125
    Par défaut
    Salut EquinoxeDotNet,

    Merci pour ta réponse !
    Après avoir rajouté tes deux codes

    donc dans le web.config
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
    ...
    	  <profile enabled="true" >
    		 <properties>
    			  <add name="FriendlyName" />
    		  </properties>
    	  </profile>
      </system.web>
      <system.webServer>
    	<validation validateIntegratedModeConfiguration="true" />
    	<modules runAllManagedModulesForAllRequests="true">
    	  <add name="DomainServiceModule"
    	 preCondition="managedHandler"
    	 type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    	</modules>
      </system.webServer>
      <system.serviceModel>
    	  <bindings />
    	  <client />
     
    	  <domainServices>
    	  <endpoints>
    		<add name="OData" type="System.ServiceModel.DomainServices.Hosting.ODataEndpointFactory, System.ServiceModel.DomainServices.Hosting.OData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    		<add name="Soap" type="Microsoft.ServiceModel.DomainServices.Hosting.SoapXmlEndpointFactory,Microsoft.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral,PublicKeyToken=31bf3856ad364e35" />
    	  </endpoints>
    	</domainServices>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" /> 
      </system.serviceModel>

    et dans Authentification.cs
    j'ai

    Code c# : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
     
    namespace BusinessApplicationAnance.Web
    {
        using System.Security.Authentication;
        using System.ServiceModel.DomainServices.Hosting;
        using System.ServiceModel.DomainServices.Server;
        using System.ServiceModel.DomainServices.Server.ApplicationServices;
        using System.Threading;
        using System.ServiceModel.Activation;
     
        /// <summary>
        /// RIA Services DomainService responsible for authenticating users when
        /// they try to log on to the application.
        ///
        /// Most of the functionality is already provided by the base class
        /// AuthenticationBase
        /// </summary>
        [EnableClientAccess]
        [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
        public class AuthenticationService : AuthenticationBase<User> { }

    Par contre, je ne vois pas où est ce que je dois mettre
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    HttpContext.Current.User.Identity.Name;
    Voici le type d'erreur que j'ai après environ 10 seconde où je suis sur la page d'accueil :

    Code : 4004
    Category : ManagedRuntimeError
    Message: System.ServiceModel.DomaineServices.Client.DomainException :
    There was a failure using the default 'ProfileProvider'. Please make sure it is
    du coup c'est surement le profile que je dois changer sans doute par
    "HttpContext.Current.User.Identity.Name;" mais où est ce que je dois l'utiliser ?


    Merci d'avance

  4. #4
    Membre expert
    Avatar de GuruuMeditation
    Homme Profil pro
    .Net Architect
    Inscrit en
    Octobre 2010
    Messages
    1 705
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : Belgique

    Informations professionnelles :
    Activité : .Net Architect
    Secteur : Conseil

    Informations forums :
    Inscription : Octobre 2010
    Messages : 1 705
    Points : 3 568
    Points
    3 568
    Par défaut
    Tu utilises le HTTPContext dans le code de ton service.
    Exemple :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    public string GetUserName()
    {
     return HttpContext.Current.User.Identity.Name;
    }
    Evidemment après il faut rajouter des checks si le HTTPContext.Current n'est pas null, etc... pour que le code soit propre.
    Microsoft MVP : Windows Platform

    MCPD - Windows Phone Developer
    MCPD - Windows Developer 4

    http://www.guruumeditation.net

    “If debugging is the process of removing bugs, then programming must be the process of putting them in.”
    (Edsger W. Dijkstra)

  5. #5
    Membre habitué
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    205
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Avril 2006
    Messages : 205
    Points : 125
    Points
    125
    Par défaut
    Salut,

    En faite j'ai mis :

    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
     
    	  <profile enabled="false" >
    		 <properties>
    			  <add name="FriendlyName" />
    		  </properties>
    	  </profile>

    et quand je fais f5 j'ai bien "NOMDUPC\MONNOM"

    Vue que c'est une Business application silverlight je pense que ça doit être déjà implémenté la gestion webContext

    Exemple dans le App.xaml.cs

    Code c# : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
     
            private void Application_Startup(object sender, StartupEventArgs e)
            {
                // This will enable you to bind controls in XAML files to WebContext.Current
                // properties
                this.Resources.Add("WebContext", WebContext.Current);
     
                // This will automatically authenticate a user when using windows authentication
                // or when the user chose "Keep me signed in" on a previous login attempt
                WebContext.Current.Authentication.LoadUser(this.Application_UserLoaded, null);
     
                // Show some UI to the user while LoadUser is in progress
                this.InitializeRootVisual();
            }

    Sinon maintenant je dois accéder par une application WPF
    donc dans le webConfig je dois rajouter :

    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
     
    	   <bindings >
    		  <basicHttpBinding>
    			  <binding name="SecuredByWindows">
    				  <security mode="TransportCredentialOnly">
    					  <transport clientCredentialType="Windows"/>
    				  </security>
    			  </binding>
    		  </basicHttpBinding>
    	  </bindings>

    Mais dans les modes de securité il y aussi Transport, none ...
    J'ai regardé sur le net et je vois pas trop de différence entre tous... Connais tu le plus simple ?Mon application WPF va faire des opérations CRUD et opérations métiers... Elle doit évidemment utiliser l'authentification windows
    et je dois restreindre les méthodes par utilisateur et/ou par role

    Donc pour les roles j'ai rajouter dans le webCOnfig

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    <roleManager enabled="true" defaultProvider="AspNetWindowsTokenRoleProvider"/>
    Après je ne sais pas comment accéder aux roles de l'utilisateur pour savoir sur quel role je dois autoriser les accès aux méthodes, le saurais tu ?
    Je ne connais pas l'Active Directoy (AD) et je pense que personne ne peut me renseigner dans l'entreprise sans perdre 1 mois ...

    Comme j'utilise l'authentification windows faut-il pour l'application WPF utiliser des cookies session ou il y a un moyen simple ???

    N'importe quelle aide sera Fortement apréciée !!!

    Merci

  6. #6
    Rédacteur
    Avatar de Nathanael Marchand
    Homme Profil pro
    Expert .Net So@t
    Inscrit en
    Octobre 2008
    Messages
    3 615
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Expert .Net So@t
    Secteur : Conseil

    Informations forums :
    Inscription : Octobre 2008
    Messages : 3 615
    Points : 8 080
    Points
    8 080
    Par défaut
    Je déconseille l'utilisation de HttpContext dans des services WCF: c'est censé être agnostique de la couche de communication.
    CF cette discussion: http://www.developpez.net/forums/d10...theque-classe/

  7. #7
    Membre expert
    Avatar de GuruuMeditation
    Homme Profil pro
    .Net Architect
    Inscrit en
    Octobre 2010
    Messages
    1 705
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : Belgique

    Informations professionnelles :
    Activité : .Net Architect
    Secteur : Conseil

    Informations forums :
    Inscription : Octobre 2010
    Messages : 1 705
    Points : 3 568
    Points
    3 568
    Par défaut
    Tu as un doc ici qui explique la securité en WCF. https://www.netfxfactory.org/files/f.../entry105.aspx
    Attention, tout n'est pas utilisable avec Silverlight!

    Tu peur faire un check des roles des utilisateurs avec IsInRole()
    Microsoft MVP : Windows Platform

    MCPD - Windows Phone Developer
    MCPD - Windows Developer 4

    http://www.guruumeditation.net

    “If debugging is the process of removing bugs, then programming must be the process of putting them in.”
    (Edsger W. Dijkstra)

  8. #8
    Membre habitué
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    205
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Avril 2006
    Messages : 205
    Points : 125
    Points
    125
    Par défaut
    Je déconseille l'utilisation de HttpContext dans des services WCF: c'est censé être agnostique de la couche de communication.
    CF cette discussion: http://www.developpez.net/forums/d10...theque-classe/


    Très intéressant et suite à cette discussion, j'aimerais savoir si c'est possible d'utiliser le protocole netTcp pour dialoguer avec un service WCF RIA car j'ai crée avec un projet silverlight Business application et un projet WPF ?

    Avec un projet un projet silverlight Business application :
    le site et l'authentification et déjà fait. Ensuite, j'ai changé l'authentification
    par une authentification windows donc ça marche. J'ai crée un Service pour qu'il puisse m'afficher des machines

    Et sur le projet WPF je veux afficher ces machines mais être sur que la personne soit authentifié windows et possède les rôles

    donc est ce que dans le webCOnfig je peux écrire ça ???

    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
    <bindings>   
    <netTcpBinding>     
    <binding name="SecuredByWindows">       
    <security mode="Transport">         
    <transport clientCredentialType="Windows"/>       
    </security>     
    </binding>   
    </netTcpBinding> </bindings>

    le lien ne marche pas pour moi

  9. #9
    Membre expert
    Avatar de GuruuMeditation
    Homme Profil pro
    .Net Architect
    Inscrit en
    Octobre 2010
    Messages
    1 705
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : Belgique

    Informations professionnelles :
    Activité : .Net Architect
    Secteur : Conseil

    Informations forums :
    Inscription : Octobre 2010
    Messages : 1 705
    Points : 3 568
    Points
    3 568
    Par défaut
    Citation Envoyé par lerieure Voir le message

    le lien ne marche pas pour moi
    Oups sorry, voila le lien correct :
    https://www.netfxfactory.org/files/f.../entry105.aspx
    Microsoft MVP : Windows Platform

    MCPD - Windows Phone Developer
    MCPD - Windows Developer 4

    http://www.guruumeditation.net

    “If debugging is the process of removing bugs, then programming must be the process of putting them in.”
    (Edsger W. Dijkstra)

  10. #10
    Membre habitué
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    205
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Avril 2006
    Messages : 205
    Points : 125
    Points
    125
    Par défaut
    J'ai lu le pdf, c'est pas mal pour commencer.

    Voici ce que j'ai implémenter

    dans le web.config entre les balises <system.serviceModel> coté IIS

    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
    	   <bindings >
    		  <basicHttpBinding>
    			  <binding name="SecuredByWindows">
    				  <security mode="TransportCredentialOnly">
    					  <transport clientCredentialType="Windows"/>
    				  </security>
    			  </binding>
    		  </basicHttpBinding>
    	  </bindings>
    	  <behaviors>
    		  <serviceBehaviors>
    			  <behavior name="BusinessApplication.Web.Services.HcPrgService">
    				  <serviceMetadata httpGetEnabled="true" />
    				  <serviceDebug includeExceptionDetailInFaults="false" />
    				  <serviceAuthorization roleProviderName="AspNetWindowsTokenRoleProvider" impersonateCallerForAllOperations="true" />
    			  </behavior>
    		  </serviceBehaviors>
    	  </behaviors>
     
    	  <domainServices>
    	  <endpoints>
    		<add name="OData" type="System.ServiceModel.DomainServices.Hosting.ODataEndpointFactory, System.ServiceModel.DomainServices.Hosting.OData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    		<add name="Soap" type="Microsoft.ServiceModel.DomainServices.Hosting.SoapXmlEndpointFactory,Microsoft.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral,PublicKeyToken=31bf3856ad364e35" />
    	  </endpoints>
    	</domainServices>

    coté client dans le web.config

    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
            <bindings>
                <basicHttpBinding>
                    <binding name="BasicHttpBinding_AuthenticationServiceSoap" closeTimeout="00:01:00"
                        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                        allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                        maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                        messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                        useDefaultWebProxy="true">
                        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                        <security mode="TransportCredentialOnly">
                            <transport clientCredentialType="Windows" proxyCredentialType="None"
                                realm="" />
                            <message clientCredentialType="UserName" algorithmSuite="Default" />
                        </security>
                    </binding>
                    <binding name="BasicHttpBinding_HcPrgServiceSoap" closeTimeout="00:01:00"
                        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                        allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                        maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                        messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                        useDefaultWebProxy="true">
                        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                        <security mode="TransportCredentialOnly">
                            <transport clientCredentialType="Windows" proxyCredentialType="None"
                                realm="" />
                            <message clientCredentialType="UserName" algorithmSuite="Default" />
                        </security>
                    </binding>
                </basicHttpBinding>
            </bindings>
            <client>
                <endpoint address="http://intra-dev/IntraDes/Anance/Services/BusinessApplicationAnance-Web-AuthenticationService.svc/Soap"
                    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_AuthenticationServiceSoap"
                    contract="AnanceAuthService.AuthenticationServiceSoap" name="BasicHttpBinding_AuthenticationServiceSoap" />
                <endpoint address="http://intra-dev/IntraDes/Anance/Services/BusinessApplicationAnance-Web-Services-HcPrgService.svc/Soap"
                    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_HcPrgServiceSoap"
                    contract="HcPrgService.HcPrgServiceSoap" name="BasicHttpBinding_HcPrgServiceSoap" />
            </client>

    dans une page exemple : MainPage.xaml.cs

    Code c# : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
    public partial class MainPage : UserControl
        {
            AnanceAuthService.AuthenticationServiceSoapClient authClient;
            string mesRoles;
     
            public MainPage()
            {
                InitializeComponent();
     
                ThemeManager.ApplyTheme(this,"GlossyDarkTheme");
                authClient = new AnanceAuthService.AuthenticationServiceSoapClient();
                authClient.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Identification;
                //System.Windows.MessageBox.Show(authClient.Roles.ToString());
                var currentAuthUser = authClient.GetUser().RootResults.First();
                System.Windows.MessageBox.Show(currentAuthUser.Name);
     
                //foreach(var Role in currentAuthUser.Roles)
                //{
                //    mesRoles += Role.ToString();
                //}
                //System.Windows.MessageBox.Show(mesRoles);
     
                System.Windows.MessageBox.Show(WindowsIdentity.GetCurrent().Name);
     
            }
        }

    donc ceci :

    Code c# : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    System.Windows.MessageBox.Show(currentAuthUser.Name);
    System.Windows.MessageBox.Show(WindowsIdentity.GetCurrent().Name);

    me retourne bien la même chose

    ceci

    Code c# : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    System.Windows.MessageBox.Show(mesRoles);

    me retourne 1000 roles....


    Par contre quand je vais sur cette url http://intra-dev/IntraDes/Anance/Ser...rvice.svc?soap

    je peux accéder directement aux métadonnées de mon service....
    Normalement il doit pas me demander mes identifiants ?
    Ou c'est parce qu'il detecte directement que je suis identifié ?

    et dernière chose
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
                        <security mode="TransportCredentialOnly">
                            <transport clientCredentialType="Windows" proxyCredentialType="None"
                                realm="" />
                            <message clientCredentialType="UserName" algorithmSuite="Default" />
                        </security>

    la balise message est - elle bien parametrée? car dans le pdf il dise pas si on doit implémenter quelque chose ou du moins c'est pas très clair pour moi


    Merci d'avance, toute aide sera fortement appréciée !

  11. #11
    Rédacteur
    Avatar de Nathanael Marchand
    Homme Profil pro
    Expert .Net So@t
    Inscrit en
    Octobre 2008
    Messages
    3 615
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Expert .Net So@t
    Secteur : Conseil

    Informations forums :
    Inscription : Octobre 2008
    Messages : 3 615
    Points : 8 080
    Points
    8 080
    Par défaut
    Citation Envoyé par lerieure Voir le message
    Par contre quand je vais sur cette url http://intra-dev/IntraDes/Anance/Ser...rvice.svc?soap

    je peux accéder directement aux métadonnées de mon service....
    Ou c'est parce qu'il detecte directement que je suis identifié ?
    Oui

    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
                        <security mode="TransportCredentialOnly">
                            <transport clientCredentialType="Windows" proxyCredentialType="None"
                                realm="" />
                            <message />
                        </security>
    Devrait suffir. (A moins que tu ne veuilles rajouter une autre couche de user/password supplémentaire sur la couche message)

  12. #12
    Membre habitué
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    205
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Avril 2006
    Messages : 205
    Points : 125
    Points
    125
    Par défaut
    Devrait suffir. (A moins que tu ne veuilles rajouter une autre couche de user/password supplémentaire sur la couche message)
    Si on peut le faire ça doit être pour de bonnes raisons mais lesquelles ?
    Quelqu'un connaitrait il les avantages à avoir une couche sur le transport et sur les messages, étant donné qu'on perd en performance...

    Merci !

  13. #13
    Rédacteur
    Avatar de Nathanael Marchand
    Homme Profil pro
    Expert .Net So@t
    Inscrit en
    Octobre 2008
    Messages
    3 615
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Expert .Net So@t
    Secteur : Conseil

    Informations forums :
    Inscription : Octobre 2008
    Messages : 3 615
    Points : 8 080
    Points
    8 080
    Par défaut
    Ben en fait, WCF étant assez flexible c'est possible: il propose l'authentification sur la couche transport ou sur couche message. Le ou n'étant pas exclusif, tu peux faire les deux. Mais ca serait un peu comme mettre ceinture et bretelles

  14. #14
    Membre habitué
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    205
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Avril 2006
    Messages : 205
    Points : 125
    Points
    125
    Par défaut
    Ok merci à tous pour votre aide précieuse !!!!

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Authentification Windows sur Application Silverlight 4
    Par maxwel56 dans le forum Silverlight
    Réponses: 3
    Dernier message: 17/06/2010, 19h48
  2. Authentification Windows sur une machine distante
    Par titip dans le forum Windows Forms
    Réponses: 11
    Dernier message: 01/08/2008, 18h57
  3. Défragmentation de Windows sur mes serveurs
    Par Perignon dans le forum Windows Serveur
    Réponses: 6
    Dernier message: 21/03/2008, 08h47
  4. Authentification HTTP sur 2 serveurs
    Par mecha dans le forum Apache
    Réponses: 5
    Dernier message: 23/06/2006, 17h21
  5. ASP ne tourne pas sur mon serveur IIS
    Par Germain123 dans le forum ASP
    Réponses: 3
    Dernier message: 08/09/2005, 21h50

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo