Skip to content

Commit 3fd65e0

Browse files
committed
test
1 parent 55734e0 commit 3fd65e0

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

BankApi.Mcp/Program.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
using MCPify.Hosting;
22
using Microsoft.AspNetCore.Authentication.JwtBearer;
3-
using Microsoft.IdentityModel.JsonWebTokens;
3+
using ModelContextProtocol.AspNetCore.Authentication;
44

55
var builder = WebApplication.CreateBuilder(args);
66

77
await builder.Services.AddMCPService(builder.Configuration["ApiBaseUrl"]!, "v1", builder.Configuration["McpServerBaseUrl"]!);
88

9-
builder.Services.AddAuthorization(options =>
10-
options.DefaultPolicy = new Microsoft.AspNetCore.Authorization.AuthorizationPolicyBuilder()
11-
.RequireAuthenticatedUser()
12-
.AddAuthenticationSchemes(JwtBearerDefaults.AuthenticationScheme)
13-
.Build());
9+
builder.Services.AddAuthentication(options =>
10+
{
11+
options.DefaultChallengeScheme = McpAuthenticationDefaults.AuthenticationScheme;
12+
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
13+
});
14+
15+
builder.Services.AddAuthorization();
1416

1517
var app = builder.Build();
1618

0 commit comments

Comments
 (0)