Hi,
I'm working on a NTLM authentication module. It works fine except one small problem:
NTLM is challenge-response authentication:
1 - the client sends a request for the authentication
2 - the server send a randomly generated key (challenge)
3 - the client sends the password encoded with the challenge
My problem is, that it takes 2 requests to process the authentication.
In the first request I create a module_context:
typedef struct {
char *challenge;
char *user;
char *domain;
char *password;
int auth_ok;
unsigned int ntlmssp_flags;
} ngx_http_auth_ntlm_ctx_t;
...
ngx_http_auth_ntlm_ctx_t *ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_auth_ntlm_ctx_t));
ngx_http_set_ctx(r, ctx, ngx_http_auth_ntlm_module);
In the second request, when I am trying to get the module context I'm getting a new context, which is NULL:
ctx = ngx_http_get_module_ctx(r, ngx_http_auth_ntlm_module); // ==NULL
I have to remember the challenge from the first request for each connection, to be able to check the password.Is there any way to save the context to a client connection and not only for one request?
Any help would be greatly appreciated.
Kukaac