Class FirebaseSecurity
- java.lang.Object
-
- in.cs699.tensors.delagram.auth_service.security.FirebaseSecurity
-
@Service public class FirebaseSecurity extends Object
A generic class that encapsulates security related methods for the application- Author:
- swaroop_nath
-
-
Constructor Summary
Constructors Constructor Description FirebaseSecurity()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringverifyToken(String authorizationToken)A method that verifies the Firebase TokenvoidverifyUser(String currentUserID, String authorizationToken)A service that validates the user id with the JWT that is passed on with the header of the request
-
-
-
Method Detail
-
verifyToken
public String verifyToken(String authorizationToken) throws AuthenticationFailedException
A method that verifies the Firebase Token- Parameters:
authorizationToken- The token- Returns:
- Returns the User ID if the token is valid
- Throws:
AuthenticationFailedException- Thrown in case the token is invalid
-
verifyUser
public void verifyUser(String currentUserID, String authorizationToken) throws AuthorizationFailedException, AuthenticationFailedException
A service that validates the user id with the JWT that is passed on with the header of the request- Parameters:
currentUserID- The user id of the user logged in currently, supposedlyauthorizationToken- The JWT which shall be used for authorization- Throws:
AuthorizationFailedException- Thrown when the JWT doesn't represent the passed in user idAuthenticationFailedException- Thrown when the JWT is invalid
-
-