IdentityServer4 + WebApi in same project

Created on 22 Mar 2017  路  12Comments  路  Source: IdentityServer/IdentityServer4

Hi, i'm trying to build a .net core web api with identity server integrated in it using dapper as my orm with an angular2 client on the side.

Now i want the login page to be inside the angular client so i need the identityserver login controllers to be inside my api ).

My real problem is doing all that when theres nothing that helps on the documentation about this. expecially using dapper. If someone can steer me in the right direction i would be thankfull.

I've tried all the quickstarts but i find myself lost halfway everytime, in the docs they say one thing and then all the controllers, models and views are all created on the identityserver .

question

Most helpful comment

Use resource owner password flow.

All 12 comments

Use resource owner password flow.

First and foremost, thank you for replying.

But what interfaces do i need to implement and how do i go about configuring all that together?
I've implemented a ProfileService class that uses a UserRepository to fetch User data from database, and i know i have to use ResourceOwnerPasswordValidator, but what then? what do i need to setup in the Startup.cs file? how do i create The login and Logout Controller (AccountController).

And how do i go about replacing the ApplicationUser class that uses EntityFramework? As i've said i'm using Dapper instead of EF. I know i probably should know this by now but i'm feeling truly lost.

I think i'm too confused by now to explain myself in the most efficient way. But isnt hybrid flow better? i'm mean, from what i saw from the quickstart, it looks like what i want, but instead of using a seperate application for the identityServer i want it running inside my WebApi, and instead of Entityframework i'm using dapper to connect to my database, and instead a mvc client i'm using an angular2 one. but the docs cant seem to help me in any way, i mean sure if i want to use resource owner password flow (for instance) i need to implement the ResourceOwnerPasswordValidator interface but then what? i dont see anywhere what i need to do in the startup.cs to tell identityserver that i'm using my database instead TestUsers or to tell it that i'm using my version of the interface. maybe i'm missing something on the Docs but right now i'm as lost as they come.

Bear with me please.

PS: first time i heard of IdentityServer was 3 days ago, and since everything i see online has been changed recently in recent updates i cnt seem to grasp what i need to do.

To be honest, IdentityServer provides an implementation of the OpenID Connect and OAuth2 specs. That's what it sounds like you need to spend time learning. Once you know those, then IdentityServer will make much more sense.

This seems to be a general question about IdentityServer - not a bug report or an issue.

Please use StackOverflow for that. This has the advantage that questions and answers can be easily found by search engines, and that there are more people answering questions than just us.

For IdentityServer3
https://stackoverflow.com/questions/tagged/?tagnames=identityserver3&sort=newest

For IdentityServer4
https://stackoverflow.com/questions/tagged/?tagnames=identityserver4&sort=newest

For commercial support options - visit
https://identityserver.io

@rafael-chaves did you get this sorted out? I am trying to do what you did i.e. including identity server inside the api, which effectively means hosting both of them in the same app. There is a sample repo which does this. https://github.com/brockallen/IdentityServerAndApi though I haven't tried myself just yet. It would be interesting to know how far you have got.

@rafael-chaves - did you implement your requirement that involves Dapper? I am doing the exact same thing and wondering if you have something implemented already that could be used.

Same question. Too complicated while trying to implement IdentityServer4 and Web API as a project.

i talked to an software engineer and he said it is best practice to make identiy server an different project becouse if you want to expand it is easier that way
But i have kind of the same problem but i kind of know how to do it.

Same question.
I'm lost here too.
Anyone made this ?

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Aravind1729 picture Aravind1729  路  3Comments

agilenut picture agilenut  路  3Comments

mackie1001 picture mackie1001  路  3Comments

user1336 picture user1336  路  3Comments

osmankibar picture osmankibar  路  3Comments