Reply
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?

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

Member
Posts: 1
Registered: ‎03-30-2021

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

There are multiple solutions available for this problem. One of the solution is API Gateway pattern .

  1. First request goes to API gateway
  2. API Gateway authenticates & authroizes the request
  3. Authentication is stored on cache database such as Redis, Memcache etc with expiry time on it
  4. Saved access token is returned to client
  5. Client can use the saved access token in the subsequent calls for the some time span (i.e. until the token is valid)
  6. Once the token is expired, the API gateway will authenticate and share the new token to client
  7. This solution will reduce the need to authenticate each request and improves the performance

API Gateway is the single entry point for all the services. So, you may not need separate cache for each service. ACES ETM

Member
Posts: 1
Registered: ‎04-07-2021

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

Confirmation is absolutely critical https://nfmerch.net/category/hats/in an application or framework to keep the client's information safe and have legitimate admittance to data.

Member
Posts: 1
Registered: ‎06-23-2021

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

It's undeniably true's that confirmation is absolutely critical https://bikecyclingreviews.com/frame-expansionwhich-wheels/ for an application or framework to keep the client's information safe and have legitimate admittance to data.

Member
Posts: 2
Registered: ‎07-02-2021

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

Integration testing is very famous topic and in this post your clearly mention How do I deal with authentication? NF Merchandise
THanks for sharing this info.

Member
Posts: 2
Registered: ‎07-02-2021

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

Integration testing is very famous topic and writer try to explain widely How do I deal with authentication? NF Merchandise
Thanks for haring this info with Us.

Member
Posts: 1
Registered: ‎08-23-2021

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

It is a famous topic to write about integration testing, so I hope to explain widely How do I handle authentication? https://247carkeys4u.co.uk/lost-audi-keys-london/

Member
Posts: 1
Registered: ‎08-27-2021

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

Incorporation testing is extremely well known theme and author attempt to clarify generally How would I manage validation? NF Merchandise

A debt of gratitude is in order for haring this data with Us.