Coder Social home page Coder Social logo

mihirdilip / aspnetcore-authentication-basic Goto Github PK

View Code? Open in Web Editor NEW
72.0 2.0 9.0 110 KB

Easy to use and very light weight Microsoft style Basic Scheme Authentication Implementation for ASP.NET Core.

License: MIT License

C# 100.00%
asp-net-core aspnetcore netstandard netstandard20 basic-authentication basicauthentication security aspnetcore-basic-authentication asp-net-core-basic-authentication authentication-scheme

aspnetcore-authentication-basic's People

Contributors

mihirdilip avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

aspnetcore-authentication-basic's Issues

Encounter a problem

Hello, excuse me, now I want to implement a function, that is, when the browser accesses the interface, the pop-up window to enter the account password, if the input error page will display a custom error message.
First of all, you can use a browser pop-up, OnValidateCredentials, to enter your account or password, but if you enter the wrong password, you'll see this:
First of all, I found that your "OnHandleChallenge" method did what I wanted, which is for the page to return custom information:
image
I then tried to mimic the OnHandleChallenge method in the "OnValidateCredentials" method, returning an error message when it failed:
image
After I entered the wrong account password, the effect was not what I thought, he did not return the custom data, but returned the browser error message:
image
So I'm trying to use, in combination with the "OnHandleChallenge" and "OnValidateCredentials" methods to get what I want. However, I found that when the two are used together, accessing the interface does not trigger a browser pop-up, but directly returns a custom message for the "OnHandleChallenge" method, so is there a way to combine the effects of the two?

Clarify which frameworks the package supports

In the description it is said that the package can be used fro .Net core, but in details it is said that .NET Framework 4.6.1 is also supported. Please keep the title and content consistent.

Please add an example how to use with .Net framework 4.6.1.

Also fix the phrase โ€œ Always use HTTPS (SSL Certificate) protocol in production when using API Key authentication.โ€ as this repo is about basic authentication.

Thank you

Just wanted to say thank you. This is very tidy implementation of the basic implementation that works flawlessly.

IgnoreAuthenticationIfAllowAnonymous in HandleAuthenticateAsync specifically doesn't ignore

Code in question:

if (IgnoreAuthenticationIfAllowAnonymous())
{
Logger.LogInformation("AllowAnonymous found on the endpoint so request was not authenticated.");
return AuthenticateResult.NoResult();
}

Problem:

The log statement at line 56 breaks the promise to ignore authentication if the endpoint is annotated with [AllowAnonymous].

Expected behavior:

When querying an endpoint annotated with [AllowAnonymous], authentication logic should be ignored.

Actual behavior:

When querying an endpoint annotated with [AllowAnonymous], two lines of log output are produced, stating that nothing is going on. (logspam)

Example:

info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.

Pull request:

#8

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.