From 92a3df0360d3df6b6ace99fee3d4cc443e6154d0 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Tue, 7 May 2013 23:55:11 -0700 Subject: NG auth: internal db auth, RT#21563 --- eg/Auth-my_external_auth.pm | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 eg/Auth-my_external_auth.pm (limited to 'eg/Auth-my_external_auth.pm') diff --git a/eg/Auth-my_external_auth.pm b/eg/Auth-my_external_auth.pm new file mode 100644 index 000000000..38f9d5bfb --- /dev/null +++ b/eg/Auth-my_external_auth.pm @@ -0,0 +1,27 @@ +package FS::Auth::my_external_auth; +use base qw( FS::Auth::external ); #need to inherit from ::external + +use strict; + +sub authenticate { + my($self, $username, $check_password ) = @_; + + #magic happens here + + if ( $auth_good ) { #verbose for clarity + return 1; + } else { + return 0; + } + +} + +#omitting these subroutines will eliminate those options from the UI + +#sub create_user { +# + +#sub change_password { +#} + +1; -- cgit v1.2.1 From 56f9dffcd409d2a10e7a2cbe4c15b397f6f3abe1 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Thu, 9 May 2013 21:42:37 -0700 Subject: NG auth: autocreate records for external users, RT#21563 --- eg/Auth-my_external_auth.pm | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'eg/Auth-my_external_auth.pm') diff --git a/eg/Auth-my_external_auth.pm b/eg/Auth-my_external_auth.pm index 38f9d5bfb..8eda462f8 100644 --- a/eg/Auth-my_external_auth.pm +++ b/eg/Auth-my_external_auth.pm @@ -4,24 +4,25 @@ use base qw( FS::Auth::external ); #need to inherit from ::external use strict; sub authenticate { - my($self, $username, $check_password ) = @_; + my($self, $username, $check_password, $info ) = @_; - #magic happens here + #your magic happens here + + if ( $auth_good ) { + + #optionally return a real name + #$info->{'first'} = "Jean"; + #$info->{'last'} = "D'eau"; + + #optionally return a template username to copy access groups from that user + #$info->{'template_user'} = 'username'; - if ( $auth_good ) { #verbose for clarity return 1; + } else { return 0; } } -#omitting these subroutines will eliminate those options from the UI - -#sub create_user { -# - -#sub change_password { -#} - 1; -- cgit v1.2.1