Skip to content

Commit 1c1cf81

Browse files
Use no Auth
1 parent 1e5a9d5 commit 1c1cf81

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ services:
103103
profiles: ['', 'basyx', 'tests']
104104
depends_on:
105105
- mongodb
106+
ports:
107+
- '8081:8081'
106108
environment:
107109
# MongoDb configuration for Basyx Repository
108110
BASYX__BACKEND: MongoDB
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using Microsoft.Extensions.Configuration;
2+
3+
namespace mnestix_proxy.Authentication
4+
{
5+
public static class ApplicationBuilderAuthExtensions
6+
{
7+
public static IApplicationBuilder UseMnestixConfiguredAuth(this IApplicationBuilder app, IConfiguration configuration)
8+
{
9+
var openIdEnabled = configuration.GetSection("OpenId").GetValue("EnableOpenIdAuth", false);
10+
var azureAdEnabled = configuration.GetSection("AzureAd").GetValue("EnableAzureAdAuth", false);
11+
12+
if (openIdEnabled || azureAdEnabled) {
13+
app.UseAuthentication();
14+
app.UseAuthorization();
15+
}
16+
17+
return app;
18+
}
19+
}
20+
}

mnestix-proxy/Program.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ public static void Main(string[] args)
4949
// pipeline settings
5050
var app = builder.Build();
5151

52-
app.UseAuthentication();
53-
app.UseAuthorization();
52+
app.UseMnestixConfiguredAuth(builder.Configuration);
53+
54+
app.UseCors("allowAnything");
5455

5556
app.MapReverseProxy(proxyPipeline =>
5657
{

mnestix-proxy/appsettings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
// if both OpenId and AzureAd are enabled OpenId will be used
2424
"OpenId": {
25-
"EnableOpenIdAuth": "true",
25+
"EnableOpenIdAuth": "false",
2626
"Issuer": "http://localhost:8080/realms/Menstix",
2727
"ClientID": "mnestixApi-demo",
2828
"RequireHttpsMetadata": "false"
@@ -39,7 +39,7 @@
3939
"AuthorizationPolicy": "customApiKeyToModifyValuesPolicy",
4040
"Match": {
4141
"Path": "api/{**catch-all}"
42-
}
42+
}
4343
},
4444
"EnvironmentRoute": {
4545
"ClusterId": "aasRepoCluster",

0 commit comments

Comments
 (0)