Implementing API Key Authentication in ASP.NET Core

Поделиться
HTML-код
  • Опубликовано: 8 фев 2023
  • Check out my courses: dometrain.com
    Become a Patreon and get source code access: / nickchapsas
    Hello everybody I'm Nick and in this video I will show you all the approaches you can use to add API Key based authentication in you ASP.NET Core APIs. I will cover a generic approach and then Controller and Minimal API specific approaches and also show you how you can add Open API support for Swagger.
    Workshops: bit.ly/nickworkshops
    Don't forget to comment, like and subscribe :)
    Social Media:
    Follow me on GitHub: bit.ly/ChapsasGitHub
    Follow me on Twitter: bit.ly/ChapsasTwitter
    Connect on LinkedIn: bit.ly/ChapsasLinkedIn
    Keep coding merch: keepcoding.shop
    #csharp #dotnet

Комментарии • 135

  • @facephonesy
    @facephonesy Год назад +65

    I love your videos, you are so professional, but i would really love and appreciate if you make a small app, that shows us how yo implement all the best practices you teach us, I mean I learn tbd concept from you, and I always go and implement it in my projects, but sometimes I get lost in the implementation. If you can just do a todo list api, with all the consepts, like rest API rules, versioning, SOLID, services, mapping, results, responses. Thank you very much for the great content 🙏

  • @takeshi_taro
    @takeshi_taro Год назад +9

    To get rid of [ServiceFilter(typeof(...)] thing you can derive from ServiceFilterAttribute and provide default ctor with :base (typeof(ApiKeyAuthFilterImpl)). Then you can use your filter directly (ApiKeyAuthFilterImpl is actual implementation of filter, must be registered in DI container)

  • @user-bz8gp2uv8d

    This video is difficult to understand and video editing is inconsistent with the content..

  • @MusicaX79
    @MusicaX79 Год назад +1

    This breaks swagger documentation.

  • @JacobDuenke
    @JacobDuenke Год назад +1

    Am I crazy? I’ve always found the swagger ui has the lock icons mixed up. Why would the lock be LOCKED when the api is unlocked and authorized for use??

  • @ryanobray1
    @ryanobray1 Год назад +16

    I would love to see examples using OAuth 2 Client Credentials flow (using an IDP service like Okta or Auth0) where the APIs accept a valid bearer token.

  • @dasmaffin1633
    @dasmaffin1633 Год назад

    So if I have an app that connects to thousands of users authentication is something I dont need, did I get that right?

  • @cdarrigo
    @cdarrigo Год назад +2

    Please do a video on task ConfigureAwait(). It's so confusing

  • @diamondkingdiamond6289

    But wouldn't that make a timing attack possible because you are just comparing the two strings without doing any hashing.

  • @Any1SL
    @Any1SL Год назад +1

    Would love a video on building a throttle mechanism where its not waiting in memory but in a queue or database

  • @NathanWienand
    @NathanWienand Год назад +68

    Hi Nick I love your videos so very much!

  • @MaiconLLoti
    @MaiconLLoti Год назад

    i always copy/paste some example from the internet and i never stop to think how it works because the explanation is almost always just technical terms and blah blah hard to understand

  • @voliansky
    @voliansky Год назад +19

    Thanks for the awesome video.

  • @RonyFayyad

    This is exactly what I was lookinf for to use in my current project. Well done on providing such great content; clean, concise and easy to follow.

  • @margosdesarian
    @margosdesarian Год назад

    Hi Nick, i love your videos - and this is one is especially great. In this short video you have explained so many things in a clear and concise way. Its great!!

  • @MeerHussainAbrar
    @MeerHussainAbrar 21 день назад

    Thank you Nick! This video greatly helped me. You covered all aspects, including the Swagger which I was struggling with. Thank you 🙏

  • @johnsitka

    Great help, exactly what I needed. Thanks tons. Since adopting Blazor Server then finding Minimal API's I can now build Api's without MVC "and" secure them. I remember first hearing of WebSocket so many years ago, throw in Entra, Microsoft Graph, and Application Proxy we now have flying cars for the enterprise.

  • @onmico
    @onmico Год назад +1

    Great video Nick, as always! A tip to others: the same principal can be used to enforce client certificate based auth, minus the Swagger UI integration. This way, you can easily enforce different types of auth on different scopes within the same API.

  • @stephenmiller1396
    @stephenmiller1396 Год назад +4

    Id love to see example of storing multiple API Keys in database and comparing the header key to those in the database. I have a scenario where I will have multiple clients using the API and would like to have a different API Key to give them access to their own data. Great video !

  • @juliansegura5507
    @juliansegura5507 Год назад +1

    I finally can understand this concept to it's fullest. Thanx for the great content