#!/usr/bin/perl
#
# Written by Russ Allbery <rra@stanford.edu>
# Copyright 2011, 2013
#     The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.

use strict;
use warnings;

use WebAuth::Tests qw(build_page);

# Text for the page.  Varies based on whether or not remote user is set.
my @extended;
my $remote_user = $ENV{REMOTE_USER};
if ($remote_user) {
    push (@extended,
          "You are accessing a page with optional authentication as the "
          ."user $remote_user.  If you are seeing this page after login, "
          ."you have run this test successfully and it has passed.  If you "
          ."are seeing this page without logging in, something has gone "
          ."wrong.");
} else {
    push (@extended,
          'You are accessing a page with optional authentication and are not '
          .'authenticated.  This part of the test succeeded.  To see if your '
          .'identity is displayed properly after logging in, follow the '
          .'<a href="/tests/auth/test13login">login</a> link.  You should '
          .'then authenticate and be returned to this page, but with an '
          .'identity set.');
}

# Set information for the tests.
my %settings = (
    test_number   => 13,
    test_desc     => 'lazy session support',
    extended_desc => \@extended,
);

print "Content-type: text/html\n\n";
print build_page(\%settings);
