lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Basic Authentication


From: Trampas Stern
Subject: Re: [lwip-users] Basic Authentication
Date: Thu, 23 Apr 2020 08:12:03 -0400

So what I did is added support for cookies.  Basically in the http_parse_request() I created a callback that I call which passes header to the call back.  In the function I get the cookie for a session ID, and return a redirect if the current user is not logged in. 

When the user connects the callback checks the session ID cookie and the remote IP port for match, if they do not match current logged in person I redirect them to login page.  The login page assigns them a new random session id and lets them enter password.  If password matches then I store their session id and IP address as being logged in.  The reason for IP address is that when login screen is shown, if someone is logged it it will inform user they will kick off that person at IP address xx.xx.xx.xx.  Yes if connection is through a router/NAT then everyone will have same IP, but not my use case.  

This works well except for calls where I am just requesting JSON values. Here I had to change HTML/_javascript_  to know that the JSON failed due to being logged out and redirect them to login page. 

Trampas



On Thu, Apr 23, 2020 at 6:10 AM Marco Lazzaroni <address@hidden> wrote:
Il giorno gio 23 apr 2020 alle ore 11:17 Ben Stuyts <address@hidden> ha scritto:
Hi Marco,

Sounds good! I’m interested in this. Would it be possible for you to post a complete patch?

Sure I'll do it! Anyway I must say that it's not fully tested and I think it works only if you enable  LWIP_HTTPD_SUPPORT_EXTSTATUS. Instead, it should work also without enabling LWIP_HTTP_DYNAMIC_HEADERS like I did.
_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users

reply via email to

[Prev in Thread] Current Thread [Next in Thread]