packbackbooks / lti-1-3-php-library

A library used for building IMS-certified LTI 1.3 tool providers in PHP.
Apache License 2.0
39 stars 25 forks source link

Fix bug with authorization URLs having a query component #107

Closed snake closed 1 year ago

snake commented 1 year ago

As per RFC6749, section 3.1, the auth URL may have a query string. E.g. 'https://example.com/oidc?auth'. So, don't assume that '?' will be the separator when generating the auth URL.

Summary of changes

This change ensures that LtiOidcLogin::doOidcLoginRedirect() creates the auth URL properly in cases where the platform's auth URL contains a query component, and where '?' will already be present in the URL.

Prior to this change, an auth URL like 'https://example.com/oidc?auth' would result in the code generating something like: 'https://example.com/odic?auth?other=1&params=2&here=3' (note the 2x '?').

Testing

I've tested this one manually by adding some query params to the saved auth URL for a test platform and performing a launch. Without the change, there's a problem finding the scope because of the query params and the launch fails.