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.

656 lines
18 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.2
  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/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/signup:
  348. post:
  349. tags:
  350. - users
  351. summary: ${UserController.signup}
  352. 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.
  353. operationId: signupUsingPOST
  354. consumes:
  355. - application/json
  356. produces:
  357. - '*/*'
  358. parameters:
  359. - in: body
  360. name: user
  361. description: Signup User
  362. required: true
  363. schema:
  364. $ref: '#/definitions/UsersRequestDTO'
  365. responses:
  366. '200':
  367. description: OK
  368. schema:
  369. type: string
  370. '400':
  371. description: Something went wrong
  372. '422':
  373. description: Required parameters should be provided
  374. security:
  375. - Authorization:
  376. - global
  377. deprecated: false
  378. /users/{username}:
  379. get:
  380. tags:
  381. - users
  382. summary: ${UserController.search}
  383. description: This is the user search method by username.
  384. operationId: searchUsingGET
  385. produces:
  386. - '*/*'
  387. parameters:
  388. - name: username
  389. in: query
  390. description: username of the user
  391. required: true
  392. type: string
  393. allowEmptyValue: false
  394. 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).
  395. responses:
  396. '200':
  397. description: OK
  398. schema:
  399. $ref: '#/definitions/UsersResponseDTO'
  400. '403':
  401. description: Access denied
  402. '404':
  403. description: The user doesn't exist
  404. '500':
  405. description: Expired or invalid JWT token
  406. security:
  407. - Authorization:
  408. - global
  409. - apiKey: []
  410. deprecated: false
  411. securityDefinitions:
  412. Authorization:
  413. type: apiKey
  414. name: Authorization
  415. in: header
  416. definitions:
  417. EduCemadenOrganizations:
  418. type: object
  419. properties:
  420. activationkey:
  421. type: string
  422. format: uuid
  423. active:
  424. type: string
  425. address:
  426. type: string
  427. creation_date:
  428. type: string
  429. id:
  430. type: integer
  431. format: int32
  432. inep_code:
  433. type: string
  434. login:
  435. type: string
  436. name:
  437. type: string
  438. phone:
  439. type: string
  440. responsible:
  441. type: string
  442. type:
  443. type: string
  444. website:
  445. type: string
  446. title: EduCemadenOrganizations
  447. ForgotPasswordsQuestionsResponseDTO:
  448. type: object
  449. properties:
  450. id:
  451. type: integer
  452. format: int32
  453. question:
  454. type: string
  455. active:
  456. type: integer
  457. format: int32
  458. title: ForgotPasswordsQuestionsResponseDTO
  459. ForgotPasswordsQuestionsUsersAnswersRequestDTO:
  460. type: object
  461. properties:
  462. id:
  463. type: integer
  464. format: int32
  465. forgotpasswordquestionsid:
  466. type: integer
  467. format: int32
  468. usersid:
  469. type: integer
  470. format: int32
  471. answer:
  472. type: string
  473. title: ForgotPasswordsQuestionsUsersAnswersRequestDTO
  474. UsersProviderActivationKey:
  475. type: object
  476. properties:
  477. activationkey:
  478. type: string
  479. format: uuid
  480. id:
  481. type: integer
  482. format: int32
  483. usersid:
  484. type: integer
  485. format: int32
  486. title: UsersProviderActivationKey
  487. UsersRequestDTO:
  488. type: object
  489. required:
  490. - city
  491. - nickname
  492. - password
  493. - roles
  494. - state
  495. - termsofusage
  496. - username
  497. properties:
  498. username:
  499. type: string
  500. 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).
  501. description: username of the user.
  502. nickname:
  503. type: string
  504. example: i.e. beth2021. This is an unique field, and consumers should be aware of it.
  505. description: nickname of the user.
  506. password:
  507. type: string
  508. example: i.e. P@s5w0rD.
  509. description: password of the user.
  510. dateofborn:
  511. type: string
  512. format: date
  513. example: i.e. 01/12/1978. Format should be dd/MM/yyyy.
  514. description: Date of Born of the user.
  515. gender:
  516. type: string
  517. example: i.e. M. 'M' stands for Male, 'F' Female, 'N' Not Informed
  518. description: Gender of the user.
  519. enum:
  520. - '{@code M'
  521. - F
  522. - N}
  523. state:
  524. type: string
  525. example: i.e. SP. State should be 2 characteres (UF)
  526. description: state of the user.
  527. city:
  528. type: string
  529. example: i.e. 'Governador Valadares'.
  530. description: city of the user.
  531. institutiontype:
  532. type: string
  533. example: i.e. 'E'. E stands for 'School', D 'Civil Defense', N 'No governamental', O 'others'
  534. description: institution type of the user.
  535. enum:
  536. - '{@code E'
  537. - D
  538. - 'N'
  539. - O}
  540. institution:
  541. type: string
  542. example: i.e. 'Colegio Imaginario'.
  543. description: institution of the user.
  544. securityquestion:
  545. type: string
  546. example: i.e. 'What is my favorite color?'.
  547. description: security question of the user.
  548. securityanswer:
  549. type: string
  550. example: i.e. 'Blue'.
  551. description: security answer of the user.
  552. termsofusage:
  553. type: boolean
  554. example: false
  555. description: terms of usage of the user.
  556. roles:
  557. type: array
  558. example: i.e. ROLE_CLIENT.
  559. description: roles of the user.
  560. items:
  561. type: string
  562. enum:
  563. - ROLE_ADMIN
  564. - ROLE_INSTITUTION
  565. - ROLE_CLIENT
  566. title: UsersRequestDTO
  567. UsersResponseDTO:
  568. type: object
  569. required:
  570. - active
  571. - city
  572. - id
  573. - nickname
  574. - state
  575. - termsofusage
  576. - username
  577. properties:
  578. id:
  579. type: integer
  580. format: int32
  581. example: This is a SERIAL and Primary Key field.
  582. description: id of the user.
  583. username:
  584. type: string
  585. 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).
  586. description: username of the user.
  587. nickname:
  588. type: string
  589. example: i.e. beth2021. This is an unique field, and consumers should be aware of it.
  590. description: nickname of the user.
  591. dateofborn:
  592. type: string
  593. format: date
  594. example: i.e. 01/12/1978. Format should be dd/MM/yyyy.
  595. description: Date of Born of the user.
  596. gender:
  597. type: string
  598. example: i.e. M. 'M' stands for Male, 'F' Female, 'N' Not Informed
  599. description: Gender of the user.
  600. enum:
  601. - '{@code M'
  602. - F
  603. - N}
  604. state:
  605. type: string
  606. example: i.e. SP. State should be 2 characteres (UF)
  607. description: state of the user.
  608. city:
  609. type: string
  610. example: i.e. 'Governador Valadares'.
  611. description: city of the user.
  612. institutiontype:
  613. type: string
  614. example: i.e. 'E'. E stands for 'School', D 'Civil Defense', N 'No governamental', O 'others'
  615. description: institution type of the user.
  616. enum:
  617. - '{@code E'
  618. - D
  619. - 'N'
  620. - O}
  621. institution:
  622. type: string
  623. example: i.e. 'Colegio Imaginario'.
  624. description: institution of the user.
  625. securityquestion:
  626. type: string
  627. example: i.e. 'What is my favorite color?'.
  628. description: security question of the user.
  629. securityanswer:
  630. type: string
  631. example: i.e. 'Blue'.
  632. description: security answer of the user.
  633. termsofusage:
  634. type: boolean
  635. example: false
  636. description: terms of usage of the user.
  637. active:
  638. type: integer
  639. format: int32
  640. example: i.e. true.
  641. description: whether user is active or not.
  642. role:
  643. type: string
  644. example: i.e. 'ROLE_ADMIN' means system administrator, 'ROLE_INSTITUTION' means institution administrator, 'ROLE_CLIENT' means regular users
  645. description: institution type of the user.
  646. enum:
  647. - '{@code ROLE_ADMIN'
  648. - ROLE_INSTITUTION
  649. - ROLE_CLIENT}
  650. eduCemadenOrganization:
  651. description: which Educational Cemaden Organization the user belongs.
  652. $ref: '#/definitions/EduCemadenOrganizations'
  653. providerActivationKey:
  654. description: If this user can provide an activation key for other users ('ROLE_INSTITUTION'), this field will store the values.
  655. $ref: '#/definitions/UsersProviderActivationKey'
  656. title: UsersResponseDTO