# How to authenticate user while writing integration test of secured rest api

**URL:** <https://forum.keycloak.org/t/how-to-authenticate-user-while-writing-integration-test-of-secured-rest-api/2365>\
**Category:** Miscellanaeous\
**Created:** [April 27, 2020, 5:49am UTC](https://forum.keycloak.org/t/how-to-authenticate-user-while-writing-integration-test-of-secured-rest-api/2365 "2020-04-27T05:49:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rohit.singh3](https://avatars.discourse-cdn.com/v4/letter/r/a8b319/32.png) [@rohit.singh3](https://forum.keycloak.org/u/rohit.singh3)\
**Post date:** [April 27, 2020, 5:49am UTC](https://forum.keycloak.org/t/how-to-authenticate-user-while-writing-integration-test-of-secured-rest-api/2365/1 "2020-04-27T05:49:06Z")

</div>

I am trying to write test cases where I have used keycloak security in Spring boot application.  
Now I am not able to write integration test of my rest api where user should be authenticate via mock user.
