question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to do integration test combine the oidc of IdentityServer , MVC client and WebAPI

See original GitHub issue

Now 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:

  1. 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.
  2. 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:closed
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
jingliancuicommented, Jan 10, 2019

You are right 😄 I think i shoud explore this project for me. Thanks so much

0reactions
mvelosopcommented, Jan 10, 2019

Closing the issue now, as it’s not related to eShopOnContainers.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MVC Client and Api working together in IdentityServer4
I am using IdentityServer4 to create the Identity server, and I have a MVC project that uses identity server security but I also...
Read more >
Authentication and authorization for SPAs
ASP.NET Core Identity for authenticating and storing users is combined with Duende Identity Server for implementing OpenID Connect. Important.
Read more >
How To Use ASP.NET Identity And IdentityServer4 In Your ...
Identity is an essential part of any solution. This post explains how to use IdentityServer4 and ASP.NET Identity on top of .NET Core...
Read more >
Securing Microservices with IdentityServer4, OAuth2 and ...
In this article, we're going to learn how to secure microservices with using standalone Identity Server 4 and backing with Ocelot API ...
Read more >
Introduction to IdentityServer for ASP.NET Core - YouTube
NET Core and which implements the OpenID Connect and OAuth2 protocols. ... 3 | Set Up IdentityServer and an MVC Client Learn how...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found