I've been asked to integrate a new web app with our B2C implementation and the requirement is to support the Grant Flow with PKCE.
Does B2C/IEF support this? Any pointers as to steps required?
I'm hopeful as I've found this reference in the AD docs, which references code_challenge and code_challenge_method parameters in the request to the /authorize endpoint.
Thanks
Mark
According to this developer announcement and this documentation issue, it is supported, although it isn't enabled for the implicit flow AFAIK.
it sounds like you are trying to create a web based application that can only use Auth code with PKCE per the new OAuth guidelines. Please refer to the following post in regards to the new OAuth rules and Microsoft's Auth process : https://developer.microsoft.com/en-us/identity/blogs/our-thoughts-on-implicit-grant-with-microsoft-identity/
Microsoft's suggestion is to utilize the Microsoft Libraries to do authentication, that is using either ADAL/MSAL.
As it's a B2C Application you will want to use MSAL. For more information on using MSAL please refer to : https://learn.microsoft.com/en-us/azure/active-directory/develop/msal-b2c-overview
Related
All the Microsoft guides, tutorials and samples that I find on B2C and Authorization Code Flow use Implicit Grant Flow or refer to another guide that uses Implicit Flow.
Here is an example of their outdated Implicit Flow guide for B2C:
Register a web application in Azure Active Directory B2C
This guide is linked to (or an almost identical guide is used) in all the Auth Code Flow guides I have found.
Do any of you know if Microsoft has a guide, that honors the subject of the guide "auth code flow b2c" and actually shows how to setup Auth Code Flow in Azure B2C?
Maybe I am overlooking something obvious?
It does, the page you've linked to there is the basic tutorial, what you actually need is the Authorization code flow page which also includes some info about PKCE for SPAs and links off to sample apps showing the use of MSAL.
There's also a page about creating an app registration for SPAs that highlights the difference between using code flow with PKCE and implicit, recommends code, and walks you through the same kinds of steps as in your linked page but targeted at SPAs.
As mentioned in that second link, if you want to enable the implicit flow for your app registration then under Implicit grant, select both the Access tokens and ID tokens check boxes. Because you don't want to enable implicit flow then don't check those two boxes and your app registration will only support code flow. If you do check those boxes then it will support both implicit and code flow.
Current State: I have a mobile application that signs users into Azure AD via OAuth using the PKCE flow. Once authenticated, the app uses a token to get various forms of data from some APIs.
As the application has evolved, the need to integrate SSO with another web application has come up (and there will be further service providers added as we move forward). It will act as a service provider and it supports IDP initiated authentication via SAML.
Question: once this service provider is configured under the AD tenant, is there a way to exchange or translate our OAuth token for something that can be passed on to the the SAML SP without having to re-authenticate? Am I even thinking about this in the right way? I'm mainly curious if we will need to re-implement authentication in the mobile app to support SAML (i.e. stand up some sort of web-based SAML service that can act as a proxy for the mobile application)? If that route is a necessity to accomplish our requirements, I'm assuming there's a way to still get a valid OAuth or equivalent token we can use to send to our APIs.
Apologies if this is a repeat question, but I couldn't find anything with similar specifics. Thanks in advance!
You can surely use the OAuth 2.0 OBO flow that allows an OAuth2-based application to access web service API endpoints that consume SAML tokens. You can read more here and it has some really good guidance on how to achieve the same:
https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow#saml-assertions-obtained-with-an-oauth20-obo-flow
Make sure that you SAML request is well formulated per the details mentioned here:
https://learn.microsoft.com/en-us/azure/active-directory/develop/single-sign-on-saml-protocol
So I recently started exploring Azure Identity Platform for this user authorization use case I'm trying to implement. After a bit of research I came across using Graph API and creating ROPC flows to handle SingUp and Login via REST API from my application. My requirement is also to allow users to use login credentials from another app (I'm not sure yet if it implements a SAML based Identity Provider method) to use services in my application. This is a typical SSO requirement, but I'm not sure if it is possible to implement alongside username-password based authentication using Azure AD B2C.
I would appreciate any leads. Thank you.
Edit: To be more precise, I am working with Java-Spring. The demo application mentioned in Azure AD documentation (Woodgrove groceries) is exactly what I'm trying to achieve. A quick google search for the same provides me with github repos with sample code that uses .Net I believe. Are there any Java sample codes that demonstrate the same?
ROPC does not support SSO if that's what you want to achieve.
Please help me.
To login into Azure active directory how to use MSAL.Net library in my login page of my website.I am seeing very big samples online but I didnt find small peace of code which makes me to understand MSAL.
MSAL Library is just an implementation for enabling developers to acquire tokens from the Microsoft identity platform endpoint.
If you want to use MSAL to acquire a token, you need to:
Register an application in Azure AD.
Add target API, and grant consent to select permissions.
Generate a secret key.
Then you can get a token as Acquire a token and call Microsoft Graph API.
However, I think what you really want is to integrate AAD. You can easily enable AAD authentication for your .NET web application. It uses OWIN middleware.
If you are using a aspnet or aspnetcore, you can get the necessary code needed to sign in your web application with your Azure AD tenant just by following steps.
Create the sample from the command line
Note that MSAL.NET is a token acquisition library (for services like MS Graph and such) that can optionally sign-in users as well. the sign-in code is present in the aspnet and aspnet core SDKs
Is it possible to request a security token on java or C# from AD FS using implicit grant flow ? It looks like that is only possible in JS (in a browser). Thank you in advance for your answers.
ADFS 3.0 only supports authorization code grant.
ADFS vNext (Server 2016) will support this.
Azure AD also supports this currently.