Skip to content

Commit da0cf3f

Browse files
committed
make it configurable which authentication modules can be used for the admin course
1 parent c8ac198 commit da0cf3f

File tree

6 files changed

+121
-18
lines changed

6 files changed

+121
-18
lines changed

conf/authen_CAS.conf.dist

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,24 @@ $authen{user_module} = {
1212
"*" => "WeBWorK::Authen::CAS",
1313
};
1414

15+
# List of authentication modules that may be used to enter the admin course.
16+
# This should be a non-empty sublist of whatever is in $authen{user_module}.
17+
# Since the admin course provides overall power to add/delete courses, access
18+
# to this course should be protected by the best possible authentication you
19+
# have available to you. The current default is
20+
# WeBWorK::Authen::Basic_TheLastOption which is simple password based
21+
# authentication for a password locally stored in your WeBWorK server's
22+
# database. On one hand, this is necessary as the initial setting, as it is the
23+
# only option available when a new server is being installed. However, since
24+
# this option does not make use of multi-factor authentication or provide any
25+
# capabilities to prevent dictionary attacks, etc. At the very least you should
26+
# use a very strong password. If you have the option to use a more secure
27+
# authentication approach to the admin course (one which you are confident
28+
# cannot be spoofed) that is preferable.
29+
$authen{admin_module} = [
30+
'WeBWorK::Authen::CAS'
31+
];
32+
1533
$authen{cas_options} = {
1634
# Options to pass to the AuthCAS module.
1735
# Note that this is (plain) AuthCAS, not Apache::AuthCAS

conf/authen_LTI.conf.dist

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,26 @@ $authen{user_module} = [
4545
{ '*' => 'WeBWorK::Authen::Basic_TheLastOption' } # fallback authorization method
4646
];
4747

48+
# List of authentication modules that may be used to enter the admin course.
49+
# This should be a non-empty sublist of whatever is in $authen{user_module}.
50+
# Since the admin course provides overall power to add/delete courses, access
51+
# to this course should be protected by the best possible authentication you
52+
# have available to you. The current default is
53+
# WeBWorK::Authen::Basic_TheLastOption which is simple password based
54+
# authentication for a password locally stored in your WeBWorK server's
55+
# database. On one hand, this is necessary as the initial setting, as it is the
56+
# only option available when a new server is being installed. However, since
57+
# this option does not make use of multi-factor authentication or provide any
58+
# capabilities to prevent dictionary attacks, etc. At the very least you should
59+
# use a very strong password. If you have the option to use a more secure
60+
# authentication approach to the admin course (one which you are confident
61+
# cannot be spoofed) that is preferable.
62+
$authen{admin_module} = [
63+
'WeBWorK::Authen::LTIAdvantage',
64+
'WeBWorK::Authen::LTIAdvanced',
65+
'WeBWorK::Authen::Basic_TheLastOption'
66+
];
67+
4868
# Include configurations. You must uncomment at least one of the following. You may uncomment
4969
# both if the site may be using both LTI 1.1 and 1.3 in different courses. After uncommenting
5070
# the LTI_1_x line, you must copy the file authen_LTI_1_x.conf.dist to authen_LTI_1_x.conf and

conf/authen_ldap.conf.dist

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,24 @@ $authen{user_module} = {
1212
"*" => "WeBWorK::Authen::LDAP",
1313
};
1414

15+
# List of authentication modules that may be used to enter the admin course.
16+
# This should be a non-empty sublist of whatever is in $authen{user_module}.
17+
# Since the admin course provides overall power to add/delete courses, access
18+
# to this course should be protected by the best possible authentication you
19+
# have available to you. The current default is
20+
# WeBWorK::Authen::Basic_TheLastOption which is simple password based
21+
# authentication for a password locally stored in your WeBWorK server's
22+
# database. On one hand, this is necessary as the initial setting, as it is the
23+
# only option available when a new server is being installed. However, since
24+
# this option does not make use of multi-factor authentication or provide any
25+
# capabilities to prevent dictionary attacks, etc. At the very least you should
26+
# use a very strong password. If you have the option to use a more secure
27+
# authentication approach to the admin course (one which you are confident
28+
# cannot be spoofed) that is preferable.
29+
$authen{admin_module} = [
30+
'WeBWorK::Authen::LDAP'
31+
];
32+
1533
$authen{ldap_options} = {
1634
# hosts to attempt to connect to, in order. For example:
1735
# auth.myschool.edu -- uses LDAP scheme and port 389

conf/defaults.config

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -698,28 +698,29 @@ $modelCoursesForCopy = [ "modelCourse" ];
698698
# Select the authentication module to use for normal logins.
699699
#
700700
# If this value is a string, the given authentication module will be used
701-
# regardless of the database layout. If it is a hash, the database layout name
702-
# will be looked up in the hash and the resulting value will be used as the
703-
# authentication module. The special hash key "*" is used if no entry for the
704-
# current database layout is found.
705-
# If this value is a sequence of strings or hashes, then each
706-
# string or hash in the sequence will be successively tested to see if it
707-
# provides a module that can handle
708-
# the authentication request (by calling the module's
709-
# sub request_has_data_for_this_verification_module ).
710-
# The first module that responds affirmatively will be used.
701+
# regardless of the database layout.
711702
#
703+
# If it is a hash, the database layout name will be looked up in the hash and
704+
# the resulting value will be used as the authentication module. The special
705+
# hash key "*" is used if no entry for the current database layout is found.
712706
#
713-
$authen{user_module} = {
714-
# sql_moodle => "WeBWorK::Authen::Moodle",
715-
# sql_ldap => "WeBWorK::Authen::LDAP",
716-
"*" => "WeBWorK::Authen::Basic_TheLastOption",
717-
};
707+
# If this value is a sequence of strings or hashes, then each string or hash in
708+
# the sequence will be successively tested to see if it provides a module that
709+
# can handle the authentication request by calling the module's sub
710+
# request_has_data_for_this_verification_module(). The first module that
711+
# responds affirmatively will be used.
712+
713+
$authen{user_module} = {"*" => "WeBWorK::Authen::Basic_TheLastOption"};
718714

719715
# Select the authentication module to use for proctor logins.
720716
# A string or a hash is accepted, as above.
721717
$authen{proctor_module} = "WeBWorK::Authen::Proctor";
722718

719+
# List of authentication modules that may be used to enter the admin course.
720+
# This should always be an array reference with a subset of the modules named
721+
# in $authen{user_module}.
722+
$authen{admin_module} = ['WeBWorK::Authen::Basic_TheLastOption'];
723+
723724
################################################################################
724725
# Authorization system (Make local overrides in localOverrides.conf )
725726
################################################################################

conf/localOverrides.conf.dist

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,12 +438,57 @@ $mail{feedbackRecipients} = [
438438
# END_PREAMBLE
439439

440440
################################################################################
441-
# Authentication Methods
441+
# Authentication
442442
################################################################################
443443

444444
# Extra modules have been created to allow WeBWorK to use certain external
445445
# methods of authentication.
446446

447+
# Select the authentication module to use for normal logins.
448+
#
449+
# If this value is a string, the given authentication module will be used
450+
# regardless of the database layout.
451+
#
452+
# If it is a hash, the database layout name will be looked up in the hash and
453+
# the resulting value will be used as the authentication module. The special
454+
# hash key "*" is used if no entry for the current database layout is found.
455+
#
456+
# If this value is a sequence of strings or hashes, then each string or hash in
457+
# the sequence will be successively tested to see if it provides a module that
458+
# can handle the authentication request by calling the module's sub
459+
# request_has_data_for_this_verification_module(). The first module that
460+
# responds affirmatively will be used.
461+
462+
#$authen{user_module} = {
463+
# sql_moodle => "WeBWorK::Authen::Moodle",
464+
# sql_ldap => "WeBWorK::Authen::LDAP"
465+
# "*" => "WeBWorK::Authen::Basic_TheLastOption"
466+
#};
467+
468+
# Select the authentication module to use for proctor logins.
469+
# A string or a hash is accepted, as above.
470+
#$authen{proctor_module} = "WeBWorK::Authen::Proctor";
471+
472+
# List of authentication modules that may be used to enter the admin course.
473+
# This should be a non-empty sublist of whatever is in $authen{user_module}.
474+
# Since the admin course provides overall power to add/delete courses, access
475+
# to this course should be protected by the best possible authentication you
476+
# have available to you. The current default is
477+
# WeBWorK::Authen::Basic_TheLastOption which is simple password based
478+
# authentication for a password locally stored in your WeBWorK server's
479+
# database. On one hand, this is necessary as the initial setting, as it is the
480+
# only option available when a new server is being installed. However, since
481+
# this option does not make use of multi-factor authentication or provide any
482+
# capabilities to prevent dictionary attacks, etc. At the very least you should
483+
# use a very strong password. If you have the option to use a more secure
484+
# authentication approach to the admin course (one which you are confident
485+
# cannot be spoofed) that is preferable.
486+
#$authen{admin_module} = [
487+
# 'WeBWorK::Authen::Moodle',
488+
# 'WeBWorK::Authen::LDAP',
489+
# 'WeBWorK::Authen::Basic_TheLastOption'
490+
#];
491+
447492
################################################################################
448493
# IMS LTI Authentication
449494
################################################################################

lib/WeBWorK/Authen.pm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,9 @@ sub verify {
189189
return ($self->call_next_authen_method());
190190
}
191191

192-
if ($c->ce->{courseName} eq 'admin' && ref($c->authen) =~ /LTI/) {
193-
$c->stash(authen_error => maketext('Cannot authenticate into admin course using LTI authentication.'));
192+
my $authen_ref = ref($c->authen);
193+
if ($c->ce->{courseName} eq 'admin' && !(grep(/^$authen_ref$/, @{ $c->ce->{authen}{admin_module} }))) {
194+
$c->stash(authen_error => maketext("Cannot authenticate into admin course using $authen_ref."));
194195
return ($self->call_next_authen_method());
195196
}
196197

0 commit comments

Comments
 (0)