Search code examples
oauth-2.0openididentityserver4

IdentityServer4 Fedarated Gateway Resource Owner Setup


We are trying to split apart Authorization and Authentication into two separate services. Both will use Identity Server 4. We may someday add in additional external Authentication providers. I believe Federated Gateway is the term (http://docs.identityserver.io/en/release/topics/federation_gateway.html?highlight=Federation)

My research so far indicates we are able to setup Authorization as External Providers and set [LocalLoginEnabled] to false. This works fine for web apps, since it redirects along the traditional flows. Our requirement is to have both Web-based and client-apps (Windows and Mobile) calling our solution. This would need Implicit or Resource Owner (password) flows.

Looking for guidance on the best way to set this up. I'm tempted to write a custom endpoint API to relay the authentication to authentication instance.

QUESTION:

How can I achieve "password flow" between two ID4 instances (Authorization + Authentication)?

Thanks in advance!


Solution

  • Although my original answer worked, it was not the best way to accomplish my end result. Instead of creating a new endpoint, I am able to inject my own handling of password grants by extending the IResourceOwnerPasswordValidator. I can then have a single endpoint for all authorization. This solution is more "natural" and falls inline with the intended architecture.

    The IResourceOwnerValidator interface just implements one function...

    public Task ValidateAsync(ResourceOwnerPasswordValidationContext context)

    A much more elegant solution.