Thread WWW-Authenticate: Authentifizierung per Perl Script (16 answers)
Opened by vinnie_paul at 2005-08-18 15:22

GwenDragon
 2005-08-18 21:33
#5453 #5453
User since
2005-01-17
14542 Artikel
Admin1
[Homepage]
user image
Und so kann ein funktionables Skript aussehen:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/perl
use strict;
use CGI qw(header);
use CGI::Carp qw(fatalsToBrowser);

my $cgi = new CGI;

if ( not $ENV{'REMOTE_USER'} ) {
   print header(-status => "401 Unauthorized",
    -www_authenticate => 'Basic realm="Test"',
    # Falls NonparsedHeaders notwendig, auskommetieren
#-nph => 1
#
);
   exit;
}
else {
   print header(-type=>"text/plain; charset=utf-8");
   print "JAWOLL! Login erfolgt!";
}

1;
\n\n

<!--EDIT|GwenDragon|1124386696-->
die Drachin, Gwendolyn


Unterschiedliche Perl-Versionen auf Windows (fast wie perlbrew) • Meine Perl-Artikel

View full thread WWW-Authenticate: Authentifizierung per Perl Script