windows-authentication

How can I use Windows Authentication with Microsoft.Rest.ServiceClient

北战南征 提交于 2020-01-03 18:31:32
问题 I have a Microsoft.Rest.ServiceClient generated with autorest . And I want to access a REST API secured with Windows Authentication and Basic Authentication. The goal is to use Windows Authentication. I tried it as follows: var handler = new HttpClientHandler { UseDefaultCredentials = true, }; this.InitializeHttpClient(handler); This does not work, I get: System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The remote server returned

Custom 401 error page for ASP.NET MVC application

ⅰ亾dé卋堺 提交于 2020-01-03 08:30:12
问题 I created an ASP.NET MVC application that uses integrated Windows Authentication. The following authorization logic was implemented: Try to get account credentials from active directory through NTLM. If credentials are received and the Windows account has required permissions then perform requested action. In otherwise go to clause 2. Display the Windows authentication dialog, so a user can provide another credentials: If another credentials are received and the user has required permissions

Want Forms and Windows authentication to work in combined mode

匆匆过客 提交于 2020-01-03 05:22:09
问题 I am working on application which a´has two types of users external user and internal user(domain user). Now for internal user should directly take users to landing page without asking for username and password. And for external user which are public it should display a form asking for username and password. So I am confused to proceed with such scenario. 回答1: I've done it a couple of times. I haven't used this, but there is a project called OWIN-MixedAuth that might help. Even if that doesn

ASP.NET MVC - Custom IIdentity or IPrincipal with Windows Authentication

六月ゝ 毕业季﹏ 提交于 2020-01-03 04:53:07
问题 I am working on an intranet site with Windows Authentication for logins. However, I want to extend the IPrincipal to have other properties. For instance, I'd like to get the user's FirstName in @User.FirstName or User.AuthorizedActivity("Admin/Permissions/Edit") (would retrieve from db) using activities instead of roles to hide certain links, etc. I am really having a heck of a time figuring this out over the past 2 days and find much information doing this with Windows Authentication. My

windows authentication with ADFS on standalone application

这一生的挚爱 提交于 2020-01-03 03:25:25
问题 I have this Windows console application which is trying to perform windows authentication against ADFS. I'm already able to authenticate by using username/password but I don't want to do it this way since the user has already been authenticated in Windows. I have this code: //Setup the connection to ADFS const string adfsEndpoint = "https://iis.dev.lab/adfs/services/trust/13/windowsmixed"; var factory = new WSTrustChannelFactory(new WindowsWSTrustBinding(SecurityMode

ASP.NET -> WCF Service requires Windows authentication

一曲冷凌霜 提交于 2020-01-02 14:05:50
问题 I've been tasked with building a basic admin app. The app needs an ASP.NET front end which talks to a number of back end services using WCF. One requirement is that the users of the app are authenticated using Windows authentication. I can do this no problem if the app logic were contained in the ASP.NET app, but I have no idea how to perform authentication within the back end WCF services? Is it possible to pass credentials through to a WCF service and have it perform the authentication? 回答1

MVC Custom Role Provider not being hit

安稳与你 提交于 2020-01-02 07:51:36
问题 I added a custom role provider but for whatever reason its not being used, it seems like the default is keep getting used. Here is my code for custom role provider namespace Models.Security { public class MatchMakerRoleProvider: RoleProvider { public override string[] GetRolesForUser(string username) { username = username.Split('\\')[1].ToLower(); using (var db = new EncodingEntities()) { var user = db.Admin_Users.FirstOrDefault(u => u.UserName.Equals(username, StringComparison

MVC Custom Role Provider not being hit

大憨熊 提交于 2020-01-02 07:51:10
问题 I added a custom role provider but for whatever reason its not being used, it seems like the default is keep getting used. Here is my code for custom role provider namespace Models.Security { public class MatchMakerRoleProvider: RoleProvider { public override string[] GetRolesForUser(string username) { username = username.Split('\\')[1].ToLower(); using (var db = new EncodingEntities()) { var user = db.Admin_Users.FirstOrDefault(u => u.UserName.Equals(username, StringComparison

How would an HttpModule for Custom Authentication interact with Windows Authentication?

匆匆过客 提交于 2020-01-02 03:50:08
问题 I am trying to create a custom HttpModule which controls which users can view a site. I am trying to leverage Windows Authentication to do this. On an individual page, I would probably do something like this: if (HttpContext.Current.User.Identity.Name.Contains("jsmith")) { Response.Write("You do not have the correct permissions to view this site."); Response.End(); } But because I want to make this more configurable at the application level, I would like to use an HttpModule. Here is the

ASP.NET code to detect whether IIS “Windows Authentication” is enabled

不想你离开。 提交于 2020-01-02 01:36:29
问题 I would like to be able to detect, from ASP.NET code, whether IIS currently has "Windows Authentication" "available"? Starting from my application installed and currently running under "Anonymous Access", I want to detect: "Windows Authentication" component has actually been installed in IIS (e.g. some IIS7 have it not installed by default); and... "Windows Authentication" is actually "Enabled" on my virtual root/location. I want this information to let the Administrator know whether he needs