Re: LWP::Authen::*
Gisle Aas (aas@bergen.sn.no)
26 Jan 1997 14:33:38 +0000
Doug MacEachern <dougm@opengroup.org> writes:
> 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.
Thanks. This patch will be in the next release.
Regards,
Gisle
> --- 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;
>