Class AuthController
- java.lang.Object
-
- in.cs699.tensors.delagram.auth_service.controller.AuthController
-
@RestController @RequestMapping("/auth-api") @CrossOrigin("http://localhost:3000") public class AuthController extends Object
This controller defines the end-points for authentication and authorization logic.
-
-
Constructor Summary
Constructors Constructor Description AuthController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description User
getUserForToken(String authorizationToken)
An API end-point that gives back the logged-in user for the authorization tokenString
signUp(Map<String,Object> payload)
An API call which checks the validity of user data and sign's up i.e.
-
-
-
Method Detail
-
getUserForToken
@GetMapping(value="/verify-token", produces="application/json") public User getUserForToken(@RequestHeader("authorization") String authorizationToken) throws AuthenticationFailedException, InternalServerException
An API end-point that gives back the logged-in user for the authorization token- Parameters:
authorizationToken
- The firebase token/JWT which identifies the user- Returns:
- The logged-in user
- Throws:
AuthenticationFailedException
- Thrown in case the authorization token is invalidInternalServerException
- Thrown in case some issue happens while fetching user details
-
signUp
@PostMapping("/signup") public String signUp(@RequestBody Map<String,Object> payload) throws UserNotInScopeException, AuthenticationFailedException, EmailAlreadyRegistered, UserIDAlreadyExistsException, javax.mail.internet.AddressException, javax.mail.MessagingException
An API call which checks the validity of user data and sign's up i.e. creates a new user in firebase- Parameters:
payload
- a Map which gets the form data from front-end sign up page- Returns:
- User successfully registered message if successful
- Throws:
UserNotInScopeException
- Thrown if the email id does not belong to IIT Bombay domainAuthenticationFailedException
- Thrown in case the authorization token is invalidEmailAlreadyRegistered
- Thrown if the email id is already registered with firebaseUserIDAlreadyExistsException
- Thrown if the userid is not uniquejavax.mail.internet.AddressException
- Thrown in case the address is malformedjavax.mail.MessagingException
- Thrown in case the verification message couldn't be sent
-
-