Bypass windows Aunthentication - anonymous

We have developed a MVC Application and it's Windows Authentication enabled,
(Web.config - AuthenticationMode="Windows").
But we have requirement where a set of pages need to be behaved as Anonymous aunthentication.
Since a web.config is pointed to Windows Authentication , Our application is always prompting Domain user Name & Password when user access to any pages.
We have tried CustomAuthorize & IAunthenticationFilter to bypass the windows Authentication But it is still prompting the User Name and Password.
Is there any way to Implement Anonymous Authentication for few pages/Controllers while rest of the pages/controllers running in the windows Authentication Mode ?
Or
Is there any way to feed the Domain user id and Password programatically ?

Related

Login page - simple, secure way to implement authentication against active directory?

I'm creating a small web app running on IIS and I need to implement a secure way to handle login authentication against active directory.
Currently, I have it set up with Windows authentication, so when users first go to the website it shows the login prompt from the browser, they login using their AD credentials, and then it allows them into the site.
However, I want to have an actual login page and have these credentials validated against AD instead of Windows Authentication. I've been researching for hours about LDAP but I can't seem to find good documentation/videos on how to set it up to communicate with AD. I've thought about using 3rd party services like Okta but I don't think I need to.
Does anyone have any ideas?

Authentification with Windows Auth NTLM

There is a WebAPI hosted in IIS. It is using Windows authentification with NTLM protocol only. If I am trying to reach it with chrome extension which gives me the ability to send REST requests, chrome prompts me for credentials and this is the part I dont understand why? Windows auth is the one that should take my information from my windows login isnt it? It is not forms auth. Of course it happens the first time only, if you are reaching it multiple times it just returns the token, but I guess its just the session things.
I feel that I am missing something and dont have enough knowledge about it so any information would be nice.
Question:
Why windows auth is prompting for credentials when I am trying to authenticate to my WebAPI the first time? Shouldnt it handle this automatically based on my windows login information?
Thank you
Windows authentication means it will validate the username and password of the user available in the directory listing of the hosted server.
And after you enter the credentials once then the browser will manage it further.
If you close that tab and open the url in new tab then also it will not prompt again unless the browser is not closed and reopened.
It is not possible to handle windows login automatically without login prompt box.

Authentication Require Enter username and password to http://www

I am getting window authentication window popup on some of my views in mvc4. It works fine when I host it on local server. But when I upload my code to my hosting server, all the views works fine except some views.
I am using form authentication in my application. And the views which given me such popups their controller class define with [Authorize] attribute. Is it an issue with IIS on hosted server or something else?
This is the popup message:
I suspect that you have Integrated Windows Authentication or Basic Authentication configured in IIS for your website or application (depending on how you are hosting it). Make sure you disable it and enable anonymous access to the website if you want to use Forms Authentication.
Open IIS Manager and navigate to your website or application.
In Features View, double-click Authentication.
On the Authentication page, disable Windows authentication and enable Anonymous authentication.

asp.net 4.5 mixing forms and windows authentication

I'm starting a new ASP.NET 4.5 web forms application and one of the requirements is that there is the user to login with windows authentication if available or login using forms authentication if the user is not a member of the domain.
Additionally, there are 2 scenarios, above is the first one for if the user is on the internal network the other is if the user is accessing the application externally (https). In that case a prompt for user name and password should be able to authenticate either user type, be they a windows user or forms/application user.
Are these two options even possible? If so, how would I accomplish this?
I have combed the web for a few days now and everything I've seen so far is dated so I'm not sure if they are the best solution or if they will even work.
TIA

Basic Authentication in REST WCF

I have developed one REST WCF and would like to client will use it with basic Authentication, I have hosted this service in IIS 7.0 and disabled all authentication except Basic Authentication.
Now problem is that when call this service from any other application (in my case i am calling this from ruby command prompt) with Header "Basic bXlhZGRvbjpDcFplcUc5MzlHdDZQMEtD" although i was not able to authenticate this service.
Make it more simple , when i will access this service (.svc) from browser due to basic Authentication
it will prompt to enter username & password , so which residential i need to pass here and to which credential i need to compare (weather i need to set in web.config or IIS)??
Thanks in Advance
Arun.
For basic authentication, IIS would always try to validate the userName & Password as a windows users (either local or domain user).
Dominick has created a Basic Http Authentication module which let's you use other credential stores with Basic Authentication.
http://www.leastprivilege.com/HTTPBasicAuthenticationAgainstNonWindowsAccountsInIISASPNETPart3AddingWCFSupport.aspx