Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
pulsar
提交
5e803444
pulsar
项目概览
apache
/
pulsar
通知
129
Star
40
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Wiki
1
Wiki
分析
仓库
DevOps
项目成员
Pages
pulsar
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
Wiki
1
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
体验新版 GitCode,发现更多精彩内容 >>
提交
5e803444
编写于
3月 02, 2017
作者:
Y
Yuki Shiga
提交者:
Matteo Merli
3月 01, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Resolve compatibility with previous version (#241)
上级
bb0de8eb
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
75 addition
and
45 deletion
+75
-45
pulsar-client-cpp/include/pulsar/Auth.h
pulsar-client-cpp/include/pulsar/Auth.h
+47
-10
pulsar-client-cpp/lib/Auth.cc
pulsar-client-cpp/lib/Auth.cc
+27
-34
pulsar-client-cpp/lib/Client.cc
pulsar-client-cpp/lib/Client.cc
+1
-1
未找到文件。
pulsar-client-cpp/include/pulsar/Auth.h
浏览文件 @
5e803444
...
...
@@ -26,9 +26,28 @@
#pragma GCC visibility push(default)
namespace
pulsar
{
typedef
std
::
map
<
std
::
string
,
std
::
string
>
ParamMap
;
#ifdef PULSAR_ENABLE_DEPRECATED_METHOD
// This is deprecated.
enum
AuthType
{
AuthNone
,
AuthYcaV1
};
// This is deprecated.
class
AuthData
{
public:
virtual
~
AuthData
();
virtual
AuthType
getType
()
const
=
0
;
virtual
Result
getAuthData
(
std
::
string
&
authDataContent
)
const
=
0
;
protected:
AuthData
();
};
typedef
boost
::
shared_ptr
<
AuthData
>
AuthDataPtr
;
#endif
class
AuthenticationDataProvider
{
public:
virtual
~
AuthenticationDataProvider
();
...
...
@@ -43,33 +62,51 @@ namespace pulsar {
protected:
AuthenticationDataProvider
();
};
typedef
boost
::
shared_ptr
<
AuthenticationDataProvider
>
AuthenticationDataPtr
;
class
Authentication
{
public:
virtual
~
Authentication
();
virtual
const
std
::
string
getAuthMethodName
()
const
=
0
;
virtual
Result
getAuthData
(
AuthenticationDataPtr
&
authDataContent
)
const
=
0
;
virtual
Result
getAuthData
(
AuthenticationDataPtr
&
authDataContent
)
const
{
authDataContent
=
authData_
;
return
ResultOk
;
}
#ifdef PULSAR_ENABLE_DEPRECATED_METHOD
// This is deprecated.
virtual
Result
getAuthData
(
std
::
string
&
authDataContent
)
const
{
return
ResultOk
;
}
#endif
protected:
Authentication
();
AuthenticationDataPtr
authData_
;
};
typedef
boost
::
shared_ptr
<
Authentication
>
AuthenticationPtr
;
typedef
std
::
map
<
std
::
string
,
std
::
string
>
ParamMap
;
class
Auth
{
public:
#ifdef PULSAR_ENABLE_DEPRECATED_METHOD
// This is deprecated.
static
AuthDataPtr
Disabled
();
// This is deprecated.
static
AuthDataPtr
YcaV1
(
const
std
::
string
&
ycaAppId
);
#else
static
AuthenticationPtr
Disabled
();
#endif
static
AuthenticationPtr
create
(
const
std
::
string
&
dynamicLibPath
);
static
AuthenticationPtr
create
(
const
std
::
string
&
dynamicLibPath
,
const
std
::
string
&
authParamsString
);
static
AuthenticationPtr
create
(
const
std
::
string
&
dynamicLibPath
,
ParamMap
&
params
);
protected:
static
bool
isShutdownHookRegistered_
;
static
std
::
vector
<
void
*>
loadedLibrariesHandles_
;
static
void
release_handles
();
};
}
// namespace pulsar
...
...
pulsar-client-cpp/lib/Auth.cc
浏览文件 @
5e803444
...
...
@@ -31,98 +31,91 @@
DECLARE_LOG_OBJECT
()
namespace
pulsar
{
AuthenticationDataProvider
::
AuthenticationDataProvider
(){
}
AuthenticationDataProvider
::~
AuthenticationDataProvider
()
{
}
bool
AuthenticationDataProvider
::
hasDataForTls
()
{
return
false
;
}
std
::
string
AuthenticationDataProvider
::
getTlsCertificates
()
{
return
"none"
;
}
std
::
string
AuthenticationDataProvider
::
getTlsPrivateKey
()
{
return
"none"
;
}
bool
AuthenticationDataProvider
::
hasDataForHttp
()
{
return
false
;
}
std
::
string
AuthenticationDataProvider
::
getHttpAuthType
()
{
return
"none"
;
}
std
::
string
AuthenticationDataProvider
::
getHttpHeaders
()
{
return
"none"
;
}
bool
AuthenticationDataProvider
::
hasDataFromCommand
(){
return
false
;
}
std
::
string
AuthenticationDataProvider
::
getCommandData
()
{
return
"none"
;
}
Authentication
::
Authentication
()
{
}
Authentication
::~
Authentication
()
{
}
class
AuthDisabledData
:
public
AuthenticationDataProvider
{
public:
AuthDisabledData
(
ParamMap
&
params
){
}
};
class
AuthDisabled
:
public
Authentication
{
public:
AuthDisabled
(
AuthenticationDataPtr
&
authData
)
{
authData_
=
authData
;
}
static
AuthenticationPtr
create
(
ParamMap
&
params
)
{
AuthenticationDataPtr
authData
=
AuthenticationDataPtr
(
new
AuthDisabledData
(
params
));
return
AuthenticationPtr
(
new
AuthDisabled
(
authData
));
}
const
std
::
string
getAuthMethodName
()
const
{
return
"none"
;
}
Result
getAuthData
(
AuthenticationDataPtr
&
authDataContent
)
const
{
authDataContent
=
authData_
;
return
ResultOk
;
}
private:
AuthenticationDataPtr
authData_
;
};
AuthenticationPtr
Auth
::
Disabled
()
{
ParamMap
params
;
return
AuthDisabled
::
create
(
params
);
}
AuthenticationPtr
Auth
::
create
(
const
std
::
string
&
dynamicLibPath
)
{
ParamMap
params
;
return
Auth
::
create
(
dynamicLibPath
,
params
);
}
boost
::
mutex
mutex
;
std
::
vector
<
void
*>
Auth
::
loadedLibrariesHandles_
;
bool
Auth
::
isShutdownHookRegistered_
=
false
;
void
Auth
::
release_handles
()
{
boost
::
lock_guard
<
boost
::
mutex
>
lock
(
mutex
);
for
(
std
::
vector
<
void
*>::
iterator
ite
=
Auth
::
loadedLibrariesHandles_
.
begin
();
ite
!=
Auth
::
loadedLibrariesHandles_
.
end
();
...
...
@@ -131,7 +124,7 @@ namespace pulsar {
}
loadedLibrariesHandles_
.
clear
();
}
AuthenticationPtr
Auth
::
create
(
const
std
::
string
&
dynamicLibPath
,
const
std
::
string
&
authParamsString
)
{
ParamMap
paramMap
;
if
(
!
authParamsString
.
empty
())
{
...
...
@@ -147,7 +140,7 @@ namespace pulsar {
}
return
Auth
::
create
(
dynamicLibPath
,
paramMap
);
}
AuthenticationPtr
Auth
::
create
(
const
std
::
string
&
dynamicLibPath
,
ParamMap
&
params
)
{
{
boost
::
lock_guard
<
boost
::
mutex
>
lock
(
mutex
);
...
...
@@ -169,5 +162,5 @@ namespace pulsar {
}
return
boost
::
shared_ptr
<
Authentication
>
(
auth
);
}
}
pulsar-client-cpp/lib/Client.cc
浏览文件 @
5e803444
...
...
@@ -132,7 +132,7 @@ ClientConfiguration& ClientConfiguration::setTlsAllowInsecureConnection(bool all
bool
ClientConfiguration
::
isTlsAllowInsecureConnection
()
const
{
return
impl_
->
tlsAllowInsecureConnection
;
}
ClientConfiguration
&
ClientConfiguration
::
setConcurrentLookupRequest
(
int
concurrentLookupRequest
)
{
impl_
->
concurrentLookupRequest
=
concurrentLookupRequest
;
return
*
this
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录