Log In¶
登录 EnOS。
请求格式¶
POST https://{apigw-address}/enos-iam-service/v2.0/login
请求参数(Body)¶
名称  | 
必需/可选  | 
数据类型  | 
描述  | 
|---|---|---|---|
authType  | 
必需  | 
Integer  | 
认证类型,0:EnOS,1:LDAP。  | 
linkName  | 
可选  | 
String  | 
LDAP 域名,使用 LDAP 认证类型时必需。  | 
principal  | 
必需  | 
String  | 
账户。  | 
credentials  | 
必需  | 
String  | 
密码。  | 
keyId  | 
可选  | 
String  | 
加密公钥 ID。  | 
captcha  | 
可选  | 
String  | 
图形验证码,目前为预留字段。  | 
clientIp  | 
可选  | 
String  | 
客户端IP地址。  | 
expireInterval  | 
可选  | 
Integer  | 
会话过期时间,单位为秒。值的范围是 [900, 864000],值 <900 时,默认为 900,值 >864000 时,默认为 864000。  | 
响应参数¶
名称  | 
数据类型  | 
描述  | 
|---|---|---|
captcha  | 
String  | 
图形验证码。  | 
session  | 
Session 结构体  | 
会话信息。参见 Session 结构体>>  | 
Session 结构体  ¶
名称  | 
数据类型  | 
描述  | 
|---|---|---|
id  | 
String  | 
会话ID。  | 
expires  | 
Integer  | 
会话过期时间。  | 
user  | 
User 结构体  | 
用户详细信息。参见 User 结构体>>  | 
residentOrganization  | 
List<JSONObject>  | 
用户创建时所属组织。  | 
workingOrganization  | 
List<JSONObject>  | 
当前组织信息。  | 
refreshTime  | 
Long  | 
刷新时间。  | 
createTime  | 
Long  | 
创建时间。  | 
status  | 
Int  | 
会话状态。0:初始化(仅对接口进行有限访问),1:正常。  | 
ssoLogin  | 
Boolean  | 
是否 SSO 登录会话。  | 
User 结构体  ¶
名称  | 
数据类型  | 
描述  | 
|---|---|---|
id  | 
String  | 
用户ID。  | 
organizationId  | 
String  | 
用户所属的组织ID。  | 
authType  | 
Integer  | 
认证类型,0:EnOS,1:LDAP。  | 
name  | 
String  | 
用户名。  | 
domain  | 
String  | 
域。  | 
phoneArea  | 
String  | 
电话区域。  | 
phone  | 
String  | 
手机号码。  | 
phoneVerifiedAt  | 
String  | 
手机号码验证时间。  | 
String  | 
用户电子邮件地址。  | 
|
emailVerifiedAt  | 
String  | 
电子邮件验证时间。  | 
description  | 
String  | 
用户描述。  | 
extra  | 
Map  | 
用户其他信息。  | 
resourceId  | 
String  | 
资源ID。  | 
type  | 
Enum  | 
用户类型,0:普通用户,1:组织所有者,2:组织管理员。  | 
state  | 
Enum  | 
账号状态,0:正常,1:禁用。  | 
mfaType  | 
Enum  | 
多因子认证类型,0:无需验证,1:手机验证,2:邮箱验证,3:手机或邮箱验证。  | 
passwordState  | 
Enum  | 
密码状态,0:正常,1:需要强制更新。  | 
passwordExpireTime  | 
Long  | 
密码过期时间。  | 
passwordStrength  | 
Enum  | 
密码强度,0:中等强度,1:强,2:极强。  | 
organization  | 
List<JSONObject>  | 
组织信息。详见 Organization结构体>>  | 
createdAt  | 
String  | 
创建时间。  | 
phoneVerified  | 
Boolean  | 
电话是否验证。  | 
emailVerified  | 
Boolean  | 
邮箱是否验证。  | 
错误码¶
代码  | 
描述  | 
|---|---|
30400  | 
账号或密码错误,LDAP 域名为空、LDAP 属性映射错误或连接失败。  | 
30404  | 
LDAP 连接不存在。  | 
30410  | 
密码已过期。  | 
30429  | 
该 IP 或该账户登陆失败次数过多,请稍后再试。  | 
30511  | 
该用户被禁用,或 LDAP 登陆已关闭。  | 
错误码返回 message(供参考)¶
* 30400: Incorrect user account or password; Username and password cannot be empty; BASE DN ID is required; LDAP mapping is invalid; Mapping of the LDAP attributes is invalid. Contact the administrator for support. Failed to connect to LDAP server.
* 30404: LDAP connection does not exist.
* 30410: You password has expired. Please contact your organization administrator to ret your password.
* 30429: Failed login attempts exceed limit. IP address is locked; Failed login attempts exceed limit. User account is locked.
* 30511: LDAP login is disabled; user.banned.not.allowed.
示例¶
请求示例¶
url: https://{apigw-address}/enos-iam-service/v2.0/login
method: POST
requestBody:
{
  "authType":0,
  "linkName":"",
  "credentials":"xxx",
  "principal":"xxxx",
  "keyId":"yyy",
  "captcha":"xxxx",
  "clientIp":"1.1.1.1",
  "expireInterval":3600
}
返回示例¶
{
  "fail": false,
  "session": {
    "workingOrganization": {
      "domain": "db_portal",
      "name": "portal",
      "id": "o15578227985571"
    },
    "expires": 7200,
    "createTime": 1562849746,
    "residentOrganization": {
      "domain": null,
      "name": "portal",
      "id": "o15578227985571"
    },
    "refreshTime": 1562850052,
    "id": "IAM_S_HbH8y6sP77T5uUDgqLfzGCZkrz9x5Pyr3VMVARBBQRK8YDbAnsU9YWdUQAMkBu7g4fQKUXmPjakeSmqpFVWsANXKdrBJKUxrLxZC9MvCVHqTc5HyqTcnANz3M8HMhnTb",
    "user": {
      "createdByUserId": "u1544xxxxxxxxxx",
      "resourceId": "r15578227990212",
      "phoneVerified": false,
      "description": "",
      "type": 2,
      "organizationId": "o15578227985571",
      "createdAt": null,
      "emailVerified": true,
      "phoneVerifiedAt": null,
      "phone": "",
      "createTime": "2019-05-14 08:33:19.0",
      "emailVerifiedAt": null,
      "mfaType": null,
      "extra": null,
      "organization": null,
      "name": "portal",
      "phoneArea": "",
      "id": "u1557xxxxxxxxxx",
      "state": 0,
      "authType": 0,
      "email": "user@mail.com"
    }
  },
  "captcha":"",
  "success": true,
  "requestId": null,
  "failed": false,
  "message": "",
  "status": 0,
  "successful": true
}