-
Notifications
You must be signed in to change notification settings - Fork 24
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
Change how the OIDC Login URL is used, mark the Redirect for deprecation #116
Conversation
The OIDC redirect is used by our application to authenticate with the LMS during an LTI launch. Once we've authenticated, we get back the LTI launch data. The old doOidcLoginRedirect() method used to build a Redirect object. Then our platform could figure out how use that. Your options were to 1) just get the URL, 2) redirect using the PHP header() function, 3) create an auto-submitting javascript form, or 4) do a weird hybrid of 2 and 3. I'm taking the opinion here that this package shouldn't have any business deciding how the redirect should be executed. Both options 2, 3, and 4 seem to go against how most modern web frameworks work in practice. We shouldn't be building auto-submitting javascript forms. Nor should we be setting headers and exiting the application. If you want to use either of those approaches in your application, you should do that within your application code. That leaves us only with option 1 - returning the URL. In that case it seems pointless to have a |
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.
@dbhynds - I have a few questions but other than that I was able to confirm that LTI launch still works on the platform.
src/LtiOidcLogin.php
Outdated
* @param string $launchUrl URL to redirect back to after the OIDC login. This URL must match exactly a URL white listed in the platform. | ||
* @param array $request An array of request parameters. If not set will default to $_REQUEST. | ||
* @return Redirect returns a redirect object containing the fully formed OIDC login URL | ||
* @deprecated Use getRedirectUrl() to get the URL and then redirect to it yourself |
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 know at what version doOidcLoginRedirect
will be removed? if so, could we mention that in the comment?
src/LtiOidcLogin.php
Outdated
if ($request === null) { | ||
$request = $_REQUEST; | ||
} | ||
|
||
if (empty($launchUrl)) { | ||
throw new OidcException(static::ERROR_MSG_LAUNCH_URL, 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.
$launchUrl
seems important enough to warrant this validtation. Why was it removed?
@@ -18,6 +21,7 @@ public function __construct(string $location, ?string $referer_query = null) | |||
|
|||
public function doRedirect() | |||
{ | |||
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED); |
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.
This might be overkill but shouldn't a deprication warning be also be shown for getRedirectUrl
?
Summary of Changes
Changes how the OIDC Login URL is retrieved, and prep the
Redirect
for deprecation. Now that we're not building HTML, theRedirect
object doesn't really serve a purpose except to return the URL. We might as well just have theLtiOidLogin
do that.In the next version of the library:
Testing
I tested this out on the platform and tests passed: https://gitlab.com/packback/questions/-/pipelines/1105960419
composer test
before opening this PRcomposer lint-fix
before opening this PR