On Sat, 05 Dec 2015 20:48:52 -0500 (EST)
Grant Haywood <[email protected]> wrote:

> I see.
> Still, is there an example of authenticating an Http connection in lua?


I don't have this type of example avalaible.


> im fairly certan i can do a JWT implementation


I Agree, all the HTTP communication can be used in Lua, but we must
implement the HTTP protocol client based on the embeded sockets.

The core.http object allow to use the "create" object member to use

   "An optional function to be used instead of socket.tcp when the
    communications socket is created."

I supposed (but i do not test) that we can do an http request like
this:

   r, resp_code, resp_headers, resp_status = http_req.request {
      method = "POST",
      url = keystone_auth_url,
      headers = headers,
      source = ltn12.source.string(encoded_body),
      sink = ltn12.sink.table(resp_body),
      create = core.tcp
   }

I take the sample code found here:

   
https://github.com/morganfainberg/HAProxyKeystoneMiddlware/blob/master/ha_proxy_ksa.lua

Thierry

> and for LDAP, it may still easyer to proxy a simple (non-ldap) message over a 
> socket, and write a bridge to ldap daemon in something thats not lua. (use at 
> your own risk/understanding/vetting)
> 
> kind of like this https://doc.powerdns.com/md/authoritative/backend-pipe/
> (i know thats not for auth, but same concept)
> 
> ----- Original Message -----
> From: "thierry fournier" <[email protected]>
> To: "Baptiste" <[email protected]>
> Cc: "Grant Haywood" <[email protected]>, "Igor Cicimov" 
> <[email protected]>, "HAProxy" <[email protected]>
> Sent: Saturday, December 5, 2015 3:36:32 PM
> Subject: Re: lua authentication
> 
> Hi,
> 
> I complement, I would say, that the Lua bindings for the standard
> Openldap client exists, but unfortunately, the operation is blocking,
> and doesn't run very well with HAProxy.
> 
> It seems that a Lua rewrite of the LDAP protocol using standard Lua
> HAProxy socket is a solution, but this is a big development. Maybe a
> partial implementation (juste the binding) will be usefull.
> 
> Thierry
> 
>  
> 
> On Fri, 4 Dec 2015 08:35:41 +0100
> Baptiste <[email protected]> wrote:
> 
> > current Lua implementation already allows asynchronous network sockets.
> > Now, what you need to do is to code a basic LDAP auth request in Lua
> > and be able to parse the response.
> > 
> > Baptiste
> > 
> > 
> > 
> > On Thu, Dec 3, 2015 at 11:58 PM, Grant Haywood <[email protected]> 
> > wrote:
> > > Thats exactly what I am wanting to code, I just need an example of how to 
> > > do auth, like userlist, inside of lua.
> > >
> > > ----- Original Message -----
> > > From: "Igor Cicimov" <[email protected]>
> > > To: "Grant Haywood" <[email protected]>
> > > Cc: "HAProxy" <[email protected]>
> > > Sent: Thursday, December 3, 2015 3:58:28 PM
> > > Subject: Re: lua authentication
> > >
> > >
> > >
> > >
> > > Hi Grant,
> > >
> > >
> > >
> > > On Fri, Dec 4, 2015 at 7:46 AM, Grant Haywood < [email protected] > 
> > > wrote:
> > >
> > >
> > > Hello,
> > >
> > > I was wondering if there is a basic example of using lua to do 
> > > authentication?
> > >
> > > I am specificaly interested in constructing 'ldap' and 'jwt' versions of 
> > > the 'userlist' block
> > >
> > > thx in advance for your time
> > >
> > >
> > >
> > > Excellent question. One feature I would love to see in haproxy is support 
> > > for ldap authentication. It would be awesome If that could be done via 
> > > lua.
> > >
> > >
> > > Thanks,
> > >
> > > Igor
> > >
> > 

Reply via email to