Esempio n. 1
0
/*	HTAA_UpdateFilter
**	-----------------
**	Call the Update filter that knows how to handle this scheme.
**	Return YES or whatever callback returns
*/
PUBLIC int HTAA_updateFilter (HTRequest * request, HTResponse * response,
				 void * param, int status)
{
    const char * scheme = HTResponse_scheme(response);
    HTAAModule * module = NULL;
    HTTRACE(AUTH_TRACE, "Auth Engine. Update filter status %d\n" _ status);
    /*
    **	If we don't have a scheme then the server has made an error. We
    **  try to make up for it by creating our own "noop" realm and use basic.
    */
    if (!scheme) {
	HTResponse_addChallenge(response, "basic", "realm LIBWWW-UNKNOWN");
	scheme = "basic";
    }
    if ((module = HTAA_findModule(scheme)) != NULL) {
	/* we don't call this module systematically, as it could hamper
	   the execution of Basic authentication requests for nothing */
      if (module->update) {
	HTTRACE(AUTH_TRACE, "Auth Engine. Found Update filter %p\n" _ module->update);
	HTRequest_deleteCredentialsAll(request);
	return (*module->update)(request, response, NULL, status);
      }
      return HT_OK;
    }
    return HT_ERROR;
}
Esempio n. 2
0
PUBLIC int HTMIME_authenticationInfo (HTRequest * request, 
		 		      HTResponse * response,
                                      char * token, char * value)
{
  if (token && value) {
    HTResponse_addChallenge(response, token, value);
    HTResponse_setScheme(response, "digest");
  }
  return HT_OK;
}
Esempio n. 3
0
PUBLIC int HTMIME_authenticate (HTRequest * request, HTResponse * response,
				char * token, char * value)
{    
    char * scheme = HTNextField(&value);
    if (scheme) {
	HTResponse_addChallenge(response, scheme, value);
	HTResponse_setScheme(response, scheme);
    }
    return HT_OK;
}
Esempio n. 4
0
/*	HTAA_afterFilter
**	-----------------
**	Call the AFTER filter that knows how to handle this scheme.
**	Return YES or whatever callback returns
*/
PUBLIC int HTAA_afterFilter (HTRequest * request, HTResponse * response,
			     void * param, int status)
{
    const char * scheme = HTResponse_scheme(response);
    HTAAModule * module = NULL;
    HTTRACE(AUTH_TRACE, "Auth Engine. After filter status %d\n" _ status);
    /*
    **	If we don't have a scheme then the server has made an error. We
    **  try to make up for it by creating our own "noop" realm and use basic.
    */
    if (!scheme) {
	HTResponse_addChallenge(response, "basic", "realm LIBWWW-UNKNOWN");
	scheme = "basic";
    }
    if ((module = HTAA_findModule(scheme)) != NULL) {
	HTTRACE(AUTH_TRACE, "Auth Engine. Found AFTER filter %p\n" _ module->after);
	HTRequest_deleteCredentialsAll(request);
	HTRequest_addAARetry (request);
	return (*module->after)(request, response, NULL, status);
    }
    return HT_ERROR;
}