DotNet Security: Identity Username - with windows authentication

  • beaulieu / 102 / Wed, 24 Jun 2009 12:51:00 GMT / Comments (6)
  • Im trying to find a way when i save a security role for the current profile, that only the username without the domaine name of our windows network will be use.

    Right now my Identity username allways have my network domaine which i dont want that.

    thank you
  • Keywords:

    identity, username, windows, authentication, dotnet, security, .net

  • http://dotnet.itags.org/dotnet-security/60920/«« Last Thread - Next Thread »»
    1. Are you using a built in membership provider?

      /kadji

      kadjiokou | Sun, 06 Jan 2008 06:02:00 GMT |

    2. No, im using membership with active directory and with windows authentication. I will use a custom UserProfileInfos.

      When i save a security role (in my web application) with the current user, i have to split the identity username and only get the real username but its not working since i have duplicated userProfiles because i still have the domaine name which i dont wont to have in my web app.

      thank you for your time

      beaulieu | Sun, 06 Jan 2008 06:03:00 GMT |

    3. If you are using the ActiveDirectoryMembershipProvider, the you can add theattributeMapUsernam="sAMAccountName" to your provider definition in web.config.

      This seems to work for me.

      Thanks

      /kadji

      kadjiokou | Sun, 06 Jan 2008 06:04:00 GMT |

    4. I have that attribute yes, but im still having this format saved in the user profile and roles like this... "domaineName\Username"

      as i said, im trying to work with the username only when it saved in the DataBase.

      thanks for your help.

      beaulieu | Sun, 06 Jan 2008 06:05:00 GMT |

    5. Can you post your web configuration file?

      Thanks

      /Kadji

      kadjiokou | Sun, 06 Jan 2008 06:06:00 GMT |

    6. Here my web.config.

      <configuration><configSections><sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"><sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"><section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/><sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"><section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/><section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/><section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/></sectionGroup></sectionGroup></sectionGroup><section name="magicAjax" type="MagicAjax.Configuration.MagicAjaxSectionHandler, MagicAjax"/><section name="WebConfigs" type="Abitibi.Components.WebConfigSection"/></configSections><WebConfigs defaultConnectionStringName="LocalSqlServer"><HL/></WebConfigs><connectionStrings><clear/><add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Initial Catalog=Abitibi;Integrated Security=True" providerName="System.Data.SqlClient"/><add name="ADServices" connectionString="LDAP://AMER.PFIZER.COM"/></connectionStrings><magicAjax tracing="false"><pageStore/></magicAjax><system.web><pages theme="Default"><controls><add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/><add tagPrefix="NickLee" namespace="NickLee.Web.UI" assembly="NickLee.Web.UI"/><add tagPrefix="ajax" namespace="MagicAjax.UI.Controls" assembly="MagicAjax"/> <add tagPrefix="ComponentArt" namespace="ComponentArt.Web.UI" assembly="ComponentArt.Web.UI"/></controls></pages><membership defaultProvider="WindowsMembership"><providers><clear/><add name="WindowsMembership" enableSearchMethods="true" type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ADServices" attributeMapUsername="sAMAccountName" attributeMapEmail="mail"/></providers></membership><profile enabled="true" defaultProvider="SqlProfile" inherits="Abitibi.Providers.WebUserProfileInfo, Abitibi"><providers><clear/><add name="SqlProfile" type="System.Web.Profile.SqlProfileProvider" connectionStringName="LocalSqlServer"/></providers></profile><identity impersonate="true"/><roleManager enabled="true" defaultProvider="SqlRoleProvider"><providers><clear/><add name="SqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="LocalSqlServer"/></providers></roleManager><!--<globalization culture="fr-CA" />--> <globalization culture="en-CA" uiCulture="en-CA" /><authentication mode="Windows"/><compilation debug="true"><assemblies><add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/><add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/><add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/><add assembly="System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/><add assembly="System.Management, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/><add assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/><add assembly="Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/><add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies><buildProviders><add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/></buildProviders></compilation><httpHandlers><remove path="*.asmx" verb="*"/><add path="*.asmx" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/><add path="*_AppService.axd" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/><add path="ScriptResource.axd" verb="GET,HEAD" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/><add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"/></httpHandlers><httpModules><add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/><add name="MagicAjaxModule" type="MagicAjax.MagicAjaxModule, MagicAjax"/></httpModules></system.web><system.webServer><validation validateIntegratedModeConfiguration="false"/><modules><add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/></modules><handlers><remove name="WebServiceHandlerFactory-Integrated"/><add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/><add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/><add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/></handlers></system.webServer></configuration>

      beaulieu | Sun, 06 Jan 2008 06:07:00 GMT |