I’ve got 2 auth providers, one is based off a CredentialsAuthProvider
, while the other from MicrosoftGraphAuthProvider
.
For the cred one, we’ve also implement this IAuthResponseFilter
to return some extra things.
This means to implement two methods, even though we’re only interested in the first:
/// Intercept successful Authenticate Request DTO requests
Task ExecuteAsync(AuthFilterContext authContext);
/// Intercept successful OAuth redirect requests
Task ResultFilterAsync(AuthResultContext authContext, CancellationToken token=default);
When authenticating with the credentials auth provider, the first method is called (obviously), but when we authenticated with the OAuth-based provider, the second method is called (even if the method is implemented in the credentials-auth-provider).
It seems very strange that the method ResultFilterAsync
which resides inside our CredentialsAuthProvider should be called from another AuthProvider.
If these methods are global across all auth providers, shouldn’t they reside in something independent from the two auth providers?
Like
AuthProviderA : CredentialsAuthProvider
AuthProviderB : OAuth-based-provider
MyAuthFilters : IAuthResponseFilter
where MyAuthFilters
would contain the result filters, to be called independent of which AuthProvider was used.