searchusermenu
  • 发布文章
  • 消息中心
点赞
收藏
评论
分享
原创

天翼云单点登录对接流程

2023-05-30 07:44:07
44
0

1.天翼云官网单点登录

1.1天翼云官网单点登录流程

1.将翼MR服务域名注册到CAS服务

2.进入品宣页(https://ip:port/init),点击控制台发送请求,从后端拿到跳转登录地址

--request

http://ip:port/sso/url?service=https://ip:port/centerController

注:请求参数service是登录成功跳转地址

--response

{

    "success":boolean, // 请求是否成功

    "code": int, // 状态码,200请求成功400参数错误401未认证403未授权

    "message": str(100), //前端展示的提示信息

    "data": https://ip:port/login?service=https://ip:port/centerController&appId=xxx&timestamp=xxx&signature=xxx

}

注:

https://ip:port/login  //cas服务器登录地址

service  //登录成功跳转地址

appId  //调用方获取到的keyId

timestamp // 本次调用的时间戳,本参数将会被服务端用来控制调用请求的生命周期

signature  // 调用方获对本次调用信息的签名

3前端跳转到2步骤后端生成的地址进行登录,登录成功,cas服务回调service地址并带上ticket

回调地址如下:

https://ip:port/centerController?ticket=xxx

4加载https://ip:port/centerController前端页面时,前端向后端发送验签请求,请求地址如下:

http://ip:port/emr/login?ticket=xxx&serviceUrl="https://ip:port/centerController"

后端收到验签请求,拼接如下地址访问cas服务进行验签:

--request

https://ip:port/validate?ticket=xxx&signature=xxx&service=https%3A%2F%2Fip:port%2FcontrolCenter&appId=xxx&timestamp=xxx

注:

https://ip:port/validate //cas服务验签地址

service  //登录成功跳转地址,需进行encoding编码

appId  //调用方获取到的keyId

timestamp // 本次调用的时间戳,本参数将会被服务端用来控制调用请求的生命周期

signature  // 调用方获对本次调用信息的签名 ,生成方式见步骤2

--response

 本服务输出符合CAS协议规范的XML文档 , 文档输出下列定制信息 :

代码

位置

类型

说明

userId

cas:user

string

用户在天翼云的用户id,兼容1.0协议

domainId

cas:attributes

string

用户在bss系统中的帐号id,兼容1.0协议

userId

cas:attributes

string

用户在bss系统中的用户id,兼容1.0协议, 注意和cas:user中的用户id区分

loginTime

cas:attributes

string

登录时间

loginIp

cas:attributes

string

登录的ip

name

cas:attributes

string

用户姓名

avatar

cas:attributes

string

用户头像

avatarPath

cas:attributes

string

用户头像路径

ctyunAcctId

cas:attributes

string

取值同domainId

ctyunUserId

cas:attributes

string

取值同userId

state

cas:attributes

string

用户的帐号状态(active:活跃的,frozen:冻结 的,pending:待审核的,deleted:被删除)

mobile

cas:attributes

string

手机号码

email

cas:attributes

string

邮箱地址

userType

cas:attributes

string

用户类型(user:普通用户;staff:内部员 工;enterprise:企业)

realname

cas:attributes

string

实名认证状态(authzed:已认证;noauth:未认 证;submitted:已提交;rejected:不通 过;human:人工审核)

vipFlag

cas:attributes

string

用户的vip等级

channel

cas:attributes

string

用户的渠道,同bss的渠道编码(1:CRM,2:云公 司,3:集团,4:省集成,5:物联网)

provice

cas:attributes

string

用户所在省公司,当渠道为CRM时才准确

provice

cas:attributes

string

用户所在市公司,当渠道为crm时才准确

delegate

cas:attributes

string

1表示被代理登陆(用户通过委托登录的方 式登陆,本字段才会存在)

delegateCtyunUserId

cas:attributes

string

代理人的bss的userId (用户通过委托登录 的方式登陆,本字段才会存在)

delegateCtyunAcctId

cas:attributes

string

代理人的bss的accountId (用户通过委托登 录的方式登陆,本字段才会存在)

delegateEmail

cas:attributes

string

代理人的bss的email (用户通过委托登录的 方式登陆,本字段才会存在)

delegatePhone

cas:attributes

string

代理人的bss的电话 (用户通过委托登录的 方式登陆,本字段才会存在)

delegateName

cas:attributes

string

代理人的bss的电话名称 (用户通过委托登 录的方式登陆,本字段才会存在)

后端解析xml文档信息,将platformUserId、realName、ctyunAcctId、mobilePhone、email存入user数据库,并向前端返回如下信息:

--response hearder{

set-Cookie:"JSESSIONID=XXX"

}

--response body

{"code":200,"data":{"platformUserId":xxx,"realName":"xxx"},"message":"请求成功","success":true}

5之后前端通过在访问后端接口时携带cookie:JSESSIONID=XXX,完成认证过程。

1.2天翼云官网单点登出流程

1点击翼MR页面登出按钮,向后端发送登出请求

https://ip:port/emr/logout

2后端接收到登出请求后,会清理本地session,cookie和认证缓存,清理成功后会向cas服务发出登出url

https://ip:port/logout

3cas服务收到登出请求,注销翼MR服务登录状态,并回调翼MR控制台地址,并带上参数 logoutRequest ,回调地址如下:

https://ip:port/centerController?logoutRequest=<logoutRequestXml>

注:https://ip:port前端地址

4前端收到回调请求后,向后端发送cas登出请求

https://ip:port/centerController?logoutRequest=<logoutRequestXml>

注:https://ip:port后端地址

后端接收到请求,解析logoutRequestXml,获取ticket,通过ticket作为key找到cas服务session,清理cas服务的session之后,返回前端http status200,登出流程结束。

0条评论
0 / 1000
张****磊
2文章数
0粉丝数
张****磊
2 文章 | 0 粉丝
张****磊
2文章数
0粉丝数
张****磊
2 文章 | 0 粉丝
原创

天翼云单点登录对接流程

2023-05-30 07:44:07
44
0

1.天翼云官网单点登录

1.1天翼云官网单点登录流程

1.将翼MR服务域名注册到CAS服务

2.进入品宣页(https://ip:port/init),点击控制台发送请求,从后端拿到跳转登录地址

--request

http://ip:port/sso/url?service=https://ip:port/centerController

注:请求参数service是登录成功跳转地址

--response

{

    "success":boolean, // 请求是否成功

    "code": int, // 状态码,200请求成功400参数错误401未认证403未授权

    "message": str(100), //前端展示的提示信息

    "data": https://ip:port/login?service=https://ip:port/centerController&appId=xxx&timestamp=xxx&signature=xxx

}

注:

https://ip:port/login  //cas服务器登录地址

service  //登录成功跳转地址

appId  //调用方获取到的keyId

timestamp // 本次调用的时间戳,本参数将会被服务端用来控制调用请求的生命周期

signature  // 调用方获对本次调用信息的签名

3前端跳转到2步骤后端生成的地址进行登录,登录成功,cas服务回调service地址并带上ticket

回调地址如下:

https://ip:port/centerController?ticket=xxx

4加载https://ip:port/centerController前端页面时,前端向后端发送验签请求,请求地址如下:

http://ip:port/emr/login?ticket=xxx&serviceUrl="https://ip:port/centerController"

后端收到验签请求,拼接如下地址访问cas服务进行验签:

--request

https://ip:port/validate?ticket=xxx&signature=xxx&service=https%3A%2F%2Fip:port%2FcontrolCenter&appId=xxx&timestamp=xxx

注:

https://ip:port/validate //cas服务验签地址

service  //登录成功跳转地址,需进行encoding编码

appId  //调用方获取到的keyId

timestamp // 本次调用的时间戳,本参数将会被服务端用来控制调用请求的生命周期

signature  // 调用方获对本次调用信息的签名 ,生成方式见步骤2

--response

 本服务输出符合CAS协议规范的XML文档 , 文档输出下列定制信息 :

代码

位置

类型

说明

userId

cas:user

string

用户在天翼云的用户id,兼容1.0协议

domainId

cas:attributes

string

用户在bss系统中的帐号id,兼容1.0协议

userId

cas:attributes

string

用户在bss系统中的用户id,兼容1.0协议, 注意和cas:user中的用户id区分

loginTime

cas:attributes

string

登录时间

loginIp

cas:attributes

string

登录的ip

name

cas:attributes

string

用户姓名

avatar

cas:attributes

string

用户头像

avatarPath

cas:attributes

string

用户头像路径

ctyunAcctId

cas:attributes

string

取值同domainId

ctyunUserId

cas:attributes

string

取值同userId

state

cas:attributes

string

用户的帐号状态(active:活跃的,frozen:冻结 的,pending:待审核的,deleted:被删除)

mobile

cas:attributes

string

手机号码

email

cas:attributes

string

邮箱地址

userType

cas:attributes

string

用户类型(user:普通用户;staff:内部员 工;enterprise:企业)

realname

cas:attributes

string

实名认证状态(authzed:已认证;noauth:未认 证;submitted:已提交;rejected:不通 过;human:人工审核)

vipFlag

cas:attributes

string

用户的vip等级

channel

cas:attributes

string

用户的渠道,同bss的渠道编码(1:CRM,2:云公 司,3:集团,4:省集成,5:物联网)

provice

cas:attributes

string

用户所在省公司,当渠道为CRM时才准确

provice

cas:attributes

string

用户所在市公司,当渠道为crm时才准确

delegate

cas:attributes

string

1表示被代理登陆(用户通过委托登录的方 式登陆,本字段才会存在)

delegateCtyunUserId

cas:attributes

string

代理人的bss的userId (用户通过委托登录 的方式登陆,本字段才会存在)

delegateCtyunAcctId

cas:attributes

string

代理人的bss的accountId (用户通过委托登 录的方式登陆,本字段才会存在)

delegateEmail

cas:attributes

string

代理人的bss的email (用户通过委托登录的 方式登陆,本字段才会存在)

delegatePhone

cas:attributes

string

代理人的bss的电话 (用户通过委托登录的 方式登陆,本字段才会存在)

delegateName

cas:attributes

string

代理人的bss的电话名称 (用户通过委托登 录的方式登陆,本字段才会存在)

后端解析xml文档信息,将platformUserId、realName、ctyunAcctId、mobilePhone、email存入user数据库,并向前端返回如下信息:

--response hearder{

set-Cookie:"JSESSIONID=XXX"

}

--response body

{"code":200,"data":{"platformUserId":xxx,"realName":"xxx"},"message":"请求成功","success":true}

5之后前端通过在访问后端接口时携带cookie:JSESSIONID=XXX,完成认证过程。

1.2天翼云官网单点登出流程

1点击翼MR页面登出按钮,向后端发送登出请求

https://ip:port/emr/logout

2后端接收到登出请求后,会清理本地session,cookie和认证缓存,清理成功后会向cas服务发出登出url

https://ip:port/logout

3cas服务收到登出请求,注销翼MR服务登录状态,并回调翼MR控制台地址,并带上参数 logoutRequest ,回调地址如下:

https://ip:port/centerController?logoutRequest=<logoutRequestXml>

注:https://ip:port前端地址

4前端收到回调请求后,向后端发送cas登出请求

https://ip:port/centerController?logoutRequest=<logoutRequestXml>

注:https://ip:port后端地址

后端接收到请求,解析logoutRequestXml,获取ticket,通过ticket作为key找到cas服务session,清理cas服务的session之后,返回前端http status200,登出流程结束。

文章来自个人专栏
zhanglei11个人专栏
2 文章 | 1 订阅
0条评论
0 / 1000
请输入你的评论
0
0