LWP::Authen::*
Doug MacEachern (dougm@opengroup.org)
Fri, 24 Jan 1997 12:03:34 -0500
I need to "plugin" KerberosV5 authentication support for
LWP::UserAgent. Someday this will be available for others to use,
but I'm not sure you'd want it as part of the distribution, the patch
below makes it simple to plugin, and make room for other
authentication mechanisms to be implemented without modifying
LWP::UserAgent.
Regards,
-Doug
--- 1.10 1997/01/24 11:44:45
+++ UserAgent.pm 1997/01/24 16:46:37
@@ -312,7 +312,9 @@
return $response;
}
if (($challenge =~ /^(\S+)\s+Realm\s*=\s*"(.*?)"/i) or
- ($challenge =~ /^(\S+)\s+Realm\s*=\s*<([^<>]*)>/i)) {
+ ($challenge =~ /^(\S+)\s+Realm\s*=\s*<([^<>]*)>/i) or
+ ($challenge =~ /^(\S+)$/)
+ ) {
my($scheme, $realm) = ($1, $2);
if ($scheme =~ /^Basic$/i) {
@@ -412,9 +414,15 @@
return $response; # no password found
}
} else {
- warn "Authentication scheme '$scheme' not supported\n";
- return $response;
- }
+ my $class = "LWP::Authen::$scheme";
+ eval "use $class ()";
+ if($@) {
+ warn $@;
+ warn "Authentication scheme '$scheme' not supported\n";
+ return $response;
+ }
+ return $class->authenticate($self, $response, $request, $arg, $size, $scheme, $realm);
+ }
} else {
warn "Unknown challenge '$challenge'";
return $response;