Website ASP.net security with NAV Web Services.

shepardassoc
Member Posts: 25
I've been having trouble getting my website login authentication to pass through to NAV webservices. My form login user is replaced by a NTSservice Account when ASP.net attempts to connect through the Webservices. I've found I can use an Impersonate user in the webconfig file but I would like to be able to use the NAV users if possible.
0
Comments
-
It sounds like you currently use forms authentication, and configured your app to impersonate a fixed windows account once they have been authenticated & authorised in ASP.NET. This fixed account is a windows user in NAV, and all ASP.NET forms users map to the fixed account in NAV when accessing the NAV web services.
Instead of using this fixed windows account, you want each ASP.NET client user to map to an individual NAV windows login. Is that correct?
If all of this happens within a single windows domain, you are better off using windows authentication rather than forms auth. The hard part is configuring the ASP.NET host (presumably IIS) to present delegated credentials to the NAV web services.
If the users login from outside the host domain, but their forms credentials map to valid windows credentials inside the host domain, you may be able to exploit the technique described here http://visualstudiomagazine.com/articles/2004/05/01/activate-windows-impersonation-selectively.aspx to impersonate them.
Alex0 -
I was tinkering with using Forms logins and NAV web services most of this morning.
This was only for experimentation, so you'll probably have to come up with something more clever for production, at least on the security management & storage side.
Now, first, in my web.config:<connectionStrings> <add name="aspnetusers" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" /> </connectionStrings> <system.web> [...] <authentication mode="Forms" /> <membership> <providers> <clear/> <add connectionStringName="aspnetusers" enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="[NAVTest2]" requiresUniqueEmail="true" passwordFormat="Clear" maxInvalidPasswordAttempts="5" passwordAttemptWindow="10" passwordStrengthRegularExpression="" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider"/></providers> </membership>
This stores the passwords in clear text, so I wouldn't suggest this is *the* way to go when you port to production. You'll probably have to come up with a clever system that allows you to populate your security system with Active Directory info or something.
Anyway, with Clear passwordFormat and enablePasswordRetrieval, you can call the Credential piece of the web service generation with the login information of your user.Customer_Service CustServ = new Customer_Service(); CustServ.UseDefaultCredentials = false; MembershipUser mu = Membership.GetUser(User.Identity.Name); CustServ.Credentials = new System.Net.NetworkCredential(User.Identity.Name, mu.GetPassword(), [domain]);
Not sure if this helps even in the slightest, but it did technically work for me.JEREMY VYSKA
CEO, Spare Brained Ideas, Göteborg, Sweden
New (April 2021) Getting Started with Microsoft Dynamics 365 Business Central Book Available: "Your First 20 Hours with Business Central"0 -
I need to use form authentication due to the web access will be from a mobile device not connected to the network/domain. My current strategy is to use the ASP.net user tables/schema in a SQL database and store the NAV windows login associated with the ASP user. Then try to pass the NAV windows user, retrieved when logging in using the ASP user, on through the web services so I can take advantage of the NAV security. We will see if this works or not. Might be a crazy idea.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions