windows authentication in web api 2 - c#

I create angular js application for client side and for server side I use asp.net web api2.
Now I want to integrate windows authentication for this application.
How to integrate Windows authentication for this scenario.
I not want simple iis based windows authentication in web api 2.

If you are opting for OWIN hosted Web API,
using (WebApp.Start(url, (app) =>
{
HttpListener listener = (HttpListener)appBuilder.Properties["System.Net.HttpListener"];
listener.AuthenticationSchemes = AuthenticationSchemes.IntegratedWindowsAuthentication;
...
}

Related

AZURE AD Authentication with Federation Single sign on Protocol for ASP.NET 4.7.2 web application hosted on azure web app service

I am new to azure and I wanted to implement AZURE AD with Federation single sign on protocol authentication for my web application which is hosted in azure app service.
Does anyone know how I achieve 'Federated claims-based authentication and single sign-on' across .NET Web Application?
Application Details: ASP.NET web application (.NET version 4.7.2)
Can you please help me with the process.
Thanks in advance.

How to use SignalR in ASP.NET Webforms (C#) & Web API for user based notification when Inser/Update/Delete in SQL Server like Facebook?

I am new to SignalR. I've a ASP.NET web form application & Web API project (Not Core), both are different projects. I need to get notification in web form app when there is any change in a table (SQL Server) like in Facebook. Web app is a user login based so I need to send notification to a specific user.
Should I use SignalR Self Host solution to get notification in website & mobile app or other solution?

Remove Arrafinity Cookie from API requests

Context: I am working on a web form application hosted using an Azure App service. The WebForm application is hosted together with a WebApp project
I would want that API requests from Angular no longer pass the Arrafinity cookie ( which is HttpOnly), or that the the cookie is ignored by just the API.
How could I achieve this ? ( The API is stateless, the Web Form is not )
ARR Affinity can be disabled on the Web App Configuration General Settings tab. See this article for more details.

Use SAML Authentication from self hosted wcf

I want to use SAML authentication in my web application.
This application is for some reasons not hosted in IIS, but runs as standalone WCF service. Http request are handled within wcf, and all files of the website are returned by wcf
With IIS, i would use the modules WSFederationAuthenticationModule and SessionAuthenticationModule in order to bootstrap the SAML support.
Is it possible to support SAML authentication without IIS?
How can i setup WCF in order to support SAML authentication without IIS?
if you use owin to self-host your wcf service then yes you can. Just look at the examples of setting up saml using owin
http://leastprivilege.com/2013/10/31/adding-saml11-and-saml2-support-to-katanaowin/

Windows 8 Web Authentication Broker can't connect to the service

Can Web Authentication Broker be used with a non oAuth authentication ?
I have created an Asp.Net MVC2 website with a login page that I want to use through Web Authentication Broker to retrieve and persist the authentication cookie.
Here is the code :
WebAuthenticationResult WebAuthenticationResult = await WebAuthenticationBroker.AuthenticateAsync(
WebAuthenticationOptions.None,
new Uri("https://localhost:44301/Account/LogOn"),
new Uri("https://localhost:44301/"));
When loaded the WAB returns the following message "Can't connect to the service" and when looking to the event viewer there is a navigation error event.
Is something wrong with my code or there is no way to connect to a cookie based login page ?
Web Authentication Broker is meant for WinRT applications.
In your case you have several options.
Use DotNetOpenAuth directly
Upgrade to MVC4 and use the support provided via ASP.NET 4.5's addition of the oAuth functionality included in the default templates. See Using oAuth Providers with MVC
It's super easy to integrate into your MVC app.

Categories