Skip to content

Commit

Permalink
Change authentication for REST /server/getaasx2
Browse files Browse the repository at this point in the history
If --no-security is set, an .AASX can be retrieved by getaasx2.
This works together with file /connect in AASX Package Explorer.
  • Loading branch information
aorzelskiGH committed Nov 12, 2020
1 parent 8d3bb2d commit b7f6587
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/AasxServerBlazor/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"AasxServerBlazor": {
"commandName": "Project",
"commandLineArgs": "--data-path C:\\Users\\7wrmhx\\Documents\\_Standardization\\Diedrich\\test --rest --edit --connect",
"commandLineArgs": "--data-path C:\\Development\\AASX_DigTyp40 --rest --no-security",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
Expand Down
23 changes: 23 additions & 0 deletions src/AasxServerStandardBib/AasxHttpContextHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2993,16 +2993,39 @@ public void EvalGetAASX2(IHttpContext context, int fileIndex)
dynamic res = new ExpandoObject();
int index = -1;

// check authentication
string accessrights = null;
if (withAuthentification)
{
accessrights = SecurityCheck(context, ref index);

if (accessrights == null)
{
res.error = "You are not authorized for this operation!";
SendJsonResponse(context, res);
return;
}

res.confirm = "Authorization = " + accessrights;
}
else
{
accessrights = "readonly";
}

Console.WriteLine("Security 5 Server: /server/getaasx2/" + fileIndex);

// check authentication
/*
if (!withAuthentification)
{
res.error = "You are not authorized for this operation!";
SendJsonResponse(context, res);
return;
}
string accessrights = SecurityCheck(context, ref index);
*/

Console.WriteLine("Security 5.1 Server: Check bearer token and access rights");
Console.WriteLine("Security 5.2 Server: Validate that bearer token is signed by session unique random");

Expand Down

0 comments on commit b7f6587

Please sign in to comment.