Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FIT-Connect-SDK - .NET
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FIT-Connect
FIT-Connect-SDK - .NET
Commits
a43d11ba
Commit
a43d11ba
authored
2 years ago
by
Klaus Fischer
Browse files
Options
Downloads
Patches
Plain Diff
Valdation on creating SET
Added warning to add actual data to SETs
parent
b41bf8be
No related branches found
No related tags found
1 merge request
!9
.NET-SDK: SET-Empfang inkl. Signaturprüfung - Ticket 562
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
FitConnect/Encryption/FitEncryption.cs
+15
-1
15 additions, 1 deletion
FitConnect/Encryption/FitEncryption.cs
FitConnect/Encryption/JsonHelper.cs
+8
-0
8 additions, 0 deletions
FitConnect/Encryption/JsonHelper.cs
with
23 additions
and
1 deletion
FitConnect/Encryption/FitEncryption.cs
+
15
−
1
View file @
a43d11ba
...
...
@@ -95,6 +95,7 @@ public class FitEncryption {
public
string
CreateAcceptSecurityEventToken
(
SubmissionForPickupDto
submission
)
{
// string submissionSubmissionId,string submissionCaseId, string submissionDestinationId) {
#
warning
Dummy
data
is
used
for
testing
purposes
,
replace
with
actual
data
// NOMERGE Remove Dummy data
var
payload
=
new
{
authenticationTags
=
new
{
...
...
@@ -158,7 +159,20 @@ public class FitEncryption {
};
var
handler
=
new
JwtSecurityTokenHandler
();
return
handler
.
WriteToken
(
token
);
var
tokenString
=
handler
.
WriteToken
(
token
);
if
(
content
!=
null
)
{
var
jsonData
=
Base64UrlEncoder
.
Decode
(
tokenString
.
Split
(
'.'
)[
1
]);
if
(!
JsonHelper
.
ValidateJsonSchema
(
new
Uri
(
"https://schema.fitko.de/fit-connect/set-payload/1.0.0/set-payload.schema.json"
),
jsonData
))
{
throw
new
Exception
(
"Invalid token schema for \n"
+
jsonData
);
}
}
return
tokenString
;
}
public
static
string
CalculateHash
(
string
data
)
{
...
...
This diff is collapsed.
Click to expand it.
FitConnect/Encryption/JsonHelper.cs
+
8
−
0
View file @
a43d11ba
...
...
@@ -36,4 +36,12 @@ public static class JsonHelper {
var
reader
=
new
StreamReader
(
resourceStream
);
return
reader
.
ReadToEnd
();
}
public
static
bool
ValidateJsonSchema
(
Uri
schema
,
string
jsonData
)
{
var
schemaResponse
=
new
HttpClient
()
.
GetAsync
(
schema
)
.
Result
;
return
ValidateJsonSchema
(
schemaResponse
.
Content
.
ReadAsStringAsync
().
Result
,
jsonData
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment