package My::SOAP; use strict; # These subroutines define constants that can be # overridden in a subclass. Most subclasses only # need to change ACL_GROUP(). # sub PASSWD_FILE { '/home/soap/.htpasswd' } sub ACL_FILE { '/home/soap/.acl' } sub ACL_GROUP { '' } # Authenticate the user, checking their password and # if they have permission to access this. Uses class data # $self->{user} and $self->{passwd} for checking. # # Return values: # # 1 Everything checks out # 0 Password is wrong # -1 Not allowed access # sub _authen { my $self = shift; use Apache::Htpasswd; my $htpasswd = Apache::Htpasswd->new({ passwdFile => $self->PASSWD_FILE, ReadOnly => 1, }); return 0 unless $htpasswd->htCheckPassword($self->{user}, $self->{passwd}); use Set::NestedGroups; open(ACL, '<', $self->ACL_FILE) or die "Can't open " . $self->ACL_FILE . ": $!\n"; my $acl = Set::NestedGroups->new(*ACL); close(ACL); return -1 unless $acl->member($self->{user}, $self->ACL_GROUP); return 1; } 1;