Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
pulsar
提交
79ecb72d
pulsar
项目概览
apache
/
pulsar
通知
129
Star
40
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Wiki
1
Wiki
分析
仓库
DevOps
项目成员
Pages
pulsar
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
Wiki
1
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
79ecb72d
编写于
10月 21, 2017
作者:
Y
Yuki Shiga
提交者:
Matteo Merli
10月 20, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Modify AuthFactory for C++ Client to enable each plugin to parse authPramsString (#792)
上级
4288839f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
36 addition
and
14 deletion
+36
-14
pulsar-client-cpp/lib/Authentication.cc
pulsar-client-cpp/lib/Authentication.cc
+34
-12
pulsar-client-cpp/lib/auth/AuthAthenz.cc
pulsar-client-cpp/lib/auth/AuthAthenz.cc
+1
-1
pulsar-client-cpp/lib/auth/AuthTls.cc
pulsar-client-cpp/lib/auth/AuthTls.cc
+1
-1
未找到文件。
pulsar-client-cpp/lib/Authentication.cc
浏览文件 @
79ecb72d
...
@@ -128,19 +128,41 @@ namespace pulsar {
...
@@ -128,19 +128,41 @@ namespace pulsar {
}
}
AuthenticationPtr
AuthFactory
::
create
(
const
std
::
string
&
dynamicLibPath
,
const
std
::
string
&
authParamsString
)
{
AuthenticationPtr
AuthFactory
::
create
(
const
std
::
string
&
dynamicLibPath
,
const
std
::
string
&
authParamsString
)
{
ParamMap
paramMap
;
{
if
(
!
authParamsString
.
empty
())
{
boost
::
lock_guard
<
boost
::
mutex
>
lock
(
mutex
);
std
::
vector
<
std
::
string
>
params
;
if
(
!
AuthFactory
::
isShutdownHookRegistered_
)
{
boost
::
algorithm
::
split
(
params
,
authParamsString
,
boost
::
is_any_of
(
","
));
atexit
(
release_handles
);
for
(
int
i
=
0
;
i
<
params
.
size
();
i
++
)
{
AuthFactory
::
isShutdownHookRegistered_
=
true
;
std
::
vector
<
std
::
string
>
kv
;
}
boost
::
algorithm
::
split
(
kv
,
params
[
i
],
boost
::
is_any_of
(
":"
));
}
if
(
kv
.
size
()
==
2
)
{
Authentication
*
auth
=
NULL
;
paramMap
[
kv
[
0
]]
=
kv
[
1
];
void
*
handle
=
dlopen
(
dynamicLibPath
.
c_str
(),
RTLD_LAZY
);
if
(
handle
!=
NULL
)
{
{
boost
::
lock_guard
<
boost
::
mutex
>
lock
(
mutex
);
loadedLibrariesHandles_
.
push_back
(
handle
);
}
Authentication
*
(
*
createAuthentication
)(
const
std
::
string
&
);
*
(
void
**
)
(
&
createAuthentication
)
=
dlsym
(
handle
,
"create"
);
if
(
createAuthentication
!=
NULL
)
{
auth
=
createAuthentication
(
authParamsString
);
}
else
{
ParamMap
paramMap
;
if
(
!
authParamsString
.
empty
())
{
std
::
vector
<
std
::
string
>
params
;
boost
::
algorithm
::
split
(
params
,
authParamsString
,
boost
::
is_any_of
(
","
));
for
(
int
i
=
0
;
i
<
params
.
size
();
i
++
)
{
std
::
vector
<
std
::
string
>
kv
;
boost
::
algorithm
::
split
(
kv
,
params
[
i
],
boost
::
is_any_of
(
":"
));
if
(
kv
.
size
()
==
2
)
{
paramMap
[
kv
[
0
]]
=
kv
[
1
];
}
}
}
}
return
AuthFactory
::
create
(
dynamicLibPath
,
paramMap
);
}
}
}
}
return
Auth
Factory
::
create
(
dynamicLibPath
,
paramMap
);
return
Auth
enticationPtr
(
auth
);
}
}
AuthenticationPtr
AuthFactory
::
create
(
const
std
::
string
&
dynamicLibPath
,
ParamMap
&
params
)
{
AuthenticationPtr
AuthFactory
::
create
(
const
std
::
string
&
dynamicLibPath
,
ParamMap
&
params
)
{
...
@@ -157,12 +179,12 @@ namespace pulsar {
...
@@ -157,12 +179,12 @@ namespace pulsar {
boost
::
lock_guard
<
boost
::
mutex
>
lock
(
mutex
);
boost
::
lock_guard
<
boost
::
mutex
>
lock
(
mutex
);
loadedLibrariesHandles_
.
push_back
(
handle
);
loadedLibrariesHandles_
.
push_back
(
handle
);
Authentication
*
(
*
createAuthentication
)(
ParamMap
&
);
Authentication
*
(
*
createAuthentication
)(
ParamMap
&
);
*
(
void
**
)
(
&
createAuthentication
)
=
dlsym
(
handle
,
"create"
);
*
(
void
**
)
(
&
createAuthentication
)
=
dlsym
(
handle
,
"create
FromMap
"
);
if
(
createAuthentication
!=
NULL
)
{
if
(
createAuthentication
!=
NULL
)
{
auth
=
createAuthentication
(
params
);
auth
=
createAuthentication
(
params
);
}
}
}
}
return
boost
::
shared_ptr
<
Authentication
>
(
auth
);
return
AuthenticationPtr
(
auth
);
}
}
}
}
pulsar-client-cpp/lib/auth/AuthAthenz.cc
浏览文件 @
79ecb72d
...
@@ -85,7 +85,7 @@ namespace pulsar {
...
@@ -85,7 +85,7 @@ namespace pulsar {
return
ResultOk
;
return
ResultOk
;
}
}
extern
"C"
Authentication
*
create
(
ParamMap
&
params
)
{
extern
"C"
Authentication
*
create
FromMap
(
ParamMap
&
params
)
{
AuthenticationDataPtr
authDataAthenz
=
AuthenticationDataPtr
(
new
AuthDataAthenz
(
params
));
AuthenticationDataPtr
authDataAthenz
=
AuthenticationDataPtr
(
new
AuthDataAthenz
(
params
));
return
new
AuthAthenz
(
authDataAthenz
);
return
new
AuthAthenz
(
authDataAthenz
);
}
}
...
...
pulsar-client-cpp/lib/auth/AuthTls.cc
浏览文件 @
79ecb72d
...
@@ -61,7 +61,7 @@ namespace pulsar {
...
@@ -61,7 +61,7 @@ namespace pulsar {
return
ResultOk
;
return
ResultOk
;
}
}
extern
"C"
Authentication
*
create
(
ParamMap
&
params
)
{
extern
"C"
Authentication
*
create
FromMap
(
ParamMap
&
params
)
{
AuthenticationDataPtr
authDataTls
=
AuthenticationDataPtr
(
new
AuthDataTls
(
params
));
AuthenticationDataPtr
authDataTls
=
AuthenticationDataPtr
(
new
AuthDataTls
(
params
));
return
new
AuthTls
(
authDataTls
);
return
new
AuthTls
(
authDataTls
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录