Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- * @ApiDoc(
- * section = "user",
- * resource = true,
- * description = "Checks the user credentials and returns an authentication & refresh token if they are correct",
- * input = { "class" = "AppBundleLibrariesCoreUserLoginRequest", "name" = "" },
- * output = { "class" = "AppBundleLibrariesCoreUserLoginResponse", "name" = "" },
- * statusCodes = {
- * 200 = "Returned when successful",
- * 400 = "Returned when request syntax is incorrect",
- * 404 = "Returned when the page is not found",
- * 429 = "Returned when the client sent too many requests during a time period",
- * 500 = "Returned when an internal server error occured",
- * 501 = "Returned when an unavailable request method is user (GET, POST, DELETE, PUT, ...)",
- * 503 = "Returned when the service is unavailable at the moment eg. due to maintenance or overload"
- * },
- *
- * )
- class LoginRequest implements JsonSerializable
- {
- /**
- * The username.
- *
- * @var string
- *
- * @AssertNotBlank()
- * @AssertType("string")
- */
- public $username;
- /**
- * The password.
- *
- * @var string
- *
- * @AssertNotBlank()
- * @AssertType("string")
- */
- public $password;
- /**
- * Defines whether or not to save the refresh token as cooke.
- *
- * @var bool
- *
- * @AssertNotBlank()
- * @AssertType("bool")
- */
- public $rememberPassword;
- public function getUsername()
- {
- return $this->username;
- }
- public function setUsername($username)
- {
- $this->username = $username;
- }
- public function getPassword()
- {
- return $this->password;
- }
- public function setPassword($password)
- {
- $this->password = $password;
- }
- public function getRememberPassword()
- {
- return $this->rememberPassword;
- }
- public function setRememberPassword($rememberPassword)
- {
- $this->rememberPassword = $rememberPassword;
- }
- public function jsonSerialize()
- {
- return [
- 'username' => $this->username,
- 'password' => $this->password,
- 'rememberPassword' => $this->rememberPassword
- ];
- }
- }
- public function buildForm(FormBuilderInterface $builder, array $options)
- {
- $builder->add('rememberPassword', CheckboxType::class, array(
- 'label' => 'input.remember.password',
- // description will be passed to table in ApiDoc view
- 'description' => 'Defines whether or not to save the refresh token as cookie',
- ));
- }
- /**
- * Lorem ipsum dolor sit amet
- *
- * #### Example of expected response ####
- * [
- * {
- * "username": "Lorem ipsum dolor sit amet",
- * "password": "Lorem ipsum dolor sit amet",
- * "rememberPassword": {
- * "1": "Lorem ipsum dolor sit amet",
- * "2": "Lorem ipsum dolor sit amet",
- * "3": "Lorem ipsum dolor sit amet"
- * },
- * },
- * ...
- * ]
- *
- * @ApiDoc(
- * section = "user",
- * resource = true,
- * description = "Checks the user credentials and returns an authentication & refresh token if they are correct",
- * input = { "class" = "AppBundleLibrariesCoreUserLoginRequest", "name" = "" },
- * output = { "class" = "AppBundleLibrariesCoreUserLoginResponse", "name" = "" },
- * statusCodes = {
- * 200 = "Returned when successful",
- * 400 = "Returned when request syntax is incorrect",
- * 404 = "Returned when the page is not found",
- * 429 = "Returned when the client sent too many requests during a time period",
- * 500 = "Returned when an internal server error occured",
- * 501 = "Returned when an unavailable request method is user (GET, POST, DELETE, PUT, ...)",
- * 503 = "Returned when the service is unavailable at the moment eg. due to maintenance or overload"
- * },
- *
- * )
- *
- */
- public function getLoginRequestAction()
- {
- // your code
- }
Add Comment
Please, Sign In to add comment