Search code examples
asp.net-identityangular5identityserver4openid-connect

Streamlining OIDC with Identity Server 4 & Identity


Hi I'm trying to implement an Angular5 frontend that has a Sign In page that Authenticates users using an Authentication Api. The Auth Api is built using Identity Server 4 & Identity with .Net Core 2, it will then be able to use a protected APIs.

My understanding is that I should be using OIDC with an Implicit flow to Authenticate with Identity Server from the Angular UI. It should look something like the diagram on the left. While I would like a more streamlined and native login feel more maybe something like what is on the right security flows

I'm trying to avoid the redirect from Identity Server to my apps login page and then back to the UI. Ideally what I want is to be able to POST my user credentials from Angular to Identity Server, this will get authenticated and the token & claims will be returned, cutting out the flow in the Blue Box between the Login Page & Identity Server.

I plan on supporting external logins and if the user is using external authentication such as Google etc, that's fine, I'm ok with a redirect. But I want to avoid it for Users who are using my sites login.

Sorry for the upcoming open question, but I'm at the stage whee I don't know what I don't know regarding Authentication & Authorization. It is possible there is a name for what I want, I just don't know it.

Am I using the correct technology / flow for this? How should I be implementing the type of flow I want?


Solution

  • The more "streamlined" approach you would like can be achieved using "Resource-owner flow" in OAuth 2.0. But for many reasons you should avoid using this.

    • User is entering the username/password in a different domain than login server, and this is a security concern

    • When implementing features such as reset password, forget password or account lockout features you may have to redirect to login - otherwise when you add several more clients it will be confusing

    • The idea is completely abstracting out authentication from client applications, so you do not have to worry about implementing any auth logic in apps.