I appreciate this feature might be useful, so there's no need to discuss that aspect. The only issue I have with this PR is with regards to security and especially as it enables doing the "wrong" thing.
With regards to redirect URIs with confidential clients they are still important, but not quite as important as they are for public client. This means redirect URIs can typically be more flexible with confidential clients without a significant risk.
For public clients it's very important to lock these down as much as possible as they are the ONLY way to prevent malicious clients to gain access to the SSO session. This means we should actually tighten the requirements for redirect URIs not further relax them. For public clients the redirect URIs:
* Should be as specific as possible. We should only allow wildcard in the path. I believe we should introduce this for both public and confidential clients.
* Require HTTPs unless it's
http://localhost. This is not so easy in development, so maybe we should have an option to run the server in "unsafe" mode for developers.
Here's a quote from the OIDC spec around this:
"REQUIRED. Redirection URI to which the response will be sent. This URI MUST exactly match one of the Redirection URI values for the Client pre-registered at the OpenID Provider, with the matching performed as described in Section 6.2.1 of [RFC3986] (Simple String Comparison). The Redirection URI SHOULD use the https scheme; however, it MAY use the http scheme, provided that the Client Type is confidential, as defined in Section 2.1 of OAuth 2.0, and provided the OP allows the use of http Redirection URIs in this case. The Redirection URI MAY use an alternate scheme, such as one that is intended to identify a callback into a native application."
Looking at your comments on the PR it worries me slightly that you have a shared client for a "library". A library is not a client. A client is an instance of an application. Sharing the client will have impact on audit, what clients a user believes they are authenticated to. With regards to wildcard to allow any subdomains that is scary as your allowing any piece of code running on any subdomain within your domain to authenticate via that particular client. That could be an infected forum, something any user has executing, etc.. As long as the redirect URI permits it an application can obtain a token for a client for a user that is authenticated without the user knowing about it. Unless you enable consent that is, but if the user used the "real" client they would have given consent and the malicious client on a different subdomain can take advantage of it.
In summary my opinion is that we can't accept this PR and that we further:
* Allow wildcard only in path. This is actually still looser than the OIDC spec mandates as it requires a simple string comparison.
* Require HTTPS (or custom scheme) for public clients. We may need a development mode that disables this.