summaryrefslogtreecommitdiff
path: root/FS/FS/Auth
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-04-05 01:03:44 -0700
committerIvan Kohler <ivan@freeside.biz>2013-04-05 01:03:44 -0700
commit3ff1fb4e10fdaef86527c10bd416e988d2a62a49 (patch)
tree114c4e41e06749796283bf475b6fcf1c23171fb4 /FS/FS/Auth
parentb70a4b7f41c84aefd7f273974db59e5c37fc368b (diff)
login/login pages and cookie/session-based auth
Diffstat (limited to 'FS/FS/Auth')
-rw-r--r--FS/FS/Auth/external.pm18
-rw-r--r--FS/FS/Auth/internal.pm15
-rw-r--r--FS/FS/Auth/legacy.pm25
3 files changed, 58 insertions, 0 deletions
diff --git a/FS/FS/Auth/external.pm b/FS/FS/Auth/external.pm
new file mode 100644
index 0000000..d2bc746
--- /dev/null
+++ b/FS/FS/Auth/external.pm
@@ -0,0 +1,18 @@
+packages FS::Auth::external;
+#use base qw( FS::Auth );
+
+use strict;
+
+sub autocreate {
+ my $username = shift;
+ my $access_user = new FS::access_user {
+ 'username' => $username,
+ #'_password' => #XXX something random so a switch to internal auth doesn't
+ #let people on?
+ };
+ my $error = $access_user->insert;
+ #die $error if $error;
+}
+
+1;
+
diff --git a/FS/FS/Auth/internal.pm b/FS/FS/Auth/internal.pm
new file mode 100644
index 0000000..86fddd2
--- /dev/null
+++ b/FS/FS/Auth/internal.pm
@@ -0,0 +1,15 @@
+package FS::Auth::internal;
+#use base qw( FS::Auth );
+
+use strict;
+
+sub authenticate {
+ my( $username, $check_password ) = @_;
+
+
+}
+
+sub change_password {
+}
+
+1;
diff --git a/FS/FS/Auth/legacy.pm b/FS/FS/Auth/legacy.pm
new file mode 100644
index 0000000..7212202
--- /dev/null
+++ b/FS/FS/Auth/legacy.pm
@@ -0,0 +1,25 @@
+package FS::Auth::legacy;
+#use base qw( FS::Auth ); #::internal ?
+
+use strict;
+use Apache::Htpasswd;
+
+#substitute in? we're trying to make it go away...
+my $htpasswd_file = '/usr/local/etc/freeside/htpasswd';
+
+sub authenticate {
+ my($self, $username, $check_password ) = @_;
+
+ Apache::Htpasswd->new( { passwdFile => $htpasswd_file,
+ ReadOnly => 1,
+ }
+ )->htCheckPassword($username, $check_password);
+}
+
+#don't support this in legacy? change in both htpasswd and database like 3.x
+# for easier transitioning? hoping its really only me+employees that have a
+# mismatch in htpasswd vs access_user, so maybe that's not necessary
+#sub change_password {
+#}
+
+1;