Advertisement
Guest User

Untitled

a guest
Feb 7th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.20 KB | None | 0 0
  1. swagger: "2.0"
  2. info:
  3. description: "IAM service"
  4. version: "0.0.1"
  5. title: "iam"
  6. host: "iam-service"
  7. schemes:
  8. - "http"
  9. consumes:
  10. - "application/json"
  11. produces:
  12. - "application/json"
  13. securityDefinitions:
  14. Bearer:
  15. type: "apiKey"
  16. name: "Authorization"
  17. in: "header"
  18. paths:
  19. /jwks:
  20. get:
  21. tags:
  22. - "iam"
  23. summary: "Get the json web key set"
  24. description: "Returns a list of public key's to validate jwt"
  25. operationId: "getJwks"
  26. responses:
  27. 200:
  28. description: "List of JWK's"
  29. schema:
  30. type: "object"
  31. properties:
  32. keys:
  33. type: "array"
  34. items:
  35. $ref: "#/definitions/Jwk"
  36. /tenants:
  37. get:
  38. tags:
  39. - "tenants"
  40. security:
  41. - Bearer: []
  42. summary: "Get a list of tenants"
  43. description: "Returns a list of tenants"
  44. operationId: "listTenants"
  45. responses:
  46. 200:
  47. description: "List of tenants"
  48. schema:
  49. type: "object"
  50. properties:
  51. data:
  52. type: "array"
  53. items:
  54. $ref: "#/definitions/Tenant"
  55. 401:
  56. description: "Unauthorized"
  57. schema:
  58. $ref: "#/definitions/Error"
  59. 404:
  60. description: "Not found"
  61. schema:
  62. $ref: "#/definitions/Error"
  63. post:
  64. tags:
  65. - "tenants"
  66. summary: "Create a new tenant"
  67. description: "Returns a new authorization response"
  68. operationId: "createTenant"
  69. parameters:
  70. - name: "id"
  71. in: "path"
  72. description: "Id that belongs to the oauth client"
  73. required: true
  74. type: "string"
  75. - in: "body"
  76. name: "body"
  77. description: "Signup object"
  78. required: true
  79. schema:
  80. $ref: "#/definitions/Signup"
  81. responses:
  82. 200:
  83. description: "Tenant and user information"
  84. schema:
  85. type: "object"
  86. properties:
  87. data:
  88. type: "object"
  89. properties:
  90. tenant:
  91. $ref: "#/definitions/Tenant"
  92. user:
  93. $ref: "#/definitions/User"
  94. 401:
  95. description: "Unauthorized"
  96. schema:
  97. $ref: "#/definitions/Error"
  98. 404:
  99. description: "Not found"
  100. schema:
  101. $ref: "#/definitions/Error"
  102. /tenants/me:
  103. get:
  104. tags:
  105. - "tenants"
  106. security:
  107. - Bearer: []
  108. summary: "Get a info about the current tenant"
  109. description: "Returns a list of tenants"
  110. operationId: "getTenant"
  111. responses:
  112. 200:
  113. description: "Tenants model"
  114. schema:
  115. type: "object"
  116. properties:
  117. data:
  118. $ref: "#/definitions/Tenant"
  119. 401:
  120. description: "Unauthorized"
  121. schema:
  122. $ref: "#/definitions/Error"
  123. 404:
  124. description: "Not found"
  125. schema:
  126. $ref: "#/definitions/Error"
  127. /users:
  128. get:
  129. tags:
  130. - "users"
  131. security:
  132. - Bearer: []
  133. summary: "Get a list of users"
  134. description: "Returns a list of users"
  135. operationId: "listUsers"
  136. responses:
  137. 200:
  138. description: "List of users"
  139. schema:
  140. type: "object"
  141. properties:
  142. data:
  143. type: "array"
  144. items:
  145. $ref: "#/definitions/User"
  146. 401:
  147. description: "Unauthorized"
  148. schema:
  149. $ref: "#/definitions/Error"
  150. 404:
  151. description: "Not found"
  152. schema:
  153. $ref: "#/definitions/Error"
  154. post:
  155. tags:
  156. - "users"
  157. security:
  158. - Bearer: []
  159. summary: "Create a new user"
  160. description: "Returns a new authorization response"
  161. operationId: "createUser"
  162. parameters:
  163. - in: "body"
  164. name: "body"
  165. description: "User object"
  166. required: true
  167. schema:
  168. $ref: "#/definitions/UserModel"
  169. responses:
  170. 200:
  171. description: "Created user"
  172. schema:
  173. type: "object"
  174. properties:
  175. data:
  176. $ref: "#/definitions/User"
  177. 401:
  178. description: "Unauthorized"
  179. schema:
  180. $ref: "#/definitions/Error"
  181. 404:
  182. description: "Not found"
  183. schema:
  184. $ref: "#/definitions/Error"
  185. /users/{id}:
  186. get:
  187. tags:
  188. - "users"
  189. security:
  190. - Bearer: []
  191. summary: "Get a single user by id"
  192. description: "Returns a single user"
  193. operationId: "getUser"
  194. parameters:
  195. - name: "id"
  196. in: "path"
  197. description: "Id that belongs to the user"
  198. required: true
  199. type: "string"
  200. responses:
  201. 200:
  202. description: "The user"
  203. schema:
  204. type: "object"
  205. properties:
  206. data:
  207. $ref: "#/definitions/User"
  208. 401:
  209. description: "Unauthorized"
  210. schema:
  211. $ref: "#/definitions/Error"
  212. 404:
  213. description: "Not found"
  214. schema:
  215. $ref: "#/definitions/Error"
  216. /users/{id}/verify:
  217. put:
  218. tags:
  219. - "users"
  220. security:
  221. - Bearer: []
  222. summary: "Mark user's email as verified"
  223. description: "So the user can login"
  224. operationId: "verifyUser"
  225. parameters:
  226. - name: "id"
  227. in: "path"
  228. description: "Id that belongs to the user"
  229. required: true
  230. type: "string"
  231. responses:
  232. 200:
  233. description: "The user"
  234. schema:
  235. type: "object"
  236. properties:
  237. data:
  238. $ref: "#/definitions/User"
  239. 401:
  240. description: "Unauthorized"
  241. schema:
  242. $ref: "#/definitions/Error"
  243. 404:
  244. description: "Not found"
  245. schema:
  246. $ref: "#/definitions/Error"
  247. /oauth/clients:
  248. get:
  249. tags:
  250. - "clients"
  251. security:
  252. - Bearer: []
  253. summary: "Get a list of clients"
  254. description: "Returns a list of clients"
  255. operationId: "listClients"
  256. responses:
  257. 200:
  258. description: "List of clients"
  259. schema:
  260. type: "object"
  261. properties:
  262. data:
  263. type: "array"
  264. items:
  265. $ref: "#/definitions/Client"
  266. 401:
  267. description: "Unauthorized"
  268. schema:
  269. $ref: "#/definitions/Error"
  270. 404:
  271. description: "Not found"
  272. schema:
  273. $ref: "#/definitions/Error"
  274. post:
  275. tags:
  276. - "clients"
  277. security:
  278. - Bearer: []
  279. summary: "Create a new oauth client"
  280. description: "Returns a new authorization response"
  281. operationId: "createClient"
  282. parameters:
  283. - in: "body"
  284. name: "body"
  285. description: "Email object"
  286. required: true
  287. schema:
  288. $ref: "#/definitions/ClientModel"
  289. responses:
  290. 200:
  291. description: "The created client"
  292. schema:
  293. type: "object"
  294. properties:
  295. data:
  296. $ref: "#/definitions/Client"
  297. 401:
  298. description: "Unauthorized"
  299. schema:
  300. $ref: "#/definitions/Error"
  301. 404:
  302. description: "Not found"
  303. schema:
  304. $ref: "#/definitions/Error"
  305. /oauth/clients/{id}:
  306. get:
  307. tags:
  308. - "clients"
  309. security:
  310. - Bearer: []
  311. summary: "Find the oauth client"
  312. description: "Returns the oauth client for the given client id"
  313. operationId: "getClient"
  314. parameters:
  315. - name: "id"
  316. in: "path"
  317. description: "Id that belongs to the oauth client"
  318. required: true
  319. type: "string"
  320. responses:
  321. 200:
  322. description: "The oauth client"
  323. schema:
  324. type: "object"
  325. properties:
  326. data:
  327. $ref: "#/definitions/Client"
  328. 404:
  329. description: "Not found"
  330. schema:
  331. $ref: "#/definitions/Error"
  332. /oauth/clients/apps:
  333. get:
  334. tags:
  335. - "clients"
  336. summary: "Get a list of open / shared / third party"
  337. description: "Returns a list of clients"
  338. operationId: "listOpenClients"
  339. responses:
  340. 200:
  341. description: "List of clients"
  342. schema:
  343. type: "object"
  344. properties:
  345. data:
  346. type: "array"
  347. items:
  348. $ref: "#/definitions/Client"
  349. 401:
  350. description: "Unauthorized"
  351. schema:
  352. $ref: "#/definitions/Error"
  353. 404:
  354. description: "Not found"
  355. schema:
  356. $ref: "#/definitions/Error"
  357. /oauth/scopes:
  358. get:
  359. tags:
  360. - "scopes"
  361. security:
  362. - Bearer: []
  363. summary: "List all available scopes"
  364. description: "Get scopes for all registered services"
  365. operationId: "getScopesList"
  366. responses:
  367. 200:
  368. description: "The requested inbox"
  369. schema:
  370. type: "object"
  371. properties:
  372. data:
  373. type: "array"
  374. items:
  375. $ref: "#/definitions/Scope"
  376. 401:
  377. description: "Unauthorized"
  378. schema:
  379. $ref: "#/definitions/Error"
  380. 404:
  381. description: "Not found"
  382. schema:
  383. $ref: "#/definitions/Error"
  384. /oauth/scopes/{id}:
  385. get:
  386. tags:
  387. - "scopes"
  388. security:
  389. - Bearer: []
  390. summary: "Get a scope and it's description"
  391. description: "Get scope by id"
  392. operationId: "getScope"
  393. parameters:
  394. - name: "id"
  395. in: "path"
  396. description: "Id that belongs to the oauth client"
  397. required: true
  398. type: "string"
  399. responses:
  400. 200:
  401. description: "The list of scopes"
  402. schema:
  403. type: "object"
  404. properties:
  405. data:
  406. $ref: "#/definitions/Scope"
  407.  
  408. 401:
  409. description: "Unauthorized"
  410. schema:
  411. $ref: "#/definitions/Error"
  412. 404:
  413. description: "Not found"
  414. schema:
  415. $ref: "#/definitions/Error"
  416.  
  417. /oauth/authorize:
  418. get:
  419. tags:
  420. - "tokens"
  421. security:
  422. - Bearer: []
  423. summary: "Obtain an authorization response"
  424. description: "Returns a new authorization response"
  425. operationId: "getRedirect"
  426. parameters:
  427. - in: "query"
  428. name: "redirect_uri"
  429. type: "string"
  430. - in: "query"
  431. name: "client_id"
  432. type: "string"
  433. - in: "query"
  434. name: "response_type"
  435. type: "string"
  436. - in: "query"
  437. name: "scope"
  438. type: "string"
  439. - in: "header"
  440. name: "Authorization"
  441. description: "Bearer token for user"
  442. type: "string"
  443. required: true
  444. responses:
  445. 200:
  446. description: "List of emails"
  447. schema:
  448. $ref: "#/definitions/AuthorizationResponse"
  449. 401:
  450. description: "Unauthorized"
  451. schema:
  452. $ref: "#/definitions/Error"
  453. 404:
  454. description: "Not found"
  455. schema:
  456. $ref: "#/definitions/Error"
  457. post:
  458. tags:
  459. - "tokens"
  460. summary: "Obtain a new access token"
  461. description: "Returns a new access token"
  462. operationId: "getAccessToken"
  463. parameters:
  464. - name: "id"
  465. in: "path"
  466. description: "Id that belongs to the oauth client"
  467. required: true
  468. type: "string"
  469. - in: "body"
  470. name: "body"
  471. description: "Email object"
  472. required: true
  473. schema:
  474. $ref: "#/definitions/TokenRequest"
  475. responses:
  476. 200:
  477. description: "List of emails"
  478. schema:
  479. $ref: "#/definitions/AccessToken"
  480. 401:
  481. description: "Unauthorized"
  482. schema:
  483. $ref: "#/definitions/Error"
  484. 404:
  485. description: "Not found"
  486. schema:
  487. $ref: "#/definitions/Error"
  488.  
  489. definitions:
  490. Scope:
  491. type: "object"
  492. required:
  493. - "id"
  494. - "description"
  495. properties:
  496. id:
  497. type: "string"
  498. description:
  499. type: "string"
  500. RefreshToken:
  501. type: "object"
  502. required:
  503. - "token"
  504. properties:
  505. token:
  506. type: "string"
  507. AccessToken:
  508. type: "object"
  509. required:
  510. - "token"
  511. - "expires_at"
  512. properties:
  513. token:
  514. type: "string"
  515. expires_at:
  516. type: "string"
  517. format: "date-time"
  518. UserValidator:
  519. type: "object"
  520. required:
  521. - "email"
  522. - "password"
  523. properties:
  524. email:
  525. type: "string"
  526. password:
  527. type: "string"
  528. TokenRequest:
  529. type: "object"
  530. required:
  531. - "client_id"
  532. - "client_secret"
  533. - "grant_type"
  534. - "scope"
  535. properties:
  536. client_id:
  537. type: "string"
  538. client_secret:
  539. type: "string"
  540. grant_type:
  541. type: "string"
  542. scope:
  543. type: "array"
  544. items:
  545. type: "string"
  546. email:
  547. type: "string"
  548. password:
  549. type: "string"
  550. AuthorizeRequest:
  551. type: "object"
  552. required:
  553. - "response_type"
  554. - "client_id"
  555. - "redirect_uri"
  556. - "scope"
  557. properties:
  558. response_type:
  559. type: "string"
  560. client_id:
  561. type: "string"
  562. redirect_uri:
  563. type: "string"
  564. scope:
  565. type: "array"
  566. items:
  567. type: "string"
  568. AuthorizationResponse:
  569. type: "object"
  570. required:
  571. - "redirect_uri"
  572. - "client_name"
  573. - "scope"
  574. properties:
  575. redirect_uri:
  576. type: "string"
  577. client_name:
  578. type: "string"
  579. scope:
  580. type: "array"
  581. items:
  582. $ref: '#/definitions/Scope'
  583. ClientModel:
  584. type: "object"
  585. required:
  586. - "name"
  587. properties:
  588. name:
  589. type: "string"
  590. redirect_uri:
  591. type: "string"
  592. grant_types:
  593. type: "array"
  594. items:
  595. type: "string"
  596. scope:
  597. type: "array"
  598. items:
  599. type: "string"
  600. Client:
  601. type: "object"
  602. required:
  603. - "id"
  604. properties:
  605. id:
  606. type: "string"
  607. secret:
  608. type: "string"
  609. name:
  610. type: "string"
  611. redirect_uri:
  612. type: "string7"
  613. grant_types:
  614. type: "array"
  615. items:
  616. type: "string"
  617. scope:
  618. type: "array"
  619. items:
  620. type: "string"
  621. tenant_id:
  622. type: "string"
  623. UserModel:
  624. type: "object"
  625. required:
  626. - "email"
  627. - "first_name"
  628. - "last_name"
  629. properties:
  630. email:
  631. type: "string"
  632. password:
  633. type: "string"
  634. first_name:
  635. type: "string"
  636. last_name:
  637. type: "string"
  638. User:
  639. type: "object"
  640. required:
  641. - "email"
  642. - "first_name"
  643. - "last_name"
  644. - "is_verified"
  645. - "tenant_id"
  646. properties:
  647. id:
  648. type: "string"
  649. email:
  650. type: "string"
  651. first_name:
  652. type: "string"
  653. last_name:
  654. type: "string"
  655. is_verified:
  656. type: "boolean"
  657. tenant_id:
  658. type: "string"
  659. created_at:
  660. type: "string"
  661. format: "date-time"
  662. updated_at:
  663. type: "string"
  664. format: "date-time"
  665. Tenant:
  666. type: "object"
  667. required:
  668. - "company"
  669. properties:
  670. id:
  671. type: "string"
  672. company:
  673. $ref: "#/definitions/Company"
  674. is_active:
  675. type: "boolean"
  676. default: "active"
  677. TenantModel:
  678. type: "object"
  679. required:
  680. - "company"
  681. properties:
  682. company:
  683. $ref: "#/definitions/Company"
  684. Company:
  685. type: "object"
  686. required:
  687. - "name"
  688. - "billing_email"
  689. - "phone_number"
  690. - "address"
  691. properties:
  692. name:
  693. type: "string"
  694. vat_number:
  695. type: "string"
  696. billing_email:
  697. type: "string"
  698. phone_number:
  699. type: "string"
  700. address:
  701. $ref: "#/definitions/Address"
  702. Address:
  703. required:
  704. - "address_line_1"
  705. - "postal_code"
  706. - "city"
  707. - "country_code"
  708. type: "object"
  709. properties:
  710. address_line_1:
  711. type: "string"
  712. address_line_2:
  713. type: "string"
  714. postal_code:
  715. type: "string"
  716. city:
  717. type: "string"
  718. country_code:
  719. type: "string"
  720. Signup:
  721. type: "object"
  722. required:
  723. - "company"
  724. - "user"
  725. properties:
  726. company:
  727. $ref: '#/definitions/Company'
  728. user:
  729. $ref: '#/definitions/UserModel'
  730. Status:
  731. type: "object"
  732. required:
  733. - "status"
  734. - "changed_at"
  735. properties:
  736. status:
  737. type: "string"
  738. enum:
  739. - "printed"
  740. changed_at:
  741. type: "string"
  742. format: "date-time"
  743. Jwk:
  744. type: "object"
  745. required:
  746. - "alg"
  747. - "kty"
  748. - "use"
  749. - "x5c"
  750. - "n"
  751. - "e"
  752. - "kid"
  753. - "x5t"
  754. properties:
  755. alg:
  756. type: "string"
  757. enum:
  758. - "RS256"
  759. kty:
  760. type: "string"
  761. enum:
  762. - "RSA"
  763. use:
  764. type: "string"
  765. enum:
  766. - "sig"
  767. x5c:
  768. type: "array"
  769. items:
  770. type: "string"
  771. n:
  772. type: "string"
  773. e:
  774. type: "string"
  775. enum:
  776. - "AQAB"
  777. kid:
  778. type: "string"
  779. x5t:
  780. type: "string"
  781.  
  782. Error:
  783. type: "object"
  784. required:
  785. - "code"
  786. - "message"
  787. properties:
  788. code:
  789. type: "integer"
  790. message:
  791. type: "string"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement