active-directory-dotnet-webapi-manual-jwt-validation | manually process a JWT access token | Authentication library

 by   Azure-Samples C# Version: ADAL_final License: MIT

kandi X-RAY | active-directory-dotnet-webapi-manual-jwt-validation Summary

kandi X-RAY | active-directory-dotnet-webapi-manual-jwt-validation Summary

active-directory-dotnet-webapi-manual-jwt-validation is a C# library typically used in Security, Authentication, Swagger applications. active-directory-dotnet-webapi-manual-jwt-validation has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

A Web API that accepts bearer token as a proof of authentication is secured by validating the token they receive from the callers. When a developer generates a skeleton Web API code using Visual Studio, token validation libraries and code to carry out basic token validation is automatically generated for the project. An example of the generated code using the asp.net security middleware and Microsoft Identity Model Extension for .NET to validate tokens is provided below.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              active-directory-dotnet-webapi-manual-jwt-validation has a low active ecosystem.
              It has 99 star(s) with 59 fork(s). There are 56 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 0 open issues and 22 have been closed. On average issues are closed in 401 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of active-directory-dotnet-webapi-manual-jwt-validation is ADAL_final

            kandi-Quality Quality

              active-directory-dotnet-webapi-manual-jwt-validation has 0 bugs and 0 code smells.

            kandi-Security Security

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

            kandi-License License

              active-directory-dotnet-webapi-manual-jwt-validation 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-dotnet-webapi-manual-jwt-validation 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-dotnet-webapi-manual-jwt-validation
            Get all kandi verified functions for this library.

            active-directory-dotnet-webapi-manual-jwt-validation Key Features

            No Key Features are available at this moment for active-directory-dotnet-webapi-manual-jwt-validation.

            active-directory-dotnet-webapi-manual-jwt-validation Examples and Code Snippets

            No Code Snippets are available at this moment for active-directory-dotnet-webapi-manual-jwt-validation.

            Community Discussions

            QUESTION

            validating the issuer - token has issuer https://login.microsoftonline.com/Xv2.0 but sample implies i should validate using https://sts.windows.net/X
            Asked 2019-Apr-25 at 09:03

            I'm trying to follow the example validation code in https://azure.microsoft.com/en-us/resources/samples/active-directory-dotnet-webapi-manual-jwt-validation/

            (REALLY the code in https://github.com/Azure-Samples/active-directory-dotnet-webapi-manual-jwt-validation/blob/master/TodoListService-ManualJwt/Global.asax.cs#L136)

            I then attempt to validate using:

            ...

            ANSWER

            Answered 2019-Apr-25 at 02:48

            The sample you're currently looking at is a little old and explaining with Azure AD v1.0 endpoint as reference. The issuer value you are seeing in token is correct, because you have acquired that token from Azure AD v2.0 endpoint. The OpenID discovery document URL you're using to find the valid issuer is not correct. More explanation in further sections.

            I should also briefly mention that in most cases, explicitly validating the token manually like the sample you're following explains is a bit of heavy lifting which isn't really needed. I don't want to stray off from your orginal question hence I'm just keeping some pointers on this part at the end of my answer, but do take a look to see if it makes sense for your case.

            More details on Access Tokens acquired from Azure AD v1.0 and v2.0 endpoints

            Please look at this Microsoft Documentation - Access Tokens Reference - Sample Tokens

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

            QUESTION

            Integrating applications with Azure Active Directory: revalidate Id_token to check if user already logged out
            Asked 2018-Jul-12 at 23:29

            Currently, I am using this library from Microsoft to integrate my application with Azure AD:

            ...

            ANSWER

            Answered 2018-Jul-12 at 23:29

            ID tokens are considered valid until their expiry. Usually, a web application matches a user’s session lifetime in the application to the lifetime of the ID token issued for the user. You can adjust the lifetime of an ID token to control how often the web application expires the application session, and how often it requires the user to be reauthenticated with Azure AD (either silently or interactively).

            Access Token Lifetime policy controls how long access and ID tokens for this resource are considered valid. Reducing the Access Token Lifetime property mitigates the risk of an access token or ID token being used by a malicious actor for an extended period of time. (These tokens cannot be revoked.) The trade-off is that performance is adversely affected, because the tokens have to be replaced more often.

            To create the policy, run this command:

            PowerShell

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

            QUESTION

            Validating B2C JWT tokens in Asp.Net Core Web Api
            Asked 2017-Apr-14 at 19:31

            I am using B2C to protect a WebApi in Asp.Net Core. My code is below. Do I need to validate the tokens or is the middleware doing it for me? I would think if everyone had to do this, it'd be easier for me to find some sample code, but I can't seem to get any real direction on this.

            Yet, this B2C documentation states that my api do the validation.

            I found a sample but it's not for Core and they're using CertificateValidator = X509CertificateValidator.None. Doesn't that defeat the purpose? And another sample here where they are doing it.

            Don't I have to have the signing key from B2C and all that?

            I can cobble together a solution from those, but do I actually need to do this?

            Thanks in advance.

            ...

            ANSWER

            Answered 2017-Apr-14 at 19:31

            Do I need to validate the tokens or is the middleware doing it for me?

            The JWT bearer middleware does it for you (by default, it will automatically reject unsigned or counterfeit tokens, so you don't need to explicitly set RequireSignedTokens to true).

            Doesn't that defeat the purpose?

            There's a difference between validating a signature using a public asymmetric key (e.g RSA or ECDSA) embedded in a certificate and validating the certificate itself (and specially its chain). Signature validation is fully supported in ASP.NET Core, but certificate validation is not supported yet.

            Don't I have to have the signing key from B2C and all that?

            The JWT bearer middleware automatically retrieves it from B2C's discovery endpoint, so there's no need to do that manually. For more information, don't hesitate to read the OIDC discovery specification: https://openid.net/specs/openid-connect-discovery-1_0.html

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

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

            Vulnerabilities

            No vulnerabilities reported

            Install active-directory-dotnet-webapi-manual-jwt-validation

            You can download it from GitHub.

            Support

            If you are using this sample with an Azure AD B2C custom policy, you might want to read #22, and change step 3. in the About The Code paragraph.
            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-webapi-manual-jwt-validation.git

          • CLI

            gh repo clone Azure-Samples/active-directory-dotnet-webapi-manual-jwt-validation

          • sshUrl

            git@github.com:Azure-Samples/active-directory-dotnet-webapi-manual-jwt-validation.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

            Explore Related Topics

            Consider Popular Authentication Libraries

            supabase

            by supabase

            iosched

            by google

            monica

            by monicahq

            authelia

            by authelia

            hydra

            by ory

            Try Top Libraries by Azure-Samples

            azure-search-openai-demo

            by Azure-SamplesPython

            blockchain

            by Azure-SamplesHTML

            Cognitive-Speech-TTS

            by Azure-SamplesC#