Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yujianwangzivayy
MaxKey
提交
04d0d1fa
MaxKey
项目概览
yujianwangzivayy
/
MaxKey
与 Fork 源项目一致
Fork自
MaxKey单点登录官方(MaxKeyTop) / MaxKey
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MaxKey
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
04d0d1fa
编写于
3月 12, 2020
作者:
MaxKey单点登录官方
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update tokenbased.md
上级
bb8ed3b7
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
256 addition
and
1 deletion
+256
-1
docs/sso/tokenbased.md
docs/sso/tokenbased.md
+256
-1
未找到文件。
docs/sso/tokenbased.md
浏览文件 @
04d0d1fa
TODO
\ No newline at end of file
<h2>
TokenBased应用集成
</h2>
本文介绍TokenBased应用如何与MaxKey进行集成。
<h2>
应用注册
</h2>
应用在MaxKey管理系统进行注册,注册的配置信息如下
<img
src=
"{{ "
/
images
/
sso
/
sso_token_conf.png
"
|
prepend:
site.baseurl
}}?{{
site.time
|
date:
"%
Y
%
m
%
d
%
H
%
M
"
}}"
alt=
""
/>
LTPA使用Cookie传输令牌
<img
src=
"{{ "
/
images
/
sso
/
sso_token_ltpa_conf.png
"
|
prepend:
site.baseurl
}}?{{
site.time
|
date:
"%
Y
%
m
%
d
%
H
%
M
"
}}"
alt=
""
/>
<h2>
TokenBased客户端集成
</h2>
本文使用JAVA WEB程序为例
jar包依赖如下
commons-codec-1.9.jar
commons-io-2.2.jar
commons-logging-1.1.1.jar
gson-2.2.4.jar
log4j-1.2.17.jar
maxkey-client-sdk.jar
JSP实现Code
<h4>
简单令牌
</h4>
<pre><code
class=
"jsp hljs"
>
<
%@ page language="java" import="java.util.
*
" pageEncoding="utf-8"%
>
<
%@ page language="java" import="org.maxkey.client.tokenbase.
*
"%
>
<
%@ page language="java" import="org.maxkey.client.crypto.
*
"%
>
<
%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String token =request.getParameter("token");
System.out.println("token : "+token);
String tokenString=TokenUtils.decode(token, "x8zPbCya", ReciprocalUtils.Algorithm.DES);
String parseToken[]=TokenUtils.parseSimpleBasedToken(tokenString);
%
>
<
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>
<
html
>
<
head
>
<
base href="
<
%=basePath%
>
"
>
<
title
>
SimpleBasedToken Demo
<
/title
>
<
meta http-equiv="pragma" content="no-cache"
>
<
meta http-equiv="cache-control" content="no-cache"
>
<
meta http-equiv="expires" content="0"
>
<
meta http-equiv="keywords" content="keyword1,keyword2,keyword3"
>
<
meta http-equiv="description" content="SimpleBasedToken Demo"
>
<
link rel="shortcut icon" type="image/x-icon" href="
<
%=basePath %
>
/images/favicon.ico"/
>
<
style type="text/css"
>
body{
margin: 0;
margin-top: 0px;
margin-left: auto;
margin-right: auto;
padding: 0 0 0 0px;
font-size: 12px;
text-align:center;
float:center;
font-family: "Arial", "Helvetica", "Verdana", "sans-serif";
}
.container {
width: 990px;
margin-left: auto;
margin-right: auto;
padding: 0 10px
}
table.datatable {
border: 1px solid #d8dcdf;
border-collapse:collapse;
border-spacing:0;
width: 100%;
}
table.datatable th{
border: 1px solid #d8dcdf;
border-collapse:collapse;
border-spacing:0;
height: 40px;
}
table.datatable td{
border: 1px solid #d8dcdf;
border-collapse:collapse;
border-spacing:0;
height: 40px;
}
table.datatable td.title{
text-align: center;
font-size: 20px;
font-weight: bold;
}
<
/style
>
<
/head
>
<
body
>
<
div class="container"
>
<
table class="datatable"
>
<
tr
>
<
td colspan="2" class="title"
>
SimpleBasedToken Demo
<
/td
>
<
/tr
>
<
tr
>
<
td
>
SimpleBasedToken Logo
<
/td
>
<
td
>
<
img src="
<
%=basePath %
>
images/simple.png" width="124px" height="124px"/
><
/td
>
<
/tr
>
<
tr
>
<
td
>
UserName
<
/td
>
<
td
><
%=parseToken[0]%
><
/td
>
<
/tr
>
<
tr
>
<
td
>
Authentication at Time
<
/td
>
<
td
><
%=parseToken[1]%
><
/td
>
<
/tr
>
<
/table
>
<
/div
>
<
/body
>
<
/html
>
</code></pre>
<h4>
基于JSON令牌
</h4>
<pre><code
class=
"jsp hljs"
>
<
%@ page language="java" import="java.util.
*
" pageEncoding="utf-8"%
>
<
%@ page language="java" import="org.maxkey.client.tokenbase.
*
"%
>
<
%@ page language="java" import="org.maxkey.client.crypto.
*
"%
>
<
%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String token =request.getParameter("token");
System.out.println("token : "+token);
String tokenString=TokenUtils.decode(token, "lEWhDLTo", ReciprocalUtils.Algorithm.DES);
Map tokenMap=TokenUtils.parseJsonBasedToken(tokenString);
%
>
<
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>
<
html
>
<
head
>
<
base href="
<
%=basePath%
>
"
>
<
title
>
JsonBasedToken Demo
<
/title
>
<
meta http-equiv="pragma" content="no-cache"
>
<
meta http-equiv="cache-control" content="no-cache"
>
<
meta http-equiv="expires" content="0"
>
<
meta http-equiv="keywords" content="keyword1,keyword2,keyword3"
>
<
meta http-equiv="description" content="JsonBasedToken Demo"
>
<
link rel="shortcut icon" type="image/x-icon" href="
<
%=basePath %
>
/images/favicon.ico"/
>
<
style type="text/css"
>
body{
margin: 0;
margin-top: 0px;
margin-left: auto;
margin-right: auto;
padding: 0 0 0 0px;
font-size: 12px;
text-align:center;
float:center;
font-family: "Arial", "Helvetica", "Verdana", "sans-serif";
}
.container {
width: 990px;
margin-left: auto;
margin-right: auto;
padding: 0 10px
}
table.datatable {
border: 1px solid #d8dcdf;
border-collapse:collapse;
border-spacing:0;
width: 100%;
}
table.datatable th{
border: 1px solid #d8dcdf;
border-collapse:collapse;
border-spacing:0;
height: 40px;
}
table.datatable td{
border: 1px solid #d8dcdf;
border-collapse:collapse;
border-spacing:0;
height: 40px;
}
table.datatable td.title{
text-align: center;
font-size: 20px;
font-weight: bold;
}
<
/style
>
<
/head
>
<
body
>
<
div class="container"
>
<
table class="datatable"
>
<
tr
>
<
td colspan="2" class="title"
>
JsonBasedToken Demo
<
/td
>
<
/tr
>
<
tr
>
<
td
>
JsonBasedToken Logo
<
/td
>
<
td
>
<
img src="
<
%=basePath %
>
images/json.png" width="124px" height="124px"/
><
/td
>
<
/tr
>
<
tr
>
<
td
>
UID
<
/td
>
<
td
><
%=tokenMap.get("uid") %
><
/td
>
<
/tr
>
<
tr
>
<
td
>
UserName
<
/td
>
<
td
><
%=tokenMap.get("username") %
><
/td
>
<
/tr
>
<
tr
>
<
td
>
Department
<
/td
>
<
td
><
%=tokenMap.get("department") %
><
/td
>
<
/tr
>
<
tr
>
<
td
>
Email
<
/td
>
<
td
><
%=tokenMap.get("email") %
><
/td
>
<
/tr
>
<
tr
>
<
td
>
Authentication at Time
<
/td
>
<
td
><
%=tokenMap.get("at")%
><
/td
>
<
/tr
>
<
tr
>
<
td
>
Expires
<
/td
>
<
td
><
%=tokenMap.get("expires")%
><
/td
>
<
/tr
>
<
/table
>
<
/div
>
<
/body
>
<
/html
>
</code></pre>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录