active-directory-b2c-dotnet-webapp-and-webapi | combined sample for a .NET web application | Azure library

 by   Azure-Samples JavaScript Version: 238236 License: MIT

kandi X-RAY | active-directory-b2c-dotnet-webapp-and-webapi Summary

kandi X-RAY | active-directory-b2c-dotnet-webapp-and-webapi Summary

active-directory-b2c-dotnet-webapp-and-webapi is a JavaScript library typically used in Cloud, Azure applications. active-directory-b2c-dotnet-webapp-and-webapi has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

page_type: sample description: "The sample covers calling an OpenID Connect identity provider (Azure AD B2C) and acquiring a token from Azure AD B2C using MSAL." languages:.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              active-directory-b2c-dotnet-webapp-and-webapi has a low active ecosystem.
              It has 237 star(s) with 212 fork(s). There are 62 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 16 open issues and 66 have been closed. On average issues are closed in 390 days. There are 5 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of active-directory-b2c-dotnet-webapp-and-webapi is 238236

            kandi-Quality Quality

              active-directory-b2c-dotnet-webapp-and-webapi has 0 bugs and 0 code smells.

            kandi-Security Security

              active-directory-b2c-dotnet-webapp-and-webapi has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              active-directory-b2c-dotnet-webapp-and-webapi code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              active-directory-b2c-dotnet-webapp-and-webapi is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              active-directory-b2c-dotnet-webapp-and-webapi releases are available to install and integrate.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of active-directory-b2c-dotnet-webapp-and-webapi
            Get all kandi verified functions for this library.

            active-directory-b2c-dotnet-webapp-and-webapi Key Features

            No Key Features are available at this moment for active-directory-b2c-dotnet-webapp-and-webapi.

            active-directory-b2c-dotnet-webapp-and-webapi Examples and Code Snippets

            No Code Snippets are available at this moment for active-directory-b2c-dotnet-webapp-and-webapi.

            Community Discussions

            QUESTION

            why the forgot password link doesn't redirect to my app?
            Asked 2021-Feb-28 at 11:49

            I've set up my asp.net mvc app according to this sample and if you see that line in startup.auth.cs, it says that when the user clicks on "Forgot Password" link, it should redirect to my app at which point it should catch that error in the line 101 that I've linked to and then redirect the user to the proper reset password flow.

            However, when clicking forgot password, the flow is never directed back to my app, but rather I see this screen:

            Where can I check as to why this happens? Is this supposed to be in my sign in policy or is there some setting in application or tenant?

            ...

            ANSWER

            Answered 2021-Feb-28 at 11:49

            This happens if you enable development mode in your custom policy. Either remove the lines, or set it to DeploymentMode:Production.

            https://docs.microsoft.com/en-us/azure/active-directory-b2c/troubleshoot-with-application-insights

            Source https://stackoverflow.com/questions/66408696

            QUESTION

            How to access two separate Web APIs protected using Azure AD B2C from a web app
            Asked 2020-Nov-25 at 15:16

            We have two separeate dotnet core apis(API1 & API2) that are protected using azure ad b2c. Both these apis are registered on the b2c tenant and have their scopes exposed. We have a client web applicaiton that is to access the above protected apis. This web app has been registered as a applicaiton in b2c tenant and has api permissions set for the above apis with proper scopes defined.

            We use MSAL.net with a signinpolicy to sign the user in to the web app. the authentication call requires scopes to mentioned. So we add API1's scope in the call. (note : one scope of a single resource can be added in a auth call shown below)

            ...

            ANSWER

            Answered 2020-Nov-25 at 13:47

            A single access token can only contain scopes for a single audience.

            You have 2 options:

            1. Combine both services into a single app registration and expose different scopes.
            2. Request multiple tokens - one per service. If your SSO policy is configured correctly in B2C, this should happen silently unbeknownst to the user.

            I recommend using option 1 if you own both services (which it sounds like you do). A few tips related to this option.

            • When declaring the scopes in the combined app registration, use the dot-syntax {LogicalService}.{Operation}. If you do this, the scopes will be grouped by logical service within the Azure portal.
            • Make sure you are validating scopes in your service. Validating only the audience is not good enough and would allow an attacker to make lateral movements with a token bound for another service.

            Source https://stackoverflow.com/questions/65003748

            QUESTION

            How do I call more than one web API from a web app (Azure B2C)
            Asked 2020-May-01 at 01:31

            I've been following the tutorial here: https://github.com/Azure-Samples/active-directory-b2c-dotnet-webapp-and-webapi and have managed to get a web app authenticating with Azure B2C. I have also managed to get the web app to call ONE web API as instructed in the template.

            My question is how do you call more than one API using this method? I may have 4-5 web API's set up as in the example and want to call all of them from a single web app. Is this possible? If so are there any examples I can take a look at?

            Thanks.

            ...

            ANSWER

            Answered 2020-May-01 at 01:31

            You should be able to get a refresh_token after the authorization is finished.

            Use this refresh_token to exchange another access_token with the scope of another web application. Like this:

            Then we can get an access_token for another scope:

            See details from Refresh the access token.

            BTW, OBO flow seems to work for you as well. It allows an application to invoke a service/web API, which in turn needs to call another service/web API.

            Source https://stackoverflow.com/questions/61527682

            QUESTION

            Where should I perform (groups/roles equivalent) in B2C with OIDC and OAuth / API access?
            Asked 2020-Apr-24 at 16:30

            I'm looking at the B2C API demos, and API documentation and I'm unable to determine the preferred method for managing authorization.

            Azure AD supports assigning AD Users/Groups to apps, and also roles. Seemingly B2C doesn't support this. (I experimented by using AAD tasks against a B2C tenant. Hopefully I did it correctly)

            Given that a singular B2C tenant will offer web sign in, and most likely API access as well, what is the benefit of creating more than one scope as exhibited in the TodoList:TodoListScope.

            • Can I conditionally add additional scopes? Using B2C or store it in the graph/application somewhere?

            https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/tree/master/4-WebApp-your-API/4-2-B2C

            • Or more abstractly, how should I perform authorization to the many different APIs (and apps) when an id_token is exchanged for an access_token?

            Perhaps API Management will give me ideas on how to perform RBAC or other permissioning. Added them as a tag as well

            ...

            ANSWER

            Answered 2020-Apr-24 at 16:30

            There is an RBAC Github sample here that requires you to use work accounts which are called "B2C Users" in the portal below.

            Users created this way, can be added to groups located within Azure Active Directory (by script). Testing still in progress

            Source https://stackoverflow.com/questions/61217863

            QUESTION

            Azure WebApp-WebAPI ->Grant Type authorization_code doesn't return RefreshToken
            Asked 2020-Mar-24 at 01:25

            I've followed this post in relation to this example and made the additions to the portal and code as suggested:

            Portal: Web API - Expose an API - Add Scope for "offline_access" (also tried with format "demo.offline_access"); Web App added "offline_access" permission

            Code: Added offline_access to Start_Auth.cs, Global.cs and both Web.config files.

            I make my request for accessToken and refreshToken as per documentation with:

            ...

            ANSWER

            Answered 2020-Mar-24 at 01:25

            https://XXX.onmicrosoft.com/api/offline_access is a permission you customized in your web api app. It's not for getting a refresh token.

            You just need to use offline_access here.

            Source https://stackoverflow.com/questions/60811119

            QUESTION

            a method to retrieve id_token from Azure AD body request
            Asked 2020-Mar-21 at 22:09

            I'm following this WebApp-WebAPI example. Is there a method to retrieve an id_token after a B2C user is authorized and the id_token is received within the body? I'm on Function app V3.

            I receive the authorization response to replyURL in an azure Function app but the id_token coming in a body mixed with code and state data, and I can't seem to break it out or deserialize to json:

            ...

            ANSWER

            Answered 2020-Mar-21 at 22:09

            The data is sent to you as form data, not JSON.

            You need to use something like this:

            Source https://stackoverflow.com/questions/60792451

            QUESTION

            How to hook into AuthorizationCodeReceived when using AddAzureADB2C?
            Asked 2020-Jan-10 at 02:14

            I've created a simple Blazor server application linking to an Azure B2C directory for authorization. Everything works but I need to add additional role claims to the token. Research has pointed me to this SO post which refers to adding the claims during the AuthorizationCodeReceived notification(Example here).

            I understand what I need to do, but the example is using OpenIdConnectAuthentication (from Microsoft.Owin.Security.OpenIdConnect) instead of Blazor server's Microsoft.AspNetCore.Authentication.AzureADB2C.UI.

            How can I still access and amend the claims in the token once it's received? Is such a thing supported in Microsoft.AspNetCore.Authentication.AzureADB2C.UI or should be switching to OpenId?

            Below is the boilerplate included in a basic Blazor server application but the AzureADB2COptions are all just string config values.

            ...

            ANSWER

            Answered 2020-Jan-10 at 02:14

            You can try to override the specific schema after AddAzureADB2C , then register your events like :

            Source https://stackoverflow.com/questions/59664401

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install active-directory-b2c-dotnet-webapp-and-webapi

            You can download it from GitHub.

            Support

            Please file any questions or problems with the sample as a github issue. You can also post on StackOverflow with the tag azure-ad-b2c.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries

            Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link