auth.yaml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. Captcha:
  2. get:
  3. operationId: fetchCaptcha
  4. summary: 登录图片验证码签发(安全需求4)
  5. description: 环境变量DMS_CAPTCHA_ENABLED(双版同名,缺省true)开启时返回captchaId与data:image/png;base64图片(132×44、4位字符剔除易混淆0O1I、120秒过期、一次性消费);关闭时仅返回enabled=false。登录页据enabled决定是否展示验证码输入;请求与响应均不缓存。
  6. security: []
  7. parameters:
  8. - $ref: '../components/parameters.yaml#/XRequestId'
  9. responses:
  10. '200':
  11. description: 验证码签发结果
  12. content:
  13. application/json:
  14. schema:
  15. type: object
  16. required: [code, message, data, requestId]
  17. properties:
  18. code: {type: string, enum: [OK]}
  19. message: {type: string, enum: [success]}
  20. requestId: {type: string, format: uuid}
  21. data:
  22. type: object
  23. required: [enabled]
  24. additionalProperties: false
  25. properties:
  26. enabled: {type: boolean, description: 验证码开关当前值}
  27. captchaId: {type: string, description: 验证码标识,登录时原样携带;enabled=true时必返}
  28. image: {type: string, description: data:image/png;base64图片,img标签src直接使用;enabled=true时必返}
  29. '500':
  30. $ref: '../components/responses.yaml#/InternalError'
  31. Login:
  32. post:
  33. operationId: login
  34. summary: 用户登录
  35. description: 验证码开启(DMS_CAPTCHA_ENABLED,缺省true)时请求体必须且只能包含五键(追加captchaId/captchaCode),验证码校验先于用户查询与锁定检查、一次性消费不计入登录失败锁定,错误返回400 INVALID_CAPTCHA;关闭时保持三键(username/password/keepSignedIn)。
  36. security: []
  37. parameters:
  38. - $ref: '../components/parameters.yaml#/XRequestId'
  39. requestBody:
  40. required: true
  41. content:
  42. application/json:
  43. schema:
  44. $ref: '../components/schemas.yaml#/LoginRequest'
  45. responses:
  46. '200':
  47. description: 登录成功
  48. content:
  49. application/json:
  50. schema:
  51. $ref: '../components/schemas.yaml#/LoginResponse'
  52. '400':
  53. description: 请求参数错误或验证码缺失/错误/过期(INVALID_CAPTCHA,安全需求4)
  54. content:
  55. application/json:
  56. schema:
  57. $ref: '../components/schemas.yaml#/ErrorResponse'
  58. '401':
  59. $ref: '../components/responses.yaml#/AuthenticationError'
  60. '403':
  61. $ref: '../components/responses.yaml#/Forbidden'
  62. '500':
  63. $ref: '../components/responses.yaml#/InternalError'
  64. Logout:
  65. post:
  66. operationId: logout
  67. summary: 注销并使当前用户旧Token失效
  68. parameters:
  69. - $ref: '../components/parameters.yaml#/XRequestId'
  70. responses:
  71. '200':
  72. description: 注销成功
  73. content:
  74. application/json:
  75. schema:
  76. $ref: '../components/schemas.yaml#/EmptySuccessResponse'
  77. '400':
  78. $ref: '../components/responses.yaml#/InvalidArgument'
  79. '401':
  80. $ref: '../components/responses.yaml#/AuthenticationError'
  81. '403':
  82. $ref: '../components/responses.yaml#/Forbidden'
  83. '500':
  84. $ref: '../components/responses.yaml#/InternalError'
  85. Reauth:
  86. post:
  87. operationId: reauth
  88. summary: 敏感操作二次认证(重输登录密码换取5分钟reauth令牌)
  89. description: 登录态下重输登录密码,签发type=reauth的短时令牌(绑定sub与authVersion,不可冒充访问令牌);不写审计、不计入登录失败锁定。
  90. parameters:
  91. - $ref: '../components/parameters.yaml#/XRequestId'
  92. requestBody:
  93. required: true
  94. content:
  95. application/json:
  96. schema:
  97. type: object
  98. required: [password]
  99. additionalProperties: false
  100. properties:
  101. password: {type: string, format: password, minLength: 1}
  102. responses:
  103. '200':
  104. description: 二次认证成功
  105. content:
  106. application/json:
  107. schema:
  108. type: object
  109. required: [code, message, data, requestId]
  110. properties:
  111. code: {type: string, enum: [OK]}
  112. message: {type: string, enum: [success]}
  113. requestId: {type: string, format: uuid}
  114. data:
  115. type: object
  116. required: [reauthToken, expiresIn]
  117. properties:
  118. reauthToken: {type: string, description: 二次认证令牌,经X-DMS-Reauth-Token请求头携带}
  119. expiresIn: {type: integer, enum: [300], description: 固定300秒(5分钟)}
  120. '400':
  121. $ref: '../components/responses.yaml#/InvalidArgument'
  122. '401':
  123. $ref: '../components/responses.yaml#/AuthenticationError'
  124. '500':
  125. $ref: '../components/responses.yaml#/InternalError'
  126. PortalVerify:
  127. post:
  128. operationId: verifyPortalLaunch
  129. summary: 统一门户跳转验签
  130. description: 透传浏览器地址栏query串验签,按需落库建档并同步组织信息;返回跳转阶段,首次进入需设置独立密码。
  131. security: []
  132. parameters:
  133. - $ref: '../components/parameters.yaml#/XRequestId'
  134. requestBody:
  135. required: true
  136. content:
  137. application/json:
  138. schema:
  139. type: object
  140. required: [query]
  141. additionalProperties: false
  142. properties:
  143. query: {type: string, minLength: 1, description: 门户跳转链接的完整query串}
  144. responses:
  145. '200':
  146. description: 验签结果
  147. content:
  148. application/json:
  149. schema:
  150. type: object
  151. required: [code, message, data, requestId]
  152. properties:
  153. code: {type: string}
  154. message: {type: string}
  155. requestId: {type: string}
  156. data:
  157. type: object
  158. required: [phase, username, realName]
  159. properties:
  160. phase: {type: string, enum: [LOGIN, SET_PASSWORD], description: SET_PASSWORD时携带一次性设密票据portalTicket及机构选择数据}
  161. username: {type: string}
  162. realName: {type: string}
  163. portalTicket: {type: string}
  164. suggestedOrganizationId: {type: string, nullable: true, description: 按对端机构名/默认组织推断的用户当前机构ID(可能为空),前端预选用}
  165. organizations:
  166. type: array
  167. description: 仅SET_PASSWORD阶段返回;本系统机构树与大系统可能不一致(用户按需同步、机构不自动同步),设密时由用户自选所在机构
  168. items:
  169. type: object
  170. required: [id, orgCode, orgName, orgPath]
  171. additionalProperties: false
  172. properties:
  173. id: {type: string}
  174. orgCode: {type: string}
  175. orgName: {type: string}
  176. orgPath: {type: string}
  177. '400':
  178. $ref: '../components/responses.yaml#/InvalidArgument'
  179. '403':
  180. $ref: '../components/responses.yaml#/Forbidden'
  181. '500':
  182. $ref: '../components/responses.yaml#/InternalError'
  183. PortalProxyVerify:
  184. post:
  185. operationId: verifyProxySso
  186. summary: 本地单点登录代理探测(仅Java版提供)
  187. description: 令牌取自本机单点登录代理(REST直连:GET /middle/token/get.json取token,POST /auth/user/getUserBasicInfo以Bearer令牌换用户基本信息),经用户服务校验身份后按需同步建档;响应结构与门户跳转验签完全一致(双阶段LOGIN/SET_PASSWORD)。仅Java版后端提供本接口,Python版返回404、功能未启用返回400,前端探测失败静默回落账号密码登录。
  188. security: []
  189. parameters:
  190. - $ref: '../components/parameters.yaml#/XRequestId'
  191. responses:
  192. '200':
  193. description: 探测结果(结构与PortalVerify一致)
  194. content:
  195. application/json:
  196. schema:
  197. type: object
  198. required: [code, message, data, requestId]
  199. properties:
  200. code: {type: string}
  201. message: {type: string}
  202. requestId: {type: string}
  203. data:
  204. type: object
  205. required: [phase, username, realName]
  206. properties:
  207. phase: {type: string, enum: [LOGIN, SET_PASSWORD], description: SET_PASSWORD时携带一次性设密票据portalTicket及机构选择数据}
  208. username: {type: string}
  209. realName: {type: string}
  210. portalTicket: {type: string}
  211. suggestedOrganizationId: {type: string, nullable: true}
  212. organizations:
  213. type: array
  214. items:
  215. type: object
  216. required: [id, orgCode, orgName, orgPath]
  217. additionalProperties: false
  218. properties:
  219. id: {type: string}
  220. orgCode: {type: string}
  221. orgName: {type: string}
  222. orgPath: {type: string}
  223. '400':
  224. $ref: '../components/responses.yaml#/InvalidArgument'
  225. '401':
  226. $ref: '../components/responses.yaml#/AuthenticationError'
  227. '500':
  228. $ref: '../components/responses.yaml#/InternalError'
  229. PortalSetupPassword:
  230. post:
  231. operationId: setupPortalPassword
  232. summary: 门户用户首次设置独立密码并登录
  233. description: 票据一次性且5分钟内有效;设置成功后签发访问令牌。可选携带organizationId同步设置用户所在机构(须为有效且启用的机构;缺省不改变)。
  234. security: []
  235. parameters:
  236. - $ref: '../components/parameters.yaml#/XRequestId'
  237. requestBody:
  238. required: true
  239. content:
  240. application/json:
  241. schema:
  242. type: object
  243. required: [portalTicket, newPassword, keepSignedIn]
  244. additionalProperties: false
  245. properties:
  246. portalTicket: {type: string, minLength: 1}
  247. newPassword: {type: string, minLength: 1}
  248. keepSignedIn: {type: boolean}
  249. organizationId: {type: string, description: 用户自选的所在机构ID(verify响应organizations中的id);缺省不改变}
  250. responses:
  251. '200':
  252. description: 设密并登录成功
  253. content:
  254. application/json:
  255. schema:
  256. $ref: '../components/schemas.yaml#/LoginResponse'
  257. '400':
  258. $ref: '../components/responses.yaml#/InvalidArgument'
  259. '403':
  260. $ref: '../components/responses.yaml#/Forbidden'
  261. '500':
  262. $ref: '../components/responses.yaml#/InternalError'