Reply
Highlighted
New Member
Posts: 1
Registered: ‎11-06-2020

Integration testing - How do I deal with authentication?

I am trying to setup some integration tests for a web API. Some of the routes in the controller I am interested in use the [Authorize] attribute, backed by JWT authentication using Identity Server 4, to prevent unauthorized from accessing certain resources.

I'd like to "disable" authorization for testing purposes: replacing Identity Server with a "fake" authorizer that always gives green light to all requests.

I am using TestServer to run the API I want to test in memory and I'd like to use ConfigureTestServices to override the authorisation method, but I can't find any easy way to stub/mock it.

Does anyone have any relevant experience with a similar problem?

Highlighted
Member
Posts: 9
Registered: ‎12-02-2019

Re: Integration testing - How do I deal with authentication?

[ Edited ]

It’s an undeniable fact that authentication is of the utmost importance https://testmyspeed.onl/ in any type of application or system to keep the user’s data safe and have proper access to information.

Highlighted
New Member
Posts: 1
Registered: ‎11-13-2020

Re: Integration testing - How do I deal with authentication?

This works really well for us, thank you!  myccpay