Guest User

Untitled

a guest
Jun 26th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.00 KB | None | 0 0
  1. * @ApiDoc(
  2. * section = "user",
  3. * resource = true,
  4. * description = "Checks the user credentials and returns an authentication & refresh token if they are correct",
  5. * input = { "class" = "AppBundleLibrariesCoreUserLoginRequest", "name" = "" },
  6. * output = { "class" = "AppBundleLibrariesCoreUserLoginResponse", "name" = "" },
  7. * statusCodes = {
  8. * 200 = "Returned when successful",
  9. * 400 = "Returned when request syntax is incorrect",
  10. * 404 = "Returned when the page is not found",
  11. * 429 = "Returned when the client sent too many requests during a time period",
  12. * 500 = "Returned when an internal server error occured",
  13. * 501 = "Returned when an unavailable request method is user (GET, POST, DELETE, PUT, ...)",
  14. * 503 = "Returned when the service is unavailable at the moment eg. due to maintenance or overload"
  15. * },
  16. *
  17. * )
  18.  
  19. class LoginRequest implements JsonSerializable
  20. {
  21. /**
  22. * The username.
  23. *
  24. * @var string
  25. *
  26. * @AssertNotBlank()
  27. * @AssertType("string")
  28. */
  29. public $username;
  30.  
  31. /**
  32. * The password.
  33. *
  34. * @var string
  35. *
  36. * @AssertNotBlank()
  37. * @AssertType("string")
  38. */
  39. public $password;
  40.  
  41. /**
  42. * Defines whether or not to save the refresh token as cooke.
  43. *
  44. * @var bool
  45. *
  46. * @AssertNotBlank()
  47. * @AssertType("bool")
  48. */
  49. public $rememberPassword;
  50.  
  51. public function getUsername()
  52. {
  53. return $this->username;
  54. }
  55.  
  56. public function setUsername($username)
  57. {
  58. $this->username = $username;
  59. }
  60.  
  61. public function getPassword()
  62. {
  63. return $this->password;
  64. }
  65.  
  66. public function setPassword($password)
  67. {
  68. $this->password = $password;
  69. }
  70.  
  71. public function getRememberPassword()
  72. {
  73. return $this->rememberPassword;
  74. }
  75.  
  76. public function setRememberPassword($rememberPassword)
  77. {
  78. $this->rememberPassword = $rememberPassword;
  79. }
  80.  
  81. public function jsonSerialize()
  82. {
  83. return [
  84. 'username' => $this->username,
  85. 'password' => $this->password,
  86. 'rememberPassword' => $this->rememberPassword
  87. ];
  88. }
  89. }
  90.  
  91. public function buildForm(FormBuilderInterface $builder, array $options)
  92. {
  93. $builder->add('rememberPassword', CheckboxType::class, array(
  94. 'label' => 'input.remember.password',
  95. // description will be passed to table in ApiDoc view
  96. 'description' => 'Defines whether or not to save the refresh token as cookie',
  97. ));
  98. }
  99.  
  100. /**
  101. * Lorem ipsum dolor sit amet
  102. *
  103. * #### Example of expected response ####
  104. * [
  105. * {
  106. * "username": "Lorem ipsum dolor sit amet",
  107. * "password": "Lorem ipsum dolor sit amet",
  108. * "rememberPassword": {
  109. * "1": "Lorem ipsum dolor sit amet",
  110. * "2": "Lorem ipsum dolor sit amet",
  111. * "3": "Lorem ipsum dolor sit amet"
  112. * },
  113. * },
  114. * ...
  115. * ]
  116. *
  117. * @ApiDoc(
  118. * section = "user",
  119. * resource = true,
  120. * description = "Checks the user credentials and returns an authentication & refresh token if they are correct",
  121. * input = { "class" = "AppBundleLibrariesCoreUserLoginRequest", "name" = "" },
  122. * output = { "class" = "AppBundleLibrariesCoreUserLoginResponse", "name" = "" },
  123. * statusCodes = {
  124. * 200 = "Returned when successful",
  125. * 400 = "Returned when request syntax is incorrect",
  126. * 404 = "Returned when the page is not found",
  127. * 429 = "Returned when the client sent too many requests during a time period",
  128. * 500 = "Returned when an internal server error occured",
  129. * 501 = "Returned when an unavailable request method is user (GET, POST, DELETE, PUT, ...)",
  130. * 503 = "Returned when the service is unavailable at the moment eg. due to maintenance or overload"
  131. * },
  132. *
  133. * )
  134. *
  135. */
  136. public function getLoginRequestAction()
  137. {
  138. // your code
  139. }
Add Comment
Please, Sign In to add comment