Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
IoTSharp
提交
ae728423
I
IoTSharp
项目概览
jobily
/
IoTSharp
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
IoTSharp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ae728423
编写于
10月 04, 2022
作者:
W
wq1234wq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
证书
上级
eba04b97
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
47 addition
and
33 deletion
+47
-33
IoTSharp/ClientApp/src/app/routes/devices/devicecertdialog/devicecertdialog.component.ts
...es/devices/devicecertdialog/devicecertdialog.component.ts
+11
-17
IoTSharp/Controllers/DevicesController.cs
IoTSharp/Controllers/DevicesController.cs
+35
-15
IoTSharp/appsettings.MySql.json
IoTSharp/appsettings.MySql.json
+1
-1
未找到文件。
IoTSharp/ClientApp/src/app/routes/devices/devicecertdialog/devicecertdialog.component.ts
浏览文件 @
ae728423
...
...
@@ -57,8 +57,6 @@ e
.
subscribe
(
{
next
:
next
=>
{
if
(
next
.
code
===
10000
){
let
url
=
window
.
URL
.
createObjectURL
(
next
);
let
a
=
document
.
createElement
(
'
a
'
);
document
.
body
.
appendChild
(
a
);
...
...
@@ -68,15 +66,11 @@ e
a
.
click
();
window
.
URL
.
revokeObjectURL
(
url
);
a
.
remove
();
}
else
{
this
.
msg
.
create
(
'
error
'
,
'
证书下载失败:
'
+
next
.
msg
);
}
},
error
:
error
=>
{
this
.
msg
.
create
(
'
error
'
,
'
证书下载失败:
'
+
error
.
error
);
this
.
msg
.
create
(
'
error
'
,
'
证书下载失败:
'
+
error
.
error
);
},
complete
:
()
=>
{
}
}
);
...
...
IoTSharp/Controllers/DevicesController.cs
浏览文件 @
ae728423
...
...
@@ -250,7 +250,15 @@ namespace IoTSharp.Controllers
SubjectAlternativeNameBuilder
altNames
=
new
SubjectAlternativeNameBuilder
();
altNames
.
AddUserPrincipalName
(
did
.
Device
.
Id
.
ToString
());
if
(!
string
.
IsNullOrEmpty
(
_setting
.
MqttBroker
.
DomainName
))
{
altNames
.
AddDnsName
(
_setting
.
MqttBroker
.
DomainName
);
if
(!
string
.
IsNullOrEmpty
(
_setting
.
MqttBroker
.
ServerIPAddress
))
{
if
(
_setting
.
MqttBroker
.
TlsPort
>
0
&&
_setting
.
MqttBroker
.
TlsPort
<
65535
)
{
altNames
.
AddUri
(
new
Uri
(
$"mqtt://
{
_setting
.
MqttBroker
.
ServerIPAddress
}
:
{
_setting
.
MqttBroker
.
TlsPort
}
"
));
string
name
=
$"CN=
{
dev
.
Name
}
,C=CN,L=
{
dev
.
Customer
.
Province
??
"IoTSharp"
}
,ST=
{
dev
.
Customer
.
City
??
"IoTSharp"
}
,O=
{
dev
.
Customer
.
Name
}
,OU=
{
dev
.
Tenant
.
Name
}
"
;
var
tlsclient
=
option
.
CACertificate
.
CreateTlsClientRSA
(
name
,
altNames
);
...
...
@@ -268,11 +276,23 @@ namespace IoTSharp.Controllers
return
new
ApiResult
<
DeviceIdentity
>(
ApiCode
.
Success
,
"OK"
,
new
DeviceIdentity
()
{
Id
=
did
.
Id
,
IdentityType
=
did
.
IdentityType
,
IdentityId
=
did
.
IdentityId
});
}
else
{
return
new
ApiResult
<
DeviceIdentity
>(
ApiCode
.
NotFoundDeviceIdentity
,
"Please set valid MqttBroker TlsPort"
,
null
);
}
}
return
new
ApiResult
<
DeviceIdentity
>(
ApiCode
.
NotFoundDeviceIdentity
,
"Please set MqttBroker ServerIPAddress"
,
null
);
}
return
new
ApiResult
<
DeviceIdentity
>(
ApiCode
.
NotFoundDeviceIdentity
,
"Please set MqttBroker domain name"
,
null
);
}
else
{
return
new
ApiResult
<
DeviceIdentity
>(
ApiCode
.
NotFoundDeviceIdentity
,
"Not found device identity"
,
null
);
}
}
/// <summary>
/// 下载证书
/// </summary>
...
...
IoTSharp/appsettings.MySql.json
浏览文件 @
ae728423
...
...
@@ -8,7 +8,7 @@
},
"DataBase"
:
"MySql"
,
"ConnectionStrings"
:
{
"IoTSharp"
:
"server=localhost;user=root;password=kissmedatabase=IoTSharp"
,
"IoTSharp"
:
"server=localhost;user=root;password=kissme
;
database=IoTSharp"
,
"TelemetryStorage"
:
"server=localhost;user=root;password=kissme;database=IoTSharp"
},
"JwtKey"
:
"kissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissme"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录