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.

716 lines
20 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.5
  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/{username}:
  439. get:
  440. tags:
  441. - users
  442. summary: ${UserController.search}
  443. description: This is the user search method by username.
  444. operationId: searchUsingGET
  445. produces:
  446. - '*/*'
  447. parameters:
  448. - name: username
  449. in: query
  450. description: username of the user
  451. required: true
  452. type: string
  453. allowEmptyValue: false
  454. 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).
  455. responses:
  456. '200':
  457. description: OK
  458. schema:
  459. $ref: '#/definitions/UsersResponseDTO'
  460. '403':
  461. description: Access denied
  462. '404':
  463. description: The user doesn't exist
  464. '500':
  465. description: Expired or invalid JWT token
  466. security:
  467. - Authorization:
  468. - global
  469. - apiKey: []
  470. deprecated: false
  471. securityDefinitions:
  472. Authorization:
  473. type: apiKey
  474. name: Authorization
  475. in: header
  476. definitions:
  477. EduCemadenOrganizations:
  478. type: object
  479. properties:
  480. activationkey:
  481. type: string
  482. format: uuid
  483. active:
  484. type: string
  485. address:
  486. type: string
  487. creation_date:
  488. type: string
  489. id:
  490. type: integer
  491. format: int32
  492. inep_code:
  493. type: string
  494. login:
  495. type: string
  496. name:
  497. type: string
  498. phone:
  499. type: string
  500. responsible:
  501. type: string
  502. type:
  503. type: string
  504. website:
  505. type: string
  506. title: EduCemadenOrganizations
  507. ForgotPasswordsQuestionsResponseDTO:
  508. type: object
  509. properties:
  510. id:
  511. type: integer
  512. format: int32
  513. question:
  514. type: string
  515. active:
  516. type: integer
  517. format: int32
  518. title: ForgotPasswordsQuestionsResponseDTO
  519. ForgotPasswordsQuestionsUsersAnswersRequestDTO:
  520. type: object
  521. properties:
  522. id:
  523. type: integer
  524. format: int32
  525. forgotpasswordquestionsid:
  526. type: integer
  527. format: int32
  528. usersid:
  529. type: integer
  530. format: int32
  531. answer:
  532. type: string
  533. title: ForgotPasswordsQuestionsUsersAnswersRequestDTO
  534. UsersProviderActivationKey:
  535. type: object
  536. properties:
  537. activationkey:
  538. type: string
  539. format: uuid
  540. id:
  541. type: integer
  542. format: int32
  543. usersid:
  544. type: integer
  545. format: int32
  546. title: UsersProviderActivationKey
  547. UsersRequestDTO:
  548. type: object
  549. required:
  550. - city
  551. - nickname
  552. - password
  553. - roles
  554. - state
  555. - termsofusage
  556. - username
  557. properties:
  558. username:
  559. type: string
  560. 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).
  561. description: username of the user.
  562. nickname:
  563. type: string
  564. example: i.e. beth2021. This is an unique field, and consumers should be aware of it.
  565. description: nickname of the user.
  566. password:
  567. type: string
  568. example: i.e. P@s5w0rD.
  569. description: password of the user.
  570. dateofborn:
  571. type: string
  572. format: date
  573. example: i.e. 01/12/1978. Format should be dd/MM/yyyy.
  574. description: Date of Born of the user.
  575. gender:
  576. type: string
  577. example: i.e. M. 'M' stands for Male, 'F' Female, 'N' Not Informed
  578. description: Gender of the user.
  579. enum:
  580. - '{@code M'
  581. - F
  582. - N}
  583. state:
  584. type: string
  585. example: i.e. SP. State should be 2 characteres (UF)
  586. description: state of the user.
  587. city:
  588. type: string
  589. example: i.e. 'Governador Valadares'.
  590. description: city of the user.
  591. institutiontype:
  592. type: string
  593. example: i.e. 'E'. E stands for 'School', D 'Civil Defense', N 'No governamental', O 'others'
  594. description: institution type of the user.
  595. enum:
  596. - '{@code E'
  597. - D
  598. - 'N'
  599. - O}
  600. institution:
  601. type: string
  602. example: i.e. 'Colegio Imaginario'.
  603. description: institution of the user.
  604. securityquestion:
  605. type: string
  606. example: i.e. 'What is my favorite color?'.
  607. description: security question of the user.
  608. securityanswer:
  609. type: string
  610. example: i.e. 'Blue'.
  611. description: security answer of the user.
  612. termsofusage:
  613. type: boolean
  614. example: false
  615. description: terms of usage of the user.
  616. roles:
  617. type: array
  618. example: i.e. [ROLE_CLIENT].
  619. description: roles of the user.
  620. items:
  621. type: string
  622. enum:
  623. - ROLE_ADMIN
  624. - ROLE_INSTITUTION
  625. - ROLE_CLIENT
  626. title: UsersRequestDTO
  627. UsersResponseDTO:
  628. type: object
  629. required:
  630. - active
  631. - city
  632. - id
  633. - nickname
  634. - state
  635. - termsofusage
  636. - username
  637. properties:
  638. id:
  639. type: integer
  640. format: int32
  641. example: This is a SERIAL and Primary Key field.
  642. description: id of the user.
  643. username:
  644. type: string
  645. 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).
  646. description: username of the user.
  647. nickname:
  648. type: string
  649. example: i.e. beth2021. This is an unique field, and consumers should be aware of it.
  650. description: nickname of the user.
  651. dateofborn:
  652. type: string
  653. format: date
  654. example: i.e. 01/12/1978. Format should be dd/MM/yyyy.
  655. description: Date of Born of the user.
  656. gender:
  657. type: string
  658. example: i.e. M. 'M' stands for Male, 'F' Female, 'N' Not Informed
  659. description: Gender of the user.
  660. enum:
  661. - '{@code M'
  662. - F
  663. - N}
  664. state:
  665. type: string
  666. example: i.e. SP. State should be 2 characteres (UF)
  667. description: state of the user.
  668. city:
  669. type: string
  670. example: i.e. 'Governador Valadares'.
  671. description: city of the user.
  672. institutiontype:
  673. type: string
  674. example: i.e. 'E'. E stands for 'School', D 'Civil Defense', N 'No governamental', O 'others'
  675. description: institution type of the user.
  676. enum:
  677. - '{@code E'
  678. - D
  679. - 'N'
  680. - O}
  681. institution:
  682. type: string
  683. example: i.e. 'Colegio Imaginario'.
  684. description: institution of the user.
  685. securityquestion:
  686. type: string
  687. example: i.e. 'What is my favorite color?'.
  688. description: security question of the user.
  689. securityanswer:
  690. type: string
  691. example: i.e. 'Blue'.
  692. description: security answer of the user.
  693. termsofusage:
  694. type: boolean
  695. example: false
  696. description: terms of usage of the user.
  697. active:
  698. type: integer
  699. format: int32
  700. example: i.e. true.
  701. description: whether user is active or not.
  702. role:
  703. type: string
  704. example: i.e. 'ROLE_ADMIN' means system administrator, 'ROLE_INSTITUTION' means institution administrator, 'ROLE_CLIENT' means regular users
  705. description: institution type of the user.
  706. enum:
  707. - '{@code ROLE_ADMIN'
  708. - ROLE_INSTITUTION
  709. - ROLE_CLIENT}
  710. eduCemadenOrganization:
  711. description: which Educational Cemaden Organization the user belongs.
  712. $ref: '#/definitions/EduCemadenOrganizations'
  713. providerActivationKey:
  714. description: If this user can provide an activation key for other users ('ROLE_INSTITUTION'), this field will store the values.
  715. $ref: '#/definitions/UsersProviderActivationKey'
  716. title: UsersResponseDTO