[Libwebsockets] How to reply a "WWW-Authenticate" field ?

Shmuel Weiss sweiss at kramerel.com
Thu Jul 21 09:06:39 CEST 2016


Yes, 

I have replicated the code of "lws_return_http_status" with some adaptation for what I need and it's working.

Thanks for your help !

-----Original Message-----
From: Andy Green [mailto:andy at warmcat.com] 
Sent: Thursday, July 21, 2016 02:15
To: Shmuel Weiss; libwebsockets at ml.libwebsockets.org
Subject: Re: [Libwebsockets] How to reply a "WWW-Authenticate" field ?

On Wed, 2016-07-20 at 19:08 +0000, Shmuel Weiss wrote:
> Hi All,
>  
> What is the right way to reply
> WWW-Authenticate: Basic realm="User Visible Realm"
>  
> Into this authentication failure response ?
>  
> if (authentication_is_on && authentication_failed ) {
>              lwsl_err("authentication failed %s\n", buf);
>              lws_return_http_status( wsi,
>                        HTTP_STATUS_UNAUTHORIZED, NULL);
>              return -1;
> }

Not sure exactly what you're asking, but:

 - https://en.wikipedia.org/wiki/Basic_access_authentication

 - See lws_b64_encode_string()

https://libwebsockets.org/lws-api-doc-master/html/group__sha.html#gaf39
765e4a3b413efb65e4698b2ec3575

-Andy

> Thanks.
>  
>     	 Shmuel Weiss Kramer Electronics     Project Lead and Software 
> Team Leader
>  
>  Email: sweiss at kramerel.com    Web: www.kramerelectronics.com    Tel:
>  +972-73-2650405     Cell: +972-54-3344141    Fax: +972-2-
> 6535369    Address: 3 Am VeOlamo, Jerusalem, 9546303, Israel
>    
>  
>  
> This mail was sent via Mail-SeCure System.
>  _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> http://libwebsockets.org/mailman/listinfo/libwebsockets
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20160721/e69985a9/attachment-0001.html>


More information about the Libwebsockets mailing list