Skip to content

用户相关

登录,退出,用户基本信息

POST 登录

POST /admin/oauth2/token

Body 请求参数

yaml
password: JFat0ZdcKSg=

请求参数

名称位置类型必选说明
usernamequerystring用户名
randomStrquerystring验证码类型,一般和code一起用
codequerystring验证码信息
grant_typequerystring登录模式(固定值,固定值为password)
scopequerystring域(固定值,固定值为server)
AuthorizationheaderstringBasic base64(客户端ID:密钥)
Skiptokenheaderstring固定值,固定值为true
Tenant-Idheaderstring租户id (固定值,固定值为1)
bodybodyobjectnone
» passwordbodystring密码(加密),参考示例代码

返回示例

json
{
  "sub": "admin",
  "active": true,
  "token_type": "Bearer",
  "client_id": "pig",
  "access_token": "46d87457-56a7-41d4-ae69-bcae57618f10",
  "aud": [
    "pig"
  ],
  "nbf": 1736485678.4320405,
  "user_id": 1,
  "scope": [
    "server"
  ],
  "exp": 1736528878.4320405,
  "expires_in": 43200,
  "iat": 1736485678.4320405,
  "jti": "d5581c3f-ff8b-47b6-9492-69db942c697f",
  "username": "admin"
}
json
{
  "code": 1,
  "msg": "用户名不存在或者密码错误",
  "data": null,
  "ok": false
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» substringtruenonenone
» issstringtruenonenone
» activebooleantruenonenone
» token_typestringtruenonenone
» client_idstringtruenonenone
» access_tokenstringtruenonenone
» aud[string]truenonenone
» licensestringtruenonenone
» nbfnumbertruenonenone
» user_idintegertruenonenone
» scope[string]truenonenone
» expnumbertruenonenone
» expires_inintegertruenonenone
» iatnumbertruenonenone
» jtistringtruenonenone
» usernamestringtruenonenone

GET 用户信息

GET /admin/user/info

根据凭证获取用户基础信息,包含权限项

请求参数

名称位置类型必选说明
Authorizationheaderstringnone

返回示例

json
{
  "code": 0,
  "msg": null,
  "data": {
    "sysUser": {
      "userId": "1729371890642731010",
      "username": "putong",
      "password": "$2a$10$XoB4WWUzEWZfj2S/6JsLIOQbVmOZgG63LG8q7QrWTmUt9HASQIX..",
      "createBy": "admin",
      "updateBy": "admin",
      "createTime": "2023-11-28 13:29:24",
      "updateTime": "2023-12-29 14:33:18",
      "delFlag": "0",
      "lockFlag": "0",
      "phone": "18555545555",
      "avatar": null,
      "deptId": "7",
      "tenantId": "1",
      "wxOpenid": null,
      "miniOpenid": null,
      "qqOpenid": null,
      "giteeLogin": null,
      "oscId": null,
      "nickname": "张书军昵称",
      "name": "张书军",
      "email": "1451031899@qq.com",
      "gender": "1",
      "age": 29,
      "address": "道元路19号",
      "describe": "没有描述",
      "weChat": "sadsd",
      "qq": "1451031899",
      "lastLoginTime": null
    },
    "permissions": [
      "sys_role_export",
      "sys_dept_del",
      "job_sys_job_add",
      "job_sys_job_export",
      "sys_user_edit",
      "sys_file_del",
      "sys_menu_del",
      "sys_social_details_del",
      "sys_connect_sync",
      "sys_role_edit",
      "codegen_template_edit",
      "sys_token_del",
      "sys_dept_add",
      "sys_role_del",
      "sys_syspublicparam_del",
      "job_sys_job_refresh_job",
      "sys_dict_del",
      "sys_syspublicparam_edit",
      "sys_syspublicparam_add",
      "sys_user_del",
      "sys_menu_add",
      "codegen_template_add",
      "sys_client_add",
      "sys_dept_edit",
      "sys_menu_edit",
      "sys_post_export",
      "codegen_template_export",
      "sys_user_add",
      "sys_user_export",
      "job_sys_job_del",
      "sys_log_del",
      "codegen_template_del",
      "sys_client_del",
      "sys_client_edit",
      "codegen_group_export",
      "job_sys_job_run_job",
      "sys_post_view",
      "job_sys_job_start_job",
      "sys_i18n_view",
      "sys_i18n_add",
      "sys_dict_edit",
      "job_sys_job_edit",
      "codegen_group_view",
      "sys_log_export",
      "codegen_group_del",
      "sys_i18n_export",
      "sys_post_add",
      "sys_social_details_edit",
      "job_sys_job_shutdown_job",
      "sys_dict_add",
      "codegen_template_view",
      "sys_i18n_del",
      "sys_role_add",
      "sys_audit_del",
      "sys_i18n_edit",
      "codegen_group_edit",
      "sys_post_del",
      "sys_role_perm",
      "sys_social_details_add",
      "sys_post_edit",
      "sys_audit_export",
      "codegen_group_add"
    ],
    "roles": [
      "1",
      "1739104675954700289"
    ]
  },
  "ok": true
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» codeintegertruenonenone
» msgnulltruenonenone
» dataobjecttruenonenone
»» sysUserobjecttruenone用户基础信息
»»» userIdstringtruenonenone
»»» usernamestringtruenonenone
»»» passwordstringtruenonenone
»»» createBystringtruenonenone
»»» updateBystringtruenonenone
»»» createTimestringtruenonenone
»»» updateTimestringtruenonenone
»»» delFlagstringtruenonenone
»»» lockFlagstringtruenonenone
»»» phonestringtruenonenone
»»» avatarnulltruenonenone
»»» deptIdstringtruenonenone
»»» tenantIdstringtruenonenone
»»» wxOpenidnulltruenonenone
»»» miniOpenidnulltruenonenone
»»» qqOpenidnulltruenonenone
»»» giteeLoginnulltruenonenone
»»» oscIdnulltruenonenone
»»» nicknamestringtruenonenone
»»» namestringtruenonenone
»»» emailstringtruenonenone
»»» genderstringtruenonenone
»»» ageintegertruenonenone
»»» addressstringtruenonenone
»»» describestringtruenonenone
»»» weChatstringtruenonenone
»»» qqstringtruenonenone
»»» lastLoginTimenulltruenonenone
»» permissions[string]truenone权限值
»» roles[string]truenone角色信息
» okbooleantruenonenone

GET 查询用户登录失败次数

GET /admin/user/getLockNumByUserName

根据用户名查询用户登录失败次数,主要用于登录前校验是否达到最大登录失败次数

请求参数

名称位置类型必选说明
userNamequerystring登录账号

返回示例

json
{
  "code": 0,
  "msg": null,
  "data": "0",
  "ok": true
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» codeintegertruenonenone
» msgnulltruenonenone
» datastringtruenone登录失败次数
» okbooleantruenonenone

DELETE 退出

DELETE /admin/token/logout

请求参数

名称位置类型必选说明
Authorizationheaderstringnone

返回示例

json
{
  "code": 0,
  "msg": null,
  "data": null,
  "ok": true
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» codeintegertruenonenone
» msgnulltruenonenone
» datanulltruenonenone
» okbooleantruenonenone

Released under the MIT License.