package NSDL::UA;

# Copyright 2005 Norman Walsh. This work is licensed under a
# Creative Commons License: http://creativecommons.org/licenses/by-nc/2.0/

use strict;
use vars qw(@ISA);
use LWP::UserAgent;

@ISA = qw(LWP::UserAgent);

sub new {
    my $type = shift;
    my $self = new LWP::UserAgent;
    return bless $self, $type;
}

sub credentials {
    my($self, $uid, $pass) = @_;
    my $realm = "#default"; # hack: there's only one
    @{ $self->{'basic_authentication'}{$realm} } =
	($uid, $pass);
}

sub get_basic_credentials
{
    my($self, $realm, $uri, $proxy) = @_;
    $realm = "#default"; # hack: there's only one
    return if $proxy;

    if (exists $self->{'basic_authentication'}{$realm}) {
	return @{ $self->{'basic_authentication'}{$realm} };
    }

    return (undef, undef);
}

1;
