- bropen.framework.core.security.sso.CallbackSsoClient
-
通用的回调 sso 集成接口。
符合 sso 规范的外部系统(集成方,如门户)需要在本系统内注册。
注册方法如:在 BootStrap 的 init 方法等处中增加如下代码:
CallbackSso.enable("appid1", "url1")
有几个系统写几行。
回调 sso 集成规范如下:
- 从外部系统(集成方,如门户),如 A,访问本系统 B 时,在请求链接中带上如下参数:
appid: 必须,A 的名称或编码,比如 A;
token: 必须,在 A 系统中定义的、且只有 A 能解码的一个加密字符串(一般有有效期限制,常见的是5分钟);
username: 可选,当前用户,用于最后一步的校验。
例如:http://bropen.host:port/context/foo/bar?appid=portal&username=zhangsan&token=......
- 本系统 B 捕获到上述形式的URL后,将 token 拼到一个双方约定好的 A 的URL中,并进行回调;
URL为 http://thirdapp.host:port/context/sso?token= 或 http://thirdapp.host:port/context/sso
则回调URL为:....?token=....
如果 A 是 JavaEE 的,并且支持 url 重写方式传递 jsessionid,则可以用 jsessionid 作为 token:
即 URL 形如:http://thirdapp.host:port/context/sso;jsessionid=
实际的回调 URL 为: .../sso;jsessionid=....
- A 解析回调 URL 中的 token,并返回一个包含用户名的文本字符串,如:zhangsan
- B 获得回调返回的文本串后,和之前 URL 中的 username 进行比较,如果一样,则认为步骤1中的访问合法,并完成单点登录。
-
-
Methods Summary
Methods
| Type |
Name and description |
static void |
add(String appid, String ssourl, Integer timeout = 10) 注册一个外部系统 |
-
Inherited Methods Summary
Inherited Methods
| Methods inherited from class |
Name |
class Object |
Object#wait(long, int), Object#wait(long), Object#wait(), Object#equals(Object), Object#toString(), Object#hashCode(), Object#getClass(), Object#notify(), Object#notifyAll() |
-
-
Method Detail
-
static void add(String appid, String ssourl, Integer timeout = 10)
注册一个外部系统
- Parameters:
appid - 外系统应用idssourl - 外系统应用urltimeout - 超时时间,单位秒。默认值10
- Summary:
- Nested
- Field
- Constructor
- Method
- | Detail:
- Field
- Constructor
- Method
BROPEN Documentation, 2020-04-21 11:00