Branch: Tag:

2005-12-13

2005-12-13 15:46:00 by Anders Johansson <anders@roxen.com>

Implemented custom authentication failed message and 401.inc files.

Rev: server/base_server/configuration.pike:1.600
Rev: server/etc/modules/Roxen.pmod:1.203
Rev: server/modules/compat/secure_fs.pike:1.31
Rev: server/modules/filesystems/filesystem.pike:1.152
Rev: server/modules/security/auth_httpbasic.pike:1.11
Rev: server/modules/tags/rxmltags.pike:1.505

1:   // This is a roxen pike module. Copyright © 1999 - 2004, Roxen IS.   // - // $Id: Roxen.pmod,v 1.202 2005/12/09 14:26:59 grubba Exp $ + // $Id: Roxen.pmod,v 1.203 2005/12/13 15:45:59 anders Exp $      #include <roxen.h>   #include <config.h>
901:    + ([ "extra_heads":([ "WWW-Authenticate":"Digest "+digest_challenge,]),]);   }    - mapping http_auth_required(string realm, string|void message) + mapping http_auth_required(string realm, string|void message, +  void|RequestID id)   //! Generates a result mapping that will instruct the web browser that   //! the user needs to authorize himself before being allowed access.   //! `realm' is the name of the realm on the server, which will
915:   //! with the header <tt>WWW-Authenticate: basic realm="`realm'"</tt>.   //! For more info, see RFC 2617.   { +  HTTP_WERR("Auth required ("+realm+")"); +  if (id) { +  return id->conf->auth_failed_file( id, message ) +  + ([ "extra_heads":([ "WWW-Authenticate":"basic realm=\""+realm+"\"",]),]); +  }    if(!message)    message = "<h1>Authentication failed.</h1>"; -  HTTP_WERR("Auth required ("+realm+")"); +     return http_low_answer(401, message)    + ([ "extra_heads":([ "WWW-Authenticate":"basic realm=\""+realm+"\"",]),]);   }