This question about Installation of Foswiki: More info required

when wiki requires authentication throws error instead

The problem continues:

http://foswiki.org/Support/Question337


  • open lib/Foswiki/LoginManager/TemplateLogin.pm and on line 56 add: print STDERR "Forcing authentication\ncontext: " . $session->inContext('authenticated') . "\n";
  • and try again to edit some page, and check your apache logs


did:

     55     my $session = $this->{session};
     56 print STDERR "Forcing authentication\ncontext: " . $session->inContext('authenticated') . "\n";
     57     unless ( $session->inContext('authenticated') ) {

got:

Foswiki detected an internal error - please check your Foswiki logs and webserver logs for more information.

AccessControlException: Access to edit Main.WebHome for BaseUserMapping_666 is denied. authentication required



AccessControlException: Access to edit Main.WebHome for BaseUserMapping_666 is denied. authentication required at /usr/lib/perl5/site_perl/5.8.8/Error.pm line 184.
 at /usr/lib/perl5/5.8.8/CGI/Carp.pm line 354
        CGI::Carp::realdie('AccessControlException: Access to edit Main.WebHome for BaseU...') called at /usr/lib/perl5/5.8.8/CGI/Carp.pm line 442
        CGI::Carp::die('Foswiki::AccessControlException=HASH(0x971d168)') called at /usr/lib/perl5/site_perl/5.8.8/Error.pm line 184
        Error::throw('Foswiki::AccessControlException', 'edit', 'BaseUserMapping_666', 'Main', 'WebHome', 'authentication required') called at /home/owl/www/wiki/lib/Foswiki/LoginManager.pm line 448
        Foswiki::LoginManager::checkAccess('Foswiki::LoginManager::TemplateLogin=HASH(0x93def60)') called at /home/owl/www/wiki/lib/Foswiki/UI.pm line 303
        Foswiki::UI::__ANON__() called at /usr/lib/perl5/site_perl/5.8.8/Error.pm line 415
        eval {...} called at /usr/lib/perl5/site_perl/5.8.8/Error.pm line 407
        Error::subs::try('CODE(0x9009f78)', 'HASH(0x971ceb0)') called at /home/owl/www/wiki/lib/Foswiki/UI.pm line 391
        Foswiki::UI::_execute('Foswiki::Request=HASH(0x91f5b38)', 'CODE(0x91f57e4)', 'edit', 1) called at /home/owl/www/wiki/lib/Foswiki/UI.pm line 275
        Foswiki::UI::handleRequest('Foswiki::Request=HASH(0x91f5b38)') called at /home/owl/www/wiki/lib/Foswiki/Engine/CGI.pm line 26
        Foswiki::Engine::CGI::run('Foswiki::Engine::CGI=HASH(0x90eb940)') called at edit line 45.


I changed my configuration to:

And got instead:

AccessControlException: Access to edit Main.WebHome for BaseUserMapping_666 is denied. authentication required at /usr/lib/perl5/site_perl/5.8.8/Error.pm line 184.
 at /usr/lib/perl5/5.8.8/CGI/Carp.pm line 354
        CGI::Carp::realdie('AccessControlException: Access to edit Main.WebHome for BaseU...') called at /usr/lib/perl5/5.8.8/CGI/Carp.pm line 442
        CGI::Carp::die('Foswiki::AccessControlException=HASH(0x9d8b258)') called at /usr/lib/perl5/site_perl/5.8.8/Error.pm line 184
        Error::throw('Foswiki::AccessControlException', 'edit', 'BaseUserMapping_666', 'Main', 'WebHome', 'authentication required') called at /home/owl/www/wiki/lib/Foswiki/LoginManager.pm line 448
        Foswiki::LoginManager::checkAccess('Foswiki::LoginManager::ApacheLogin=HASH(0x9a51f18)') called at /home/owl/www/wiki/lib/Foswiki/UI.pm line 303
        Foswiki::UI::__ANON__() called at /usr/lib/perl5/site_perl/5.8.8/Error.pm line 415
        eval {...} called at /usr/lib/perl5/site_perl/5.8.8/Error.pm line 407
        Error::subs::try('CODE(0x967cf78)', 'HASH(0x9d8afa0)') called at /home/owl/www/wiki/lib/Foswiki/UI.pm line 391
        Foswiki::UI::_execute('Foswiki::Request=HASH(0x9868b70)', 'CODE(0x986881c)', 'edit', 1) called at /home/owl/www/wiki/lib/Foswiki/UI.pm line 275
        Foswiki::UI::handleRequest('Foswiki::Request=HASH(0x9868b70)') called at /home/owl/www/wiki/lib/Foswiki/Engine/CGI.pm line 26
        Foswiki::Engine::CGI::run('Foswiki::Engine::CGI=HASH(0x975e940)') called at edit line 45.


  • ok, so you see the try line 302 of lib/Foswiki/UI.pm?
  • down below are catch'es
  • one of them has to catch it, and I want to know which one, so we'll do it the hard way
  • under catch Foswiki::ValidationException with, please add: die 'Foswiki::ValidationException';
  • same for Foswiki::AccessControlException, Foswiki::OopsException, Error::Simple, and Foswiki::EngineException
  • and under otherwise, please add: die 'otherwise';

I got:

Software error:

Error::Simple at /home/owl/www/wiki/lib/Foswiki/UI.pm line 350.
 at /usr/lib/perl5/5.8.8/CGI/Carp.pm line 354
   CGI::Carp::realdie('Error::Simple at /home/owl/www/wiki/lib/Foswiki/UI.pm line 350.\x{a}') called at /usr/lib/perl5/5.8.8/CGI/Carp.pm line 442
   CGI::Carp::die('Error::Simple') called at /home/owl/www/wiki/lib/Foswiki/UI.pm line 350
   Foswiki::UI::__ANON__('Error::Simple=HASH(0xa0220a8)', 'SCALAR(0x9850ce4)') called at /usr/lib/perl5/site_perl/5.8.8/Error.pm line 339
   eval {...} called at /usr/lib/perl5/site_perl/5.8.8/Error.pm line 329
   Error::subs::run_clauses('HASH(0xa021a9c)', 'AccessControlException: Access to edit Main.WebHome for BaseU...', 'undef', 'ARRAY(0x9850fe4)') called at /usr/lib/perl5/site_perl/5.8.8/Error.pm line 426
   Error::subs::try('CODE(0x990df34)', 'HASH(0xa021a9c)') called at /home/owl/www/wiki/lib/Foswiki/UI.pm line 397
   Foswiki::UI::_execute('Foswiki::Request=HASH(0x9afa1c0)', 'CODE(0x9af9e6c)', 'edit', 1) called at /home/owl/www/wiki/lib/Foswiki/UI.pm line 275
   Foswiki::UI::handleRequest('Foswiki::Request=HASH(0x9afa1c0)') called at /home/owl/www/wiki/lib/Foswiki/Engine/CGI.pm line 26
   Foswiki::Engine::CGI::run('Foswiki::Engine::CGI=HASH(0x99ef95c)') called at edit line 45.

For help, please send mail to the webmaster (webmaster@XXXXXXXXXXXXXXXXX), giving this error message and the time and date of the error.
Software error:

[Mon Nov 30 15:36:13 2009] edit: Error::Simple at /home/owl/www/wiki/lib/Foswiki/UI.pm line 350.
[Mon Nov 30 15:36:13 2009] edit:  at /usr/lib/perl5/5.8.8/CGI/Carp.pm line 354
[Mon Nov 30 15:36:13 2009] edit:    CGI::Carp::realdie('Error::Simple at /home/owl/www/wiki/lib/Foswiki/UI.pm line 350.\x{a}') called at /usr/lib/perl5/5.8.8/CGI/Carp.pm line 442
[Mon Nov 30 15:36:13 2009] edit:    CGI::Carp::die('Error::Simple') called at /home/owl/www/wiki/lib/Foswiki/UI.pm line 350
[Mon Nov 30 15:36:13 2009] edit:    Foswiki::UI::__ANON__('Error::Simple=HASH(0xa0220a8)', 'SCALAR(0x9850ce4)') called at /usr/lib/perl5/site_perl/5.8.8/Error.pm line 339
[Mon Nov 30 15:36:13 2009] edit:    eval {...} called at /usr/lib/perl5/site_perl/5.8.8/Error.pm line 329
[Mon Nov 30 15:36:13 2009] edit:    Error::subs::run_clauses('HASH(0xa021a9c)', 'AccessControlException: Access to edit Main.WebHome for BaseU...', 'undef', 'ARRAY(0x9850fe4)') called at /usr/lib/perl5/site_perl/5.8.8/Error.pm line 426
[Mon Nov 30 15:36:13 2009] edit:    Error::subs::try('CODE(0x990df34)', 'HASH(0xa021a9c)') called at /home/owl/www/wiki/lib/Foswiki/UI.pm line 397
[Mon Nov 30 15:36:13 2009] edit:    Foswiki::UI::_execute('Foswiki::Request=HASH(0x9afa1c0)', 'CODE(0x9af9e6c)', 'edit', 1) called at /home/owl/www/wiki/lib/Foswiki/UI.pm line 275
[Mon Nov 30 15:36:13 2009] edit:    Foswiki::UI::handleRequest('Foswiki::Request=HASH(0x9afa1c0)') called at /home/owl/www/wiki/lib/Foswiki/Engine/CGI.pm line 26
[Mon Nov 30 15:36:13 2009] edit:    Foswiki::Engine::CGI::run('Foswiki::Engine::CGI=HASH(0x99ef95c)') called at edit line 45.
 at /usr/lib/perl5/5.8.8/CGI/Carp.pm line 354
   CGI::Carp::realdie('[Mon Nov 30 15:36:13 2009] edit: Error::Simple at /home/owl/w...') called at /usr/lib/perl5/5.8.8/CGI/Carp.pm line 452
   CGI::Carp::die('Error::Simple=HASH(0xa022054)') called at /usr/lib/perl5/site_perl/5.8.8/Error.pm line 184
   Error::throw('Error::Simple=HASH(0xa022054)') called at /usr/lib/perl5/site_perl/5.8.8/Error.pm line 436
   Error::subs::try('CODE(0x990df34)', 'HASH(0xa021a9c)') called at /home/owl/www/wiki/lib/Foswiki/UI.pm line 397
   Foswiki::UI::_execute('Foswiki::Request=HASH(0x9afa1c0)', 'CODE(0x9af9e6c)', 'edit', 1) called at /home/owl/www/wiki/lib/Foswiki/UI.pm line 275
   Foswiki::UI::handleRequest('Foswiki::Request=HASH(0x9afa1c0)') called at /home/owl/www/wiki/lib/Foswiki/Engine/CGI.pm line 26
   Foswiki::Engine::CGI::run('Foswiki::Engine::CGI=HASH(0x99ef95c)') called at edit line 45

For help, please send mail to the webmaster (webmaster@XXXXXXXXXXXXXXXXX), giving this error message and the time and date of the error.

I can't make sense of that. Going back to your first configuration, you will have noticed the call to Foswiki::LoginManager::checkAccess. When this failed (because you are not logged in but are trying to edit a topic) it threw a Foswiki::AccessControlException. This is supposed to be caught by the relevant catch block in Foswiki::UI, which then calls $session->getLoginManager()->forceAuthentication(), which should generate the login page. Clearly you followed this logic, and added a print STDERR in the right place, but you never reported if that message was seen or not. I realise you probably deduced that the print was never reached, as the exception report points squarely at Foswiki::UI, but it would be nice to be sure.

It looks almost as if the catch block just isn't working. I'm not sure how that could come about - certainly I've never seen anything like it before. For want of a better idea, I can only suggest that you disable all the plugins and contribs (except TopicUserMapping obviously) to eliminate them as possible sources of error, and make sure your CPAN modules (especially Error) are bang up to date.

-- CrawfordCurrie - 11 Dec 2009

QuestionForm edit

Subject Installation of Foswiki
Extension
Version Foswiki 1.0.7
Status More info required
Topic revision: r4 - 11 Dec 2009, CrawfordCurrie
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy