Closed Ganbin closed 1 year ago
sorry to have closed your PR
Because I remove the unused branch master
on where the PR is based, it automatically close it
A new main
branch will come instead of master
,
and PR will be more studied because we will work on github (and github will not be only a mirror of our internal VCS)
Ok thanks for the info. It would be great to see more activity of 4D directly on Github!
Hi,
I haves spend some time to adapt the code to allow a more generic approach to extend to more specific implementation of OAuth2.
The OAut2 specs are a base where providers can require more customised parameters in the workflow.
I have created a
OAuth2BaseProvider
that return only the official OAuth2 setting needed or optional.I have made 2 extended classes :
OAuth2ExtendedProvider
: a provider that allow some custom Authorization params to be added in the query string.OAuth2MicrosoftProvider
: a provider that allow to have a tenant property.Both extended classes use a hook called
authenticateURIExtender
that allow to execute some code on theurl
before the authorization call is send.The extended classes can also override the
checkPrerequisites
function to allow to have more specific prerequisites.I think this approach can allow in the future to add some hooks in the workflow if a specific implementation is needed without broking existing code. We simply need to have the base class to implement a hook function that do "nothing" and the extended class that implement so specific code.
The provider classes have to be given to the
OAuth2
class that will then be able togetToken
.This is a proposition and maybe the code cannot be integrated directly.