You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

752 lines
21 KiB

  1. swagger: '2.0'
  2. info:
  3. description: 'This is a sample JWT authentication service. You can find out more about JWT at [https://jwt.io/](https://jwt.io/). For this sample, you can use the `admin` or `client` users (password: admin and client respectively) to test the authorization filters. Once you have successfully logged in and obtained the token, you should click on the right top button `Authorize` and introduce it with the prefix "Bearer ".'
  4. version: 1.0.4
  5. title: The authenticator for the Waterproofing Data (WPD) Work Packages
  6. contact:
  7. email: igsd@warwick.ac.uk
  8. license:
  9. name: Apache-2.0 License
  10. url: https://opensource.org/licenses/Apache-2.0
  11. host: localhost:8080
  12. basePath: /
  13. tags:
  14. - name: forgotpasswords
  15. description: Forgot Passwords Controller
  16. - name: users
  17. description: Operations about users
  18. paths:
  19. /forgotpasswords/findallforgotpasswordquestions:
  20. get:
  21. tags:
  22. - forgotpasswords
  23. summary: ${ForgotPasswordsController.findallforgotpasswordquestions}
  24. operationId: findallforgotpasswordquestionsUsingGET
  25. produces:
  26. - '*/*'
  27. responses:
  28. '200':
  29. description: OK
  30. schema:
  31. type: array
  32. items:
  33. $ref: '#/definitions/ForgotPasswordsQuestionsResponseDTO'
  34. '400':
  35. description: Something went wrong
  36. security:
  37. - Authorization:
  38. - global
  39. deprecated: false
  40. /forgotpasswords/loginbyusernameandanswers:
  41. post:
  42. tags:
  43. - forgotpasswords
  44. summary: ${ForgotPasswordsController.loginbyusernameandanswers}
  45. operationId: loginbyusernameandanswersUsingPOST
  46. consumes:
  47. - application/json
  48. produces:
  49. - '*/*'
  50. parameters:
  51. - in: body
  52. name: answers
  53. description: Answers
  54. required: false
  55. schema:
  56. type: array
  57. items:
  58. $ref: '#/definitions/ForgotPasswordsQuestionsUsersAnswersRequestDTO'
  59. - name: username
  60. in: query
  61. description: Username
  62. required: false
  63. type: string
  64. allowEmptyValue: false
  65. responses:
  66. '200':
  67. description: OK
  68. schema:
  69. type: string
  70. '400':
  71. description: Something went wrong
  72. '404':
  73. description: The user or answer don't exist
  74. '422':
  75. description: Invalid answers supplied to login. Must have at least 2 correct ones.
  76. security:
  77. - Authorization:
  78. - global
  79. deprecated: false
  80. /forgotpasswords/loginbyusernameandkey:
  81. post:
  82. tags:
  83. - forgotpasswords
  84. summary: ${ForgotPasswordsController.loginbyusernameandkey}
  85. operationId: loginbyusernameandkeyUsingPOST
  86. consumes:
  87. - application/json
  88. produces:
  89. - '*/*'
  90. parameters:
  91. - name: key
  92. in: query
  93. description: Key
  94. required: false
  95. type: string
  96. allowEmptyValue: false
  97. - name: username
  98. in: query
  99. description: Username
  100. required: false
  101. type: string
  102. allowEmptyValue: false
  103. responses:
  104. '200':
  105. description: OK
  106. schema:
  107. type: string
  108. '400':
  109. description: Something went wrong
  110. '422':
  111. description: Invalid username/password supplied
  112. security:
  113. - Authorization:
  114. - global
  115. deprecated: false
  116. /forgotpasswords/passwordupdatebyusername:
  117. post:
  118. tags:
  119. - forgotpasswords
  120. summary: ${ForgotPasswordsController.passwordupdatebyusername}
  121. operationId: passwordupdatebyusernameUsingPOST
  122. consumes:
  123. - application/json
  124. produces:
  125. - '*/*'
  126. parameters:
  127. - name: newPassword
  128. in: query
  129. description: NewPassword
  130. required: false
  131. type: string
  132. allowEmptyValue: false
  133. - name: username
  134. in: query
  135. description: Username
  136. required: false
  137. type: string
  138. allowEmptyValue: false
  139. responses:
  140. '200':
  141. description: OK
  142. '400':
  143. description: Something went wrong
  144. '403':
  145. description: Access denied
  146. '404':
  147. description: The user doesn't exist
  148. '500':
  149. description: Expired or invalid JWT token
  150. security:
  151. - Authorization:
  152. - global
  153. - apiKey: []
  154. deprecated: false
  155. /forgotpasswords/saveforgotpasswordquestionsusersanswers:
  156. post:
  157. tags:
  158. - forgotpasswords
  159. summary: ${ForgotPasswordsController.saveforgotpasswordquestionsusersanswers}
  160. operationId: saveforgotpasswordquestionsusersanswersUsingPOST
  161. consumes:
  162. - application/json
  163. produces:
  164. - '*/*'
  165. parameters:
  166. - in: body
  167. name: answer
  168. description: Forgot Password Questions Users Answers
  169. required: false
  170. schema:
  171. $ref: '#/definitions/ForgotPasswordsQuestionsUsersAnswersRequestDTO'
  172. responses:
  173. '200':
  174. description: OK
  175. '400':
  176. description: Something went wrong
  177. '403':
  178. description: Access denied
  179. '404':
  180. description: The user or forgot password questions don't exist
  181. '500':
  182. description: Expired or invalid JWT token
  183. security:
  184. - Authorization:
  185. - global
  186. - apiKey: []
  187. deprecated: false
  188. /forgotpasswords/sendkeybyemail:
  189. post:
  190. tags:
  191. - forgotpasswords
  192. summary: ${ForgotPasswordsController.sendkeybyemail}
  193. operationId: sendkeybyemailUsingPOST
  194. consumes:
  195. - application/json
  196. produces:
  197. - '*/*'
  198. parameters:
  199. - name: email
  200. in: query
  201. description: Email
  202. required: false
  203. type: string
  204. allowEmptyValue: false
  205. - name: username
  206. in: query
  207. description: Username
  208. required: false
  209. type: string
  210. allowEmptyValue: false
  211. responses:
  212. '200':
  213. description: OK
  214. '400':
  215. description: Something went wrong
  216. '422':
  217. description: Invalid email supplied
  218. security:
  219. - Authorization:
  220. - global
  221. deprecated: false
  222. /users/activate:
  223. post:
  224. tags:
  225. - users
  226. summary: ${UserController.activate}
  227. description: This is the user activation method.
  228. operationId: activateUsingPOST
  229. consumes:
  230. - application/json
  231. produces:
  232. - '*/*'
  233. parameters:
  234. - name: activationkey
  235. in: query
  236. description: Activation Key to activate the user
  237. required: true
  238. type: string
  239. allowEmptyValue: false
  240. x-example: If user belongs to 'ROLE_INSTITUTION' the key should be collected from the EduCemadenOrganization registration. If the user belongs to 'ROLE_CLIENT' the key should be provided by a 'ROLE_INSTITUTION' valid user.
  241. - name: username
  242. in: query
  243. description: username of the user
  244. required: true
  245. type: string
  246. allowEmptyValue: false
  247. x-example: This is an unique field, and consumers should be aware of it. By convention, WP6 should send the user phone number (i.e. (99)99999-9999).
  248. responses:
  249. '200':
  250. description: OK
  251. schema:
  252. type: string
  253. '400':
  254. description: Something went wrong
  255. '403':
  256. description: Access denied
  257. '422':
  258. description: User or ActivationKey registration issues
  259. '500':
  260. description: Expired or invalid JWT token
  261. security:
  262. - Authorization:
  263. - global
  264. - apiKey: []
  265. deprecated: false
  266. /users/existsByNickname:
  267. post:
  268. tags:
  269. - users
  270. summary: ${UserController.existsByNickname}
  271. description: From a nickname, this method returns if there is a nickname in db or not.
  272. operationId: existsByNicknameUsingPOST
  273. consumes:
  274. - application/json
  275. produces:
  276. - '*/*'
  277. parameters:
  278. - name: nickname
  279. in: query
  280. description: nickname of the user
  281. required: true
  282. type: string
  283. allowEmptyValue: false
  284. x-example: This is an unique field, and consumers should be aware of it.
  285. responses:
  286. '200':
  287. description: OK
  288. schema:
  289. type: boolean
  290. '400':
  291. description: Something went wrong
  292. security:
  293. - Authorization:
  294. - global
  295. deprecated: false
  296. /users/existsByUsername:
  297. post:
  298. tags:
  299. - users
  300. summary: ${UserController.existsByUsername}
  301. description: From a username, this method returns if there is a username in db or not.
  302. operationId: existsByUsernameUsingPOST
  303. consumes:
  304. - application/json
  305. produces:
  306. - '*/*'
  307. parameters:
  308. - name: username
  309. in: query
  310. description: username of the user
  311. required: true
  312. type: string
  313. allowEmptyValue: false
  314. x-example: This is an unique field, and consumers should be aware of it. By convention, WP6 should send the user phone number (i.e. (99)99999-9999).
  315. responses:
  316. '200':
  317. description: OK
  318. schema:
  319. type: boolean
  320. '400':
  321. description: Something went wrong
  322. security:
  323. - Authorization:
  324. - global
  325. deprecated: false
  326. /users/login:
  327. post:
  328. tags:
  329. - users
  330. summary: ${UserController.login}
  331. description: From a valid username and password, this method returns the JWT Token to be used in secure methods.
  332. operationId: loginUsingPOST
  333. consumes:
  334. - application/json
  335. produces:
  336. - '*/*'
  337. parameters:
  338. - name: password
  339. in: query
  340. description: password of the user
  341. required: true
  342. type: string
  343. allowEmptyValue: false
  344. x-example: i.e. P@s5w0rD
  345. - name: username
  346. in: query
  347. description: username of the user
  348. required: true
  349. type: string
  350. allowEmptyValue: false
  351. x-example: This is an unique field, and consumers should be aware of it. By convention, WP6 should send the user phone number (i.e. (99)99999-9999).
  352. responses:
  353. '200':
  354. description: OK
  355. schema:
  356. type: string
  357. '400':
  358. description: Something went wrong
  359. '404':
  360. description: Invalid username/password supplied
  361. security:
  362. - Authorization:
  363. - global
  364. deprecated: false
  365. /users/me:
  366. get:
  367. tags:
  368. - users
  369. summary: ${UserController.me}
  370. description: This is the user search method by token.
  371. operationId: whoamiUsingGET
  372. produces:
  373. - '*/*'
  374. responses:
  375. '200':
  376. description: OK
  377. schema:
  378. $ref: '#/definitions/UsersResponseDTO'
  379. '400':
  380. description: Something went wrong
  381. '403':
  382. description: Access denied
  383. '500':
  384. description: Expired or invalid JWT token
  385. security:
  386. - Authorization:
  387. - global
  388. - apiKey: []
  389. deprecated: false
  390. /users/refresh:
  391. get:
  392. tags:
  393. - users
  394. summary: refresh
  395. operationId: refreshUsingGET
  396. produces:
  397. - '*/*'
  398. responses:
  399. '200':
  400. description: OK
  401. schema:
  402. type: string
  403. security:
  404. - Authorization:
  405. - global
  406. deprecated: false
  407. /users/signup:
  408. post:
  409. tags:
  410. - users
  411. summary: ${UserController.signup}
  412. description: This the signup method to create new users. By defaul all users are created as inactive. To activate, the method ${UserController.activate} should be invoked.
  413. operationId: signupUsingPOST
  414. consumes:
  415. - application/json
  416. produces:
  417. - '*/*'
  418. parameters:
  419. - in: body
  420. name: user
  421. description: Signup User
  422. required: true
  423. schema:
  424. $ref: '#/definitions/UsersRequestDTO'
  425. responses:
  426. '200':
  427. description: OK
  428. schema:
  429. type: string
  430. '400':
  431. description: Something went wrong
  432. '422':
  433. description: Required parameters should be provided
  434. security:
  435. - Authorization:
  436. - global
  437. deprecated: false
  438. /users/{id}:
  439. get:
  440. tags:
  441. - users
  442. summary: ${UserController.findById}
  443. description: This is the user findById search method.
  444. operationId: findByIdUsingGET
  445. produces:
  446. - '*/*'
  447. parameters:
  448. - name: id
  449. in: query
  450. description: user id
  451. required: true
  452. type: integer
  453. format: int32
  454. allowEmptyValue: false
  455. x-example: A positive numeric id.
  456. responses:
  457. '200':
  458. description: OK
  459. schema:
  460. $ref: '#/definitions/UsersResponseDTO'
  461. '403':
  462. description: Access denied
  463. '404':
  464. description: The user doesn't exist
  465. '500':
  466. description: Expired or invalid JWT token
  467. security:
  468. - Authorization:
  469. - global
  470. - apiKey: []
  471. deprecated: false
  472. /users/{username}:
  473. get:
  474. tags:
  475. - users
  476. summary: ${UserController.search}
  477. description: This is the user search method by username.
  478. operationId: searchUsingGET
  479. produces:
  480. - '*/*'
  481. parameters:
  482. - name: username
  483. in: query
  484. description: username of the user
  485. required: true
  486. type: string
  487. allowEmptyValue: false
  488. x-example: This is an unique field, and consumers should be aware of it. By convention, WP6 should send the user phone number (i.e. (99)99999-9999).
  489. responses:
  490. '200':
  491. description: OK
  492. schema:
  493. $ref: '#/definitions/UsersResponseDTO'
  494. '403':
  495. description: Access denied
  496. '404':
  497. description: The user doesn't exist
  498. '500':
  499. description: Expired or invalid JWT token
  500. security:
  501. - Authorization:
  502. - global
  503. - apiKey: []
  504. deprecated: false
  505. securityDefinitions:
  506. Authorization:
  507. type: apiKey
  508. name: Authorization
  509. in: header
  510. definitions:
  511. EduCemadenOrganizations:
  512. type: object
  513. properties:
  514. activationkey:
  515. type: string
  516. format: uuid
  517. active:
  518. type: string
  519. address:
  520. type: string
  521. creation_date:
  522. type: string
  523. id:
  524. type: integer
  525. format: int32
  526. inep_code:
  527. type: string
  528. login:
  529. type: string
  530. name:
  531. type: string
  532. phone:
  533. type: string
  534. responsible:
  535. type: string
  536. type:
  537. type: string
  538. website:
  539. type: string
  540. title: EduCemadenOrganizations
  541. ForgotPasswordsQuestionsResponseDTO:
  542. type: object
  543. properties:
  544. id:
  545. type: integer
  546. format: int32
  547. question:
  548. type: string
  549. active:
  550. type: integer
  551. format: int32
  552. title: ForgotPasswordsQuestionsResponseDTO
  553. ForgotPasswordsQuestionsUsersAnswersRequestDTO:
  554. type: object
  555. properties:
  556. id:
  557. type: integer
  558. format: int32
  559. forgotpasswordquestionsid:
  560. type: integer
  561. format: int32
  562. usersid:
  563. type: integer
  564. format: int32
  565. answer:
  566. type: string
  567. title: ForgotPasswordsQuestionsUsersAnswersRequestDTO
  568. UsersProviderActivationKey:
  569. type: object
  570. properties:
  571. activationkey:
  572. type: string
  573. format: uuid
  574. id:
  575. type: integer
  576. format: int32
  577. usersid:
  578. type: integer
  579. format: int32
  580. title: UsersProviderActivationKey
  581. UsersRequestDTO:
  582. type: object
  583. required:
  584. - city
  585. - nickname
  586. - password
  587. - roles
  588. - state
  589. - termsofusage
  590. - username
  591. properties:
  592. username:
  593. type: string
  594. example: This is an unique field, and consumers should be aware of it. By convention, WP6 should send the user phone number (i.e. (99)99999-9999).
  595. description: username of the user.
  596. nickname:
  597. type: string
  598. example: i.e. beth2021. This is an unique field, and consumers should be aware of it.
  599. description: nickname of the user.
  600. password:
  601. type: string
  602. example: i.e. P@s5w0rD.
  603. description: password of the user.
  604. dateofborn:
  605. type: string
  606. format: date
  607. example: i.e. 01/12/1978. Format should be dd/MM/yyyy.
  608. description: Date of Born of the user.
  609. gender:
  610. type: string
  611. example: i.e. M. 'M' stands for Male, 'F' Female, 'N' Not Informed
  612. description: Gender of the user.
  613. enum:
  614. - '{@code M'
  615. - F
  616. - N}
  617. state:
  618. type: string
  619. example: i.e. SP. State should be 2 characteres (UF)
  620. description: state of the user.
  621. city:
  622. type: string
  623. example: i.e. 'Governador Valadares'.
  624. description: city of the user.
  625. institutiontype:
  626. type: string
  627. example: i.e. 'E'. E stands for 'School', D 'Civil Defense', N 'No governamental', O 'others'
  628. description: institution type of the user.
  629. enum:
  630. - '{@code E'
  631. - D
  632. - 'N'
  633. - O}
  634. institution:
  635. type: string
  636. example: i.e. 'Colegio Imaginario'.
  637. description: institution of the user.
  638. securityquestion:
  639. type: string
  640. example: i.e. 'What is my favorite color?'.
  641. description: security question of the user.
  642. securityanswer:
  643. type: string
  644. example: i.e. 'Blue'.
  645. description: security answer of the user.
  646. termsofusage:
  647. type: boolean
  648. example: false
  649. description: terms of usage of the user.
  650. roles:
  651. type: array
  652. example: i.e. [ROLE_CLIENT].
  653. description: roles of the user.
  654. items:
  655. type: string
  656. enum:
  657. - ROLE_ADMIN
  658. - ROLE_INSTITUTION
  659. - ROLE_CLIENT
  660. title: UsersRequestDTO
  661. UsersResponseDTO:
  662. type: object
  663. required:
  664. - active
  665. - city
  666. - id
  667. - nickname
  668. - state
  669. - termsofusage
  670. - username
  671. properties:
  672. id:
  673. type: integer
  674. format: int32
  675. example: This is a SERIAL and Primary Key field.
  676. description: id of the user.
  677. username:
  678. type: string
  679. example: This is an unique field, and consumers should be aware of it. By convention, WP6 should send the user phone number (i.e. (99)99999-9999).
  680. description: username of the user.
  681. nickname:
  682. type: string
  683. example: i.e. beth2021. This is an unique field, and consumers should be aware of it.
  684. description: nickname of the user.
  685. dateofborn:
  686. type: string
  687. format: date
  688. example: i.e. 01/12/1978. Format should be dd/MM/yyyy.
  689. description: Date of Born of the user.
  690. gender:
  691. type: string
  692. example: i.e. M. 'M' stands for Male, 'F' Female, 'N' Not Informed
  693. description: Gender of the user.
  694. enum:
  695. - '{@code M'
  696. - F
  697. - N}
  698. state:
  699. type: string
  700. example: i.e. SP. State should be 2 characteres (UF)
  701. description: state of the user.
  702. city:
  703. type: string
  704. example: i.e. 'Governador Valadares'.
  705. description: city of the user.
  706. institutiontype:
  707. type: string
  708. example: i.e. 'E'. E stands for 'School', D 'Civil Defense', N 'No governamental', O 'others'
  709. description: institution type of the user.
  710. enum:
  711. - '{@code E'
  712. - D
  713. - 'N'
  714. - O}
  715. institution:
  716. type: string
  717. example: i.e. 'Colegio Imaginario'.
  718. description: institution of the user.
  719. securityquestion:
  720. type: string
  721. example: i.e. 'What is my favorite color?'.
  722. description: security question of the user.
  723. securityanswer:
  724. type: string
  725. example: i.e. 'Blue'.
  726. description: security answer of the user.
  727. termsofusage:
  728. type: boolean
  729. example: false
  730. description: terms of usage of the user.
  731. active:
  732. type: integer
  733. format: int32
  734. example: i.e. true.
  735. description: whether user is active or not.
  736. roles:
  737. type: array
  738. example: i.e. ['ROLE_ADMIN'] means system administrator, ['ROLE_INSTITUTION'] means institution administrator, ['ROLE_CLIENT'] means regular users
  739. description: list of institution type of the user.
  740. items:
  741. type: string
  742. enum:
  743. - '{@code ROLE_ADMIN'
  744. - ROLE_INSTITUTION
  745. - ROLE_CLIENT}
  746. eduCemadenOrganization:
  747. description: which Educational Cemaden Organization the user belongs.
  748. $ref: '#/definitions/EduCemadenOrganizations'
  749. providerActivationKey:
  750. description: If this user can provide an activation key for other users ('ROLE_INSTITUTION'), this field will store the values.
  751. $ref: '#/definitions/UsersProviderActivationKey'
  752. title: UsersResponseDTO