how to do integration test combine the oidc of IdentityServer , MVC client and WebAPI
See original GitHub issueNow I have a project in my job to develop So I simulate eshopOnContainer’s structure for my project(3 project now): Asp.net core webapi project for the resource of the job’s project Asp.net mvc project for client to serve Identity server 4 project use asp.net identity with oidc feature to protect the webapi project.
All config is done and run fine in the debug and release mode. Base on it, I start the integration test projects. Issue show In the oidc scenen:
- MVC client have a action for example map http://localhost:10001/home/Test, this action with [authorize] attribute.When unlogin user to this link , it will redirect user to the idserver login page to login.
- After IdServer finished logined operation.It redirect user to the MVC client’s http://localhost:10001/home/Test ,and can be retrieve these resource fine.
Above scene I try to do it in the integration test environment , but It’s difficult for use the WebApplicationFactory.CreateClient()
's httpclient
to retrieve 2 micro service (one is mvcclient and one is idserver).Because test environment just run in the in-memory , and I have no idea config the httpclient have ability to access 2 micro service (1 client access 2 testserver).
I want know if my direct is wrong or not. Or can you give me some suggestion for me to do the integration test simulated the user’s operation round tirp ? At last , Why I want this because I have do the authorization in the oidc with asp.net identity (role base about),so if I use clientid and clientsecure to get the accesstoken,it’s not have the role base about permission to access the protected api which protected by the role. Result is this a challenge for these issue .
Issue Analytics
- State:
- Created 5 years ago
- Comments:7
Top GitHub Comments
You are right 😄 I think i shoud explore this project for me. Thanks so much
Closing the issue now, as it’s not related to eShopOnContainers.