You are not logged in.
Hi,
i'm working on the migration from our soap-services to mormot-rest/soa interface based.
We must support old clients as well so i integrated a rest-proxy that route everything that is not /rest/* via OnCustomRequest to our current indy server. Works well so far very well.
I have also integrated some first endpoint at rest-level (sicPerSession), because i need a state per client on server side.
I have integrated a OnAuthenticationUserRetrieve callback that return a generated user via the client "login" (client-device-id).
result := TRestClientAuthenticationTerminal.ClientSetUser(AClient,
MakeTerminalLogon(ATerminalNr, ADeviceId), '', passClear);In local environment everything is working. Client get the auth-cookie, that is send on each request.
But i have a problem with our current environment. the services are behind a reverse proxy with static system http-basic-auth user/password. What i can't get to work at the moment is how to use both authentication types.
client -> reverseproxy(https) with http-basic-auth (authentication header removed) -> http -> mormot-rest async-server (sicPerSession, auth=true).
The first request that i see on the server before the rest-auth is arriving is "GET /rest/timestamp HTTP/1.1" 401 - without the basic-auth info.
I don't know where to set the basic auth-data for the reverse proxy together with the userdata (only terminal/deviceid at the moment) for restserver-auth (url, cookie based)
I'm happy for any hint.
thank you.
Offline
Found a solution:
client := TRestHttpClientSocket.CreateWithOwnModel(SERVER, PORT, ROOT, true);
if not client.IsOpen then
raise ESynException.Create('not connected');
//After this the socket is assigned and i can set the password for http-baisc-auth.
client.Socket.AuthorizeBasic('user', 'password');Offline
I guess this is the clever and right way to do this.
I have properly documented the trick:
https://github.com/synopse/mORMot2/commit/65a11e217
Offline