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)

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.

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

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.