Skip to content

Conversation

drgrice1
Copy link
Member

@drgrice1 drgrice1 commented Sep 2, 2025

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 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.

@drgrice1 drgrice1 force-pushed the lti-issues branch 2 times, most recently from 5a26609 to 402521b Compare September 8, 2025 22:00
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant