auth.yaml 11 KB

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