-
-
Notifications
You must be signed in to change notification settings - Fork 167
Don't create users for LTI users that do not have permission to login. #2799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
5a26609
to
402521b
Compare
d6810cd
to
ac7b42d
Compare
ac7b42d
to
6568828
Compare
lib/WeBWorK/Authen/LTIAdvanced.pm
Outdated
debug("User |$user_id| is unknown but may be an new user from an LSM via LTI. " | ||
. "Saw a value for $key About to return a 1"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo? "LSM"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed that typo.
lib/WeBWorK/Authen/LTIAdvanced.pm
Outdated
warn "LTI is not properly configured (no preferred_source_of_username). " | ||
. "Please contact your instructor or system administrator."; | ||
$self->{error} = $c->maketext("There was an error during the login process. " | ||
. "Please speak to your instructor or system administrator."); | ||
debug("No preferred_source_of_username in " | ||
. $c->ce->{'courseName'} | ||
. " so LTIAdvanced::get_credentials is returning a 0\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need these warn statements (here and below)? Wouldn't it be better to just show the user $self->{error}
and put all releveant info in the debug()
message. No need to state the page has errors, users who haven't enabled debugging shouldn't see that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know. It has always been this way. I agree that a warning is not a good way to deal with this, but this is a warning that on a properly configured system will not be seen. Students should never see it. By the time students start signing in, the system will usually have been tested and properly configured.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the warning and made it so that it is only shown if debug_lti_parameters
is set. I agree that this should not be shown to the end user, and that the $self->{error}
is sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also did the same with the warn statement "below". It took me a bit to figure out which warn statement you were talking about "below". It is way below with several other warn statements in between.
0b0ac37
to
8dc953c
Compare
Currently if `$permissionLevels{login} = 'professor'` and a user signs in via LTI that would be assigned the role of "student", then webwork2 creates the user and signs the user in. However, on subsequent LTI logins authentication fails. This refuses to create a user if the requested role would not have permission to login. Clean up the error messages some. There is a lot of work left to do on this. The LTIAdvance.pm module has an extremely poor design for error handling and messaging to go with those errors. The LTIAdvantage.pm module is only a tad better (I largely just copied the poor design of the LTIAdvanced.pm module). The `log_error` key is set and appended to numerous times, frequently resulting in a long run on message that doesn't really make sense. Also, there were some of these errors that were adding "LOGIN FAILED". That was removed because The `Authen.pm` code always prepends that and that resulted in logs with "LOGIN FAILED LOGIN FAILED ...". The `authenticate` method is expected to return either 1 or a message indicating the failure. Currently it returns either 1 or 0. As a result the messages that are set in the `authenticate` method go into the abyss. Those messages should be returned instead of setting `$self->{error}`. Note that the method can still return 0 if no message should be set (as in the case of the OAuth token failing to verify for LTI 1.1). For LTI 1.3 make sure that the fallback_source_of_username is set before attempting to use it. Otherwise the claim extraction fails and it results in a database error later. Fix a minor issue in the authen_LTI.conf.dist file. The permissionLevels lines should end with semicolons, not commas.
8dc953c
to
93a3097
Compare
Currently if
$permissionLevels{login} = 'professor'
and a user signs in via LTI that would be assigned the role of "student", then webwork2 creates the user and signs the user in. However, on subsequent LTI logins authentication fails. This refuses to create a user if the requested role would not have permission to login. @somiaj pointed this out recently in Slack.Clean up the error messages some. There is a lot of work left to do on this. The LTIAdvance.pm module has an extremely poor design for error handling and messaging to go with those errors. The LTIAdvantage.pm module is only a tad better (I largely just copied the poor design of the LTIAdvanced.pm module). The
log_error
key is set and appended to numerous times, frequently resulting in a long run on message that doesn't really make sense. Also, there were some of these errors that were adding "LOGIN FAILED". That was removed because TheAuthen.pm
code always prepends that and that resulted in logs with "LOGIN FAILED LOGIN FAILED ...".The
authenticate
method is expected to return either 1 or a message indicating the failure. Currently it returns either 1 or 0. As a result the messages that are set in theauthenticate
method go into the abyss. Those messages should be returned instead of setting$self->{error}
. Note that the method can still return 0 if no message should be set (as in the case of the OAuth token failing to verify for LTI 1.1).For LTI 1.3 make sure that the fallback_source_of_username is set before attempting to use it. Otherwise the claim extraction fails and it results in a database error later.