movary icon indicating copy to clipboard operation
movary copied to clipboard

Centralize authentication process

Open JVT038 opened this issue 4 months ago • 0 comments

In this PR I have attempted to centralize the authentication process by creating a new ValueObject called AuthenticationObject.

This object has three properties, namely the token itself, the authentication method and the userEntity of the authenticated user.

Three new methods have been created to create this new authentication object. One method for creating the object with cookie authentication, one method for creating it with the token stored inside the X-Movary-Token header and one 'dynamic' method to create the object with either the header or the cookie. So the dynamic method first checks the cookie for the token and if it doesn't exist, it'll check the HTTP header for the token.

Also, the methods all check both the user_auth_token and the user_api_token table for the token.

JVT038 avatar Mar 02 '24 12:03 JVT038