Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Credentials now accumulates entries #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

maiha
Copy link
Contributor

@maiha maiha commented Jan 18, 2017

Hi @sdogruyol !
I'm now heavily using basic_auth and it would be nice if we can call it in several times for independency of pages. This PR enables it.

# foo.cr
basic_auth "user1", "123"
get "/foo" do
  ...

# bar.cr
basic_auth "staff", "456"
get "/bar" do
  ...

Impact

  • Added HTTPBasicAuth.runtime method that keeps singleton instance object. This looks like well known INSTANCE technic except instantiating it lazily due to add_handler stuff.
  • basic_auth is now a simple proxy to the runtime. Thus, we can accumulate entries.

I'm glad if you like this! I'll create a new PR soon for a limited page authorization. 😄

Thanks.

@sdogruyol
Copy link
Member

Hey @maiha, thanks a lot for your PR 👍 I'll review it soon as i've just seen this 😄

@xhyrom
Copy link

xhyrom commented Aug 6, 2022

Hm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants