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.

696 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.0
  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 emailcemaden, previously sent by ${UserController.sendadminkeybyemailcemaden}. 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/login:
  267. post:
  268. tags:
  269. - users
  270. summary: ${UserController.login}
  271. description: From a valid username and password, this method returns the JWT Token to be used in secure methods.
  272. operationId: loginUsingPOST
  273. consumes:
  274. - application/json
  275. produces:
  276. - '*/*'
  277. parameters:
  278. - name: password
  279. in: query
  280. description: password of the user
  281. required: true
  282. type: string
  283. allowEmptyValue: false
  284. x-example: i.e. P@s5w0rD
  285. - name: username
  286. in: query
  287. description: username of the user
  288. required: true
  289. type: string
  290. allowEmptyValue: false
  291. 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).
  292. responses:
  293. '200':
  294. description: OK
  295. schema:
  296. type: string
  297. '400':
  298. description: Something went wrong
  299. '404':
  300. description: Invalid username/password supplied
  301. security:
  302. - Authorization:
  303. - global
  304. deprecated: false
  305. /users/me:
  306. get:
  307. tags:
  308. - users
  309. summary: ${UserController.me}
  310. description: This is the user search method by token.
  311. operationId: whoamiUsingGET
  312. produces:
  313. - '*/*'
  314. responses:
  315. '200':
  316. description: OK
  317. schema:
  318. $ref: '#/definitions/UsersResponseDTO'
  319. '400':
  320. description: Something went wrong
  321. '403':
  322. description: Access denied
  323. '500':
  324. description: Expired or invalid JWT token
  325. security:
  326. - Authorization:
  327. - global
  328. - apiKey: []
  329. deprecated: false
  330. /users/refresh:
  331. get:
  332. tags:
  333. - users
  334. summary: refresh
  335. operationId: refreshUsingGET
  336. produces:
  337. - '*/*'
  338. responses:
  339. '200':
  340. description: OK
  341. schema:
  342. type: string
  343. security:
  344. - Authorization:
  345. - global
  346. deprecated: false
  347. /users/sendadminkeybyemailcemaden:
  348. post:
  349. tags:
  350. - users
  351. summary: ${UserController.sendadminkeybyemailcemaden}
  352. description: This method is used for role 'ROLE_INSTITUTION'. To activate these users, a key is sent to the EduCemandenOrg e-mail and the user should inform this key to proceed.
  353. operationId: sendadminkeybyemailcemadenUsingPOST
  354. consumes:
  355. - application/json
  356. produces:
  357. - '*/*'
  358. parameters:
  359. - name: emailcemaden
  360. in: query
  361. description: Emailcemaden associated to the user
  362. required: true
  363. type: string
  364. allowEmptyValue: false
  365. x-example: The Cemaden e-mail registred in the database. The key will be sent to this e-mail, and the user should be inform this key to proceed.
  366. - name: username
  367. in: query
  368. description: username of the user
  369. required: true
  370. type: string
  371. allowEmptyValue: false
  372. 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).
  373. responses:
  374. '200':
  375. description: OK
  376. '400':
  377. description: Something went wrong
  378. '403':
  379. description: Access denied
  380. '404':
  381. description: User or Email Cemaden not found
  382. '500':
  383. description: Expired or invalid JWT token
  384. security:
  385. - Authorization:
  386. - global
  387. - apiKey: []
  388. deprecated: false
  389. /users/signup:
  390. post:
  391. tags:
  392. - users
  393. summary: ${UserController.signup}
  394. 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.
  395. operationId: signupUsingPOST
  396. consumes:
  397. - application/json
  398. produces:
  399. - '*/*'
  400. parameters:
  401. - in: body
  402. name: user
  403. description: Signup User
  404. required: true
  405. schema:
  406. $ref: '#/definitions/UsersRequestDTO'
  407. responses:
  408. '200':
  409. description: OK
  410. schema:
  411. type: string
  412. '400':
  413. description: Something went wrong
  414. '422':
  415. description: Required parameters should be provided
  416. security:
  417. - Authorization:
  418. - global
  419. deprecated: false
  420. /users/{username}:
  421. get:
  422. tags:
  423. - users
  424. summary: ${UserController.search}
  425. description: This is the user search method by username.
  426. operationId: searchUsingGET
  427. produces:
  428. - '*/*'
  429. parameters:
  430. - name: username
  431. in: query
  432. description: username of the user
  433. required: true
  434. type: string
  435. allowEmptyValue: false
  436. 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).
  437. responses:
  438. '200':
  439. description: OK
  440. schema:
  441. $ref: '#/definitions/UsersResponseDTO'
  442. '403':
  443. description: Access denied
  444. '404':
  445. description: The user doesn't exist
  446. '500':
  447. description: Expired or invalid JWT token
  448. security:
  449. - Authorization:
  450. - global
  451. - apiKey: []
  452. deprecated: false
  453. securityDefinitions:
  454. Authorization:
  455. type: apiKey
  456. name: Authorization
  457. in: header
  458. definitions:
  459. EduCemadenOrganizations:
  460. type: object
  461. properties:
  462. active:
  463. type: string
  464. address:
  465. type: string
  466. creation_date:
  467. type: string
  468. email:
  469. type: string
  470. id:
  471. type: integer
  472. format: int32
  473. inep_code:
  474. type: string
  475. login:
  476. type: string
  477. name:
  478. type: string
  479. phone:
  480. type: string
  481. responsible:
  482. type: string
  483. type:
  484. type: string
  485. website:
  486. type: string
  487. title: EduCemadenOrganizations
  488. ForgotPasswordsQuestionsResponseDTO:
  489. type: object
  490. properties:
  491. id:
  492. type: integer
  493. format: int32
  494. question:
  495. type: string
  496. active:
  497. type: integer
  498. format: int32
  499. title: ForgotPasswordsQuestionsResponseDTO
  500. ForgotPasswordsQuestionsUsersAnswersRequestDTO:
  501. type: object
  502. properties:
  503. id:
  504. type: integer
  505. format: int32
  506. forgotpasswordquestionsid:
  507. type: integer
  508. format: int32
  509. usersid:
  510. type: integer
  511. format: int32
  512. answer:
  513. type: string
  514. title: ForgotPasswordsQuestionsUsersAnswersRequestDTO
  515. UsersProviderActivationKey:
  516. type: object
  517. properties:
  518. activationkey:
  519. type: string
  520. id:
  521. type: integer
  522. format: int32
  523. usersid:
  524. type: integer
  525. format: int32
  526. title: UsersProviderActivationKey
  527. UsersRequestDTO:
  528. type: object
  529. required:
  530. - city
  531. - nickname
  532. - password
  533. - roles
  534. - state
  535. - termsofusage
  536. - username
  537. properties:
  538. username:
  539. type: string
  540. 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).
  541. description: username of the user.
  542. nickname:
  543. type: string
  544. example: i.e. beth2021. This is an unique field, and consumers should be aware of it.
  545. description: nickname of the user.
  546. password:
  547. type: string
  548. example: i.e. P@s5w0rD.
  549. description: password of the user.
  550. dateofborn:
  551. type: string
  552. format: date
  553. example: i.e. 01/12/1978. Format should be dd/MM/yyyy.
  554. description: Date of Born of the user.
  555. gender:
  556. type: string
  557. example: i.e. M. 'M' stands for Male, 'F' Female, 'N' Not Informed
  558. description: Gender of the user.
  559. enum:
  560. - '{@code M'
  561. - F
  562. - N}
  563. state:
  564. type: string
  565. example: i.e. SP. State should be 2 characteres (UF)
  566. description: state of the user.
  567. city:
  568. type: string
  569. example: i.e. 'Governador Valadares'.
  570. description: city of the user.
  571. institutiontype:
  572. type: string
  573. example: i.e. 'E'. E stands for 'School', D 'Civil Defense', N 'No governamental', O 'others'
  574. description: institution type of the user.
  575. enum:
  576. - '{@code E'
  577. - D
  578. - 'N'
  579. - O}
  580. institution:
  581. type: string
  582. example: i.e. 'Colegio Imaginario'.
  583. description: institution of the user.
  584. securityquestion:
  585. type: string
  586. example: i.e. 'What is my favorite color?'.
  587. description: security question of the user.
  588. securityanswer:
  589. type: string
  590. example: i.e. 'Blue'.
  591. description: security answer of the user.
  592. termsofusage:
  593. type: boolean
  594. example: false
  595. description: terms of usage of the user.
  596. roles:
  597. type: array
  598. example: i.e. ROLE_CLIENT.
  599. description: roles of the user.
  600. items:
  601. type: string
  602. enum:
  603. - ROLE_ADMIN
  604. - ROLE_INSTITUTION
  605. - ROLE_CLIENT
  606. title: UsersRequestDTO
  607. UsersResponseDTO:
  608. type: object
  609. required:
  610. - active
  611. - city
  612. - id
  613. - nickname
  614. - state
  615. - termsofusage
  616. - username
  617. properties:
  618. id:
  619. type: integer
  620. format: int32
  621. example: This is a SERIAL and Primary Key field.
  622. description: id of the user.
  623. username:
  624. type: string
  625. 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).
  626. description: username of the user.
  627. nickname:
  628. type: string
  629. example: i.e. beth2021. This is an unique field, and consumers should be aware of it.
  630. description: nickname of the user.
  631. dateofborn:
  632. type: string
  633. format: date
  634. example: i.e. 01/12/1978. Format should be dd/MM/yyyy.
  635. description: Date of Born of the user.
  636. gender:
  637. type: string
  638. example: i.e. M. 'M' stands for Male, 'F' Female, 'N' Not Informed
  639. description: Gender of the user.
  640. enum:
  641. - '{@code M'
  642. - F
  643. - N}
  644. state:
  645. type: string
  646. example: i.e. SP. State should be 2 characteres (UF)
  647. description: state of the user.
  648. city:
  649. type: string
  650. example: i.e. 'Governador Valadares'.
  651. description: city of the user.
  652. institutiontype:
  653. type: string
  654. example: i.e. 'E'. E stands for 'School', D 'Civil Defense', N 'No governamental', O 'others'
  655. description: institution type of the user.
  656. enum:
  657. - '{@code E'
  658. - D
  659. - 'N'
  660. - O}
  661. institution:
  662. type: string
  663. example: i.e. 'Colegio Imaginario'.
  664. description: institution of the user.
  665. securityquestion:
  666. type: string
  667. example: i.e. 'What is my favorite color?'.
  668. description: security question of the user.
  669. securityanswer:
  670. type: string
  671. example: i.e. 'Blue'.
  672. description: security answer of the user.
  673. termsofusage:
  674. type: boolean
  675. example: false
  676. description: terms of usage of the user.
  677. active:
  678. type: integer
  679. format: int32
  680. example: i.e. true.
  681. description: whether user is active or not.
  682. role:
  683. type: string
  684. example: i.e. 'ROLE_ADMIN' means system administrator, 'ROLE_INSTITUTION' means institution administrator, 'ROLE_CLIENT' means regular users
  685. description: institution type of the user.
  686. enum:
  687. - '{@code ROLE_ADMIN'
  688. - ROLE_INSTITUTION
  689. - ROLE_CLIENT}
  690. eduCemadenOrganization:
  691. description: which Educational Cemaden Organization the user belongs.
  692. $ref: '#/definitions/EduCemadenOrganizations'
  693. providerActivationKey:
  694. description: If this user can provide an activation key for other users ('ROLE_INSTITUTION'), this field will store the values.
  695. $ref: '#/definitions/UsersProviderActivationKey'
  696. title: UsersResponseDTO