Add filter to process my request before going to actual request

What I have to do is process my request before the actual request is hit.

So for that should I write any filter or suggest if any relevance way to achieve.

Have a look at the HTTP component of Flow and the Request Handler or Component Chain part (depending on, what you want to process)

https://flowframework.readthedocs.io/en/stable/TheDefinitiveGuide/PartIII/Http.html#request-handler

Thanks for the support.
One more query to make my task bit easier
I have a request object containing username and password , through which i need to login into Neos and logout when need to be done.

Suggest me on the same.
Thanks

Depending on the usecase, you will have to adjust and implement it as a authentication provider. Read this chapter

https://flowframework.readthedocs.io/en/stable/TheDefinitiveGuide/PartIII/Security.html#authentication

Can we write custom authentication provider when user need to enter his/her username .(will hide the password field form index.html)?
Once user submit the login button ,will be logged into the system.

Yes, you can write all kind of authentication providers that authenticates based on the values submitted.

It’s not requiring a username & password. It can be anything.

Can you please throw more light on that so as to be on the same page.