Integrating IdentityServer3 with ADFS - adfs

Disclaimer: Very new to AD here, so apologies if this is a simple question.
My company exposes a publicly accessible ADFS (https://adfs.xxxxx.com/adfs/ls/?username=...). Whenever we use services such as Azure and Office365 we are able to log in by entering our AD credentials.
I am not sure how to leverage this same ADFS for an application we are building and hosting in the cloud.
I see that IdentityServer3 has WsFederationAuthentication, which would work only if we are logged into our local domain.
Would the app need to be registered with the ADFS?

It sounds like you already have your ADFS connecting to Azure AD (to enable Office365), in which case you should have Identity Server talk to Azure AD via Open ID Connect rather than trying to set up WSFederation. To do that you'd need to have one of your Azure Administrators create an Azure AD App for you, and you set it up like in this example:
var aad = new OpenIdConnectAuthenticationOptions
{
AuthenticationType = "aad",
Caption = "Azure AD",
SignInAsAuthenticationType = signInAsType,
Authority = "https://login.windows.net/4ca9cb4c-5e5f-4be9-b700-c532992a3705",
ClientId = "65bbbda8-8b85-4c9d-81e9-1502330aacba",
RedirectUri = "https://localhost:44333/core/aadcb",
};
app.UseOpenIdConnectAuthentication(aad);

What application are you talking about?
Is it a separate application or do you mean IdentityServer?
And are you trying to authenticate with Azure AD or ADFS?
Could you please describe the use case?
#Igaud's answer describes the case where you want identityServer to hook into Azure AD? The question was "Integrating IdentityServer3 with ADFS" but that's not what was in the body.
Refer: IdentityServer : ASP.NET MVC application to idsrv3 to ADFS .

Related

Single sign-on using ADFS approach

One of my customers wanted to implement SSO using ADFS. I was thinking to do a POC for the same using ADFS in Azure. But one requirement is only some users have ADFS login and other user needs to use custom authentication using the identity provider.
Is it possible to use custom and ADFS authentication in the same web application? Like presenting a page with sign-in using SSO or sign-in with credentials?
My client just shared the federatedmetadata.xml. (Do we need to give the full URL DNS name + metadata URL when you create the new project?).
Is it possible to use custom and ADFS authentication in the same web application? Like presenting a page with sign-in using SSO or sign-in with credentials?
If you're open to it, you could integrate your application with an identity provider, and that provider does this for you.
For example:
Your application integrates with CAS as the IDP, and CAS presents this screen to the end user for the authn attempt. User can choose either option, and then once completed, they will be redirected back to your application to continue, and your application interacts with CAS to validate the user account/session. CAS itself is connected to your own account store, and is also integrated with ADFS.
What do you mean by "ADFS in Azure". The only way to do this is to run ADFS as a VM in Azure. Otherwise, you would use Azure AD.
Yes, you can federate ADFS with other identity providers so they both are accessible from the same login screen.
What other identity providers are you looking at?
ADFS is not a project, it's a server add-on and it's all done via configuration on the Windows server.
In terms of importing metadata, see this.

Asp.net identity caching for azure ad

The issue that currently we are facing is our users in China have delay in signing into Azure Ad.
I want to create an Asp.net application that acts as an identity service provider for other applications.
I want my users to login to my application using their Microsoft live accounts and my application should be able to cache the identities to avoid delay.
Is it possible to implement such a solution?
I tried to repro in my Lab and successfully tested that my user can login without any delay of time below are the steps:
Deployed my ASP. NET application to Azure> Go to APP service> Authentication >ADD identity Provider
In the identity provider>select Microsoft account >By Default App registration will be created /Or we can create new one. >Support account type Select your account type to login users select Any azure AD directory & Microsoft accounts.
After added successfully you can check or edit the identity provider.
And then tested my app which required Microsoft live accounts to sign-in users .
For further information please refer below links :
.To Enable multi-factor authentication in Azure Active Directory B2C.
. Considerations for using caching.

What is the best way to configure an application startup.cs to use both Azure AD and Azure B2C in .netcore? I am new to Identiy providers

What is the best way to configure an application startup.cs to use both Azure AD and Azure B2C in .netcore? I see a lot of referencing indictating to use only Azure B2C, but due to the circumstances I need to use both Identity providers separately giving the users the option to choose which service.
But I am not sure how to go about it, and after configuring the startup, how would I use distinct "Authorize" on the actions within the same controller?
You can use the Azure AD B2C custom policy and Azure ad can be set as an identity provider.The end result is as shown below, where users can choose to log in with an ad account.
Found that adding multiple Azure Active Directory authentication providers in the same app using the current release of the Microsoft Identity Web library is not available (https://github.com/AzureAD/microsoft-identity-web/issues/549 ) but will hopefully be added soon.

What is the difference between identity server 4 open id connect and Azure AD?

What I know about IdentityServer and OpenID connect is:
The IdentityServer is a free, open source OpenID Connect and OAuth 2.0 framework for ASP.NET Core. That incorporates all the protocol implementations and extensibility points needed to integrate token-based authentication, single-sign-on and API access control in your applications.
Further more OpenID Connect is a simple identity layer built on top of the OAuth 2.0 protocol. OAuth 2.0 defines mechanisms to obtain and use access tokens to access protected resources, but they do not define standard methods to provide identity information. OpenID Connect implements authentication as an extension to the OAuth 2.0 authorization process. It provides information about the end user in the form of an id_token that verifies the identity of the user and provides basic profile information about the user.
What I want to know is what is Azure Active Directory and How it is works? Did we use Azure AD with openid connect? or it is optional with openid connect? and If I've an webapi which is based on ASP.Net core 2.0 with identityserver 4. Did we deploy on azure without implement Azure AD? I m confused because I've an webapi project and a client project based on angular. when I deploy my client project as a new web app on azure its running fine. But when I deploy my web api on azure its not working. Means after deploying my web api when I do post request to get a token or when I want to register a user through my azure web api link it shows me 500 error in postman.
After facing this problem I post it on Here Stackoverflow but didn't find any helpful answers. So I again start searching and found that if we want to use openid connect with azure we must implement Azure AD. Here is the Reference. So in this question I want to know the difference between openid connect and Azure AD? and second question is. Is this possible to use openid connect without using Azure AD? Please explain your answer briefly. Thanks

How to mix Azure AD authentication and Windows authentication in MVC 4 app?

I have a design requirement for an ASP.NET MVC 4 (.NET 4.6.1) app hosted on the company server (Not Azure) to do the following:
Check is user is authenticated via Windows Authentication
a)Yes - designate user as "authenticated"
b)No - use OpenIdConnect (OWIN) to authentication using Azure Active Directory.
Once authenticated use the standard [Authorize] attributes on controller methods etc. I have implemented Windows and Azure AD authentication alone is individual MVC apps but never together.
I have found several sources describing how to mix Windows and Forms authentication, but none for this combination.
Does anyone have insights on how this might be achieved?
I had a similar requirement a year ago and my approach was :
The users are redirected to input their AD credentials (https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-how-to-configure-active-directory-authentication/)
Once they are sucessfully logged in on the AD you will get a token.
Then I call the Azure AD API on their behalf using the token I just got. I woulds just call the /me endpoint that will return me the user personal details.
With the above response I just need to check if the email address matches the email address that was initially requested.
If it matches it means the user was successfully validated against the AD.
Then you can proceed and issue that user a token or cookie to access your application.

Resources