active-directory-dotnet-webapp-openidconnect-aspnetcore | NET Core web application that signs-in Azure AD | Azure library

 by   Azure-Samples HTML Version: 1.0 License: No License

kandi X-RAY | active-directory-dotnet-webapp-openidconnect-aspnetcore Summary

kandi X-RAY | active-directory-dotnet-webapp-openidconnect-aspnetcore Summary

active-directory-dotnet-webapp-openidconnect-aspnetcore is a HTML library typically used in Cloud, Azure applications. active-directory-dotnet-webapp-openidconnect-aspnetcore has no vulnerabilities and it has low support. However active-directory-dotnet-webapp-openidconnect-aspnetcore has 2 bugs. You can download it from GitHub.

An ASP.NET Core web application that signs-in Azure AD users from a single Azure AD tenant.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              active-directory-dotnet-webapp-openidconnect-aspnetcore has a low active ecosystem.
              It has 134 star(s) with 56 fork(s). There are 72 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 0 open issues and 35 have been closed. On average issues are closed in 322 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of active-directory-dotnet-webapp-openidconnect-aspnetcore is 1.0

            kandi-Quality Quality

              active-directory-dotnet-webapp-openidconnect-aspnetcore has 2 bugs (0 blocker, 0 critical, 1 major, 1 minor) and 0 code smells.

            kandi-Security Security

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

            kandi-License License

              active-directory-dotnet-webapp-openidconnect-aspnetcore does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              active-directory-dotnet-webapp-openidconnect-aspnetcore releases are available to install and integrate.
              It has 7728 lines of code, 0 functions and 20 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            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-dotnet-webapp-openidconnect-aspnetcore
            Get all kandi verified functions for this library.

            active-directory-dotnet-webapp-openidconnect-aspnetcore Key Features

            No Key Features are available at this moment for active-directory-dotnet-webapp-openidconnect-aspnetcore.

            active-directory-dotnet-webapp-openidconnect-aspnetcore Examples and Code Snippets

            No Code Snippets are available at this moment for active-directory-dotnet-webapp-openidconnect-aspnetcore.

            Community Discussions

            QUESTION

            Changing default access denied path when integrating Azure AD into an ASP.NET Core web app
            Asked 2020-May-27 at 09:55

            I am trying to change the default access denied path when authorization is denied when using Azure AD.

            For example, when working with Microsoft's example of "Integrating Azure AD into an ASP.NET Core web app" seen here: https://azure.microsoft.com/en-us/resources/samples/active-directory-dotnet-webapp-openidconnect-aspnetcore/

            The article reference an example project on GitHub see here : https://github.com/Azure-Samples/active-directory-dotnet-webapp-openidconnect-aspnetcore.

            I am having difficulties configuring the options inside Startup.cs to change the default controller/method for access denied (which is "Account/AccessDenied").

            Can someone please help provide the required changes to the github sample project above so that an unauthorized user is taken to a different path when they are denied authorization other than the default "Account/AccessDenied"?

            UPDATE: I added what @Brad suggested in the startup prior (and again now) in my project, but it didn't change, and I'm still being directed to "Account/AccessDenied"... can you think of any other setting that might govern this?

            For my project (the automatically created ASP.NET Core Web Application - Web Application (Model-View-Controller) using Work or School Accounts Authentication in Visual Studio 2017), which is different than the example project, I am referencing the NuGet package "Microsoft.AspNetCore.Authentication.AzureAD.UI" and setting up my AzureAD in the following way (please note using .AddAzureAD and not .AddAzureAd):

            ...

            ANSWER

            Answered 2018-Aug-14 at 04:13

            This is configured in the cookie authentication options.

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

            QUESTION

            Authenticate with Azure AD using ASPNET Core 2 from behind Corporate Proxy
            Asked 2019-Nov-20 at 15:49

            I have an ASPNET Core 2 application which I am trying to Authenticate with Azure AD using OpenId. I just have boilerplate code from selecting Single Organization Authentication in the ASPNET Core 2 templates, so no custom code. I followed the article here.

            The app is not able to get metadata from the Azure AD application because of proxy. The same URL returns data if I just paste it in browser.

            The error I get is:

            HttpRequestException: Response status code does not indicate success: 407 (Proxy Authentication Required).

            System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode() IOException: IDX10804: Unable to retrieve document from: 'https://login.microsoftonline.com/my-tenant-id/.well-known/openid-configuration'.

            Microsoft.IdentityModel.Protocols.HttpDocumentRetriever+d__8.MoveNext()

            I have another ASPNET 4.5.2 application where I am able to perform authentication with the same Azure AD app as above after setting proxy in code like below:

            ...

            ANSWER

            Answered 2018-Apr-03 at 05:32

            In Full .net framework setting up a proxy is using a config setting entry but to use an HTTP proxy in .net core ,you have to implement IWebProxy interface.

            Microsoft.AspNetCore.Proxy is proxy middleware which serves a different purpose (to setup reverse proxy) not as an http proxy .Refer this article for more details

            To implement a webproxy in .net core,

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

            QUESTION

            Cookie not expiring for Azure AD auth
            Asked 2019-Oct-07 at 08:23

            I am adding Azure AD Authentication to an ASP.NET Core application. The Application is registered in Azure AD and has custom roles setup in the manifest. These roles are used for Authorization policies within the app. Everything is working when users log in, they get redirected to sign in to Azure and come back with a Cookie containing their Claims.

            My issue is that unless the Cookie is deleted in the browser, these Claims persist and aren't refreshed when Roles in Azure change. For example if a User signs in, then I remove them from a Role, they will still be seen as in that Role by the application.

            I tried setting a 1 minute expiration to the Cookie, but it doesn't have an impact and I still have the same issue. Here is how the auth is configured in Startup. (AddAzureAd() comes from this example: https://github.com/Azure-Samples/active-directory-dotnet-webapp-openidconnect-aspnetcore/blob/master/Extensions/AzureAdAuthenticationBuilderExtensions.cs):

            ...

            ANSWER

            Answered 2019-Oct-04 at 08:11

            But why does ExpireTimeSpan not do anything and accept Cookies older than 1 minute?

            An absolute expiration time can be set with ExpiresUtc. To create a persistent cookie, IsPersistent must also be set. Otherwise, the cookie is created with a session-based lifetime and could expire either before or after the authentication ticket that it holds. When ExpiresUtc is set, it overrides the value of the ExpireTimeSpan option.

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

            QUESTION

            Execute code after Azure AD Authentication
            Asked 2019-Apr-12 at 03:20

            I was able to get this example working https://azure.microsoft.com/en-us/resources/samples/active-directory-dotnet-webapp-openidconnect-aspnetcore/

            My question is how to do something additional after authentication. For example, on a typical Login page, in the POST after validating, I could set a log record for the user or set additional cookies.

            With Azure AD integration I'm not sure where to put such code that should be executed only once the user has been authenticated. The reply URL (call back path) does not work for this purpose (I tried putting my custom page here and it really didn't get executed. Apparently the middle-ware creates a special route for that end point so that it can process the login token data)

            Any help is appreciated!

            ...

            ANSWER

            Answered 2019-Apr-12 at 03:20

            There are some OpenIdConnectEvents which could be used to enable developer control over the authentication process.

            For example , OnAuthorizationCodeReceived is invoked after security token validation if an authorization code is present in the protocol message. The event could be used to get access token for accessing API using authorization Code using ADAL/MSAL in Code/Hybrid Flow :

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

            QUESTION

            Making requests to Azure Management
            Asked 2019-Mar-28 at 03:41

            I have completed the guide here to add Azure AD authentication to my application:

            https://azure.microsoft.com/en-gb/resources/samples/active-directory-dotnet-webapp-openidconnect-aspnetcore/

            and can log in successfully, have a service principal and everything works as expected.

            I now want to make web requests as the user, but can't see how to get the authentication details to send in the request, I've tried looking through the ClaimsPrincipal.Current object, but there is nothing i can pass to a HTTP client to make the request.

            ...

            ANSWER

            Answered 2019-Mar-28 at 03:41

            The sample web app you refered to only signs the user in, but you need to get the access token on behalf of that user to access the api.

            You can refer to this sample. This sample calls another webapi, you can ignore that part, just change the resource to https://management.core.windows.net/

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

            QUESTION

            User is authenticated after OpenId Connect (AAD) but Unable to find access token
            Asked 2019-Feb-21 at 07:22

            I am trying to find the access token from AAD after user is authenticated from OpenId Connect. It is a web application integrated with AAD OpenId Connect. I need to get the access token to call another API that uses the same AAD. Here's what I've tried:

            1. Clone this sample code.
            2. In Startup.cs file, add the following block of code:

              ...

            ANSWER

            Answered 2019-Feb-21 at 07:21

            You need to set SaveTokens to true in OpenID Connect configuration:

            1. Clone that code sample
            2. Keep the Startup.cs , you don't need to add .AddOpenIdConnect part , AddAzureAd extension method would help add Azure Active Directory Authentication to your application.

            3. Modify the AzureAdAuthenticationBuilderExtensions.cs in Extensions folder :

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

            QUESTION

            ASP Core Azure Active Directory - Get First and Last Name
            Asked 2018-Oct-15 at 13:13

            I created an Azure Active Directory Application and applied the code from the following tutorial to enable login: https://azure.microsoft.com/en-us/resources/samples/active-directory-dotnet-webapp-openidconnect-aspnetcore/

            After login the following returns my email adress:

            ...

            ANSWER

            Answered 2017-May-12 at 18:37

            QUESTION

            OpenIdConnect wrong redirection after authentication and granting authorizations
            Asked 2018-Sep-04 at 09:06

            I've setup a .NET Core 2.0 webapp with Azure AD using OpenIdConnect (like this one: https://github.com/Azure-Samples/active-directory-dotnet-webapp-openidconnect-aspnetcore, all the OpenIDConnect configuration is located here).

            I have the following scenario:

            • call of http://localhost/my-api-function
            • redirection to microsoftonline.com
            • choose a Microsoft account I haven't already logged in to this app
            • enter password
            • accept the requested authorizations (the API app registration grants Graph API access to user profile). See the attached screenshot.
            • I get redirected to http://localhost/signin-oidc with the following error:

              OpenIdConnectProtocolException: Message contains error: 'invalid_request', error_description: 'AADSTS90008: The user or administrator has not consented to use the application with ID 'xxxxx'. This happened because application is misconfigured: it must require access to Windows Azure Active Directory by specifying at least 'Sign in and read user profile' permission.

            I think I may have an incorrect redirection after login. I expect to be redirected to http://localhost/my-api-function rather than http://localhost/signin-oidc

            I have another working scenario:

            • call of http://localhost/my-api-function
            • redirection to microsoftonline.com
            • choose a Microsoft account I have already logged in to this app then logged out
            • enter password
            • not prompted again to accept the requested authorizations (the API app registration grants Graph API access to user profile).
            • I get redirected to http://localhost/my-api-function as expected and get my protected data.

            In Azure AD, I've configured the following reply-url: http://localhost/signin-oidc and granted both "Windows Azure Active Directory" and "Microsoft Graph" APIs to "sign in and read user profile".

            Thanks for any pointers.

            Edit of 08/22: I understood that redirection seems to redirect to previous url in authentication flow so posted to MS Forums with this more specific indication to look for a solution.

            ...

            ANSWER

            Answered 2018-Sep-04 at 09:06

            The solution was to grant permissions by clicking a button located above the permissions lists.

            More details here

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

            QUESTION

            Azure AD /signin-oidc 404 - NGINX reverse proxy with .NET Core 2.0
            Asked 2018-Jul-13 at 12:56

            I have a .NET Core 2.0 application running in a Kubernetes cluster with Linux containers. In front of the application I have an Nginx reverse proxy that is set up with LetsEncrypt, SSL termination, and forwarding http to the app.

            My app successfully authenticates and redirects locally (without reverse proxy) and is based on the sample form here: https://github.com/Azure-Samples/active-directory-dotnet-webapp-openidconnect-aspnetcore

            When deployed, this setup initially caused issues with the app attempting to authenticate users by switching from https://my.domain.cloudapp.azure.com to http://my.domain.cloudapp.azure.com. As a result my reply URL (https://my.domain.cloudapp.azure.com/signin-oidc) was not being used and I received an error.

            I was able to fix this with information from here and here and specifically I added:

            ...

            ANSWER

            Answered 2018-Jul-13 at 12:56

            I ended up having two problems that were causing this issue. First, I had multiple pods serving my app in Kubernetes and so I needed to persist the encryption/decryption keys for the cookies to a central location.

            The second issue was that the reverse proxy was rewriting the reply url. My project changed a little since my original post and I switched to OAuth2 Proxy so I'm not sure the exact scenario for Nginx in my original post. However, for Oauth2 Proxy I had to add "https://my.domain.cloudapp.azure.com/oauth2/callback" as a reply url in my app registration.

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

            QUESTION

            ASP Core Azure Active Directory Login use roles
            Asked 2018-May-15 at 04:43

            I created an Azure Active Directory Application and i want to use role based security. I followed the tutorial on: https://azure.microsoft.com/en-us/resources/samples/active-directory-dotnet-webapp-openidconnect-aspnetcore/

            The login works, I added roles to the application manifest and assigned the role Approver to my own account. Now i want to use these roles.

            After login the following works in the controller:

            ...

            ANSWER

            Answered 2017-May-12 at 06:34

            This code sample works for me after assign roles to account . Please debug application in this line: User.IsInRole("Approver"); , check whether {http://schemas.microsoft.com/ws/2008/06/identity/claims/role: Approver}exists in user claims . And make sure you add roles which allowedMemberTypes is user , for example :

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

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

            Vulnerabilities

            No vulnerabilities reported

            Install active-directory-dotnet-webapp-openidconnect-aspnetcore

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

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

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/Azure-Samples/active-directory-dotnet-webapp-openidconnect-aspnetcore.git

          • CLI

            gh repo clone Azure-Samples/active-directory-dotnet-webapp-openidconnect-aspnetcore

          • sshUrl

            git@github.com:Azure-Samples/active-directory-dotnet-webapp-openidconnect-aspnetcore.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link