Class AuthController

java.lang.Object
api.mpba.rastvdmy.controller.AuthController

@RestController @RequestMapping(path="/api/v1/auth") public class AuthController extends Object
Controller for handling authentication-related requests such as user signup and login.

This controller exposes endpoints for user registration and authentication, leveraging the AuthService to manage the underlying authentication logic.

  • Constructor Details

    • AuthController

      public AuthController(AuthService authService)
      Constructor for AuthController.
      Parameters:
      authService - The AuthService to be used.
  • Method Details

    • signUp

      @PostMapping(path="/signup", consumes="application/json", produces="application/json") public org.springframework.http.ResponseEntity<JwtAuthResponse> signUp(@Valid @RequestBody @Valid UserProfileRequest request) throws Exception
      Endpoint for user signup.
      Parameters:
      request - The UserProfileRequest containing user details for signup.
      Returns:
      A ResponseEntity containing the JWT authentication response.
      Throws:
      Exception - If there is an error during signup.
    • authenticate

      @PostMapping(path="/login", consumes="application/json", produces="application/json") public org.springframework.http.ResponseEntity<JwtAuthResponse> authenticate(@Valid @RequestBody @Valid UserLoginRequest userLoginRequest)
      Endpoint for user login.
      Parameters:
      userLoginRequest - The UserLoginRequest containing user credentials.
      Returns:
      A ResponseEntity containing the JWT authentication response.