Skip to content

Commit

Permalink
Update secured web api
Browse files Browse the repository at this point in the history
  • Loading branch information
sibille committed May 29, 2020
1 parent 4e54183 commit 7e35d7e
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"wts.compositionFilter": "$frontendframework == MVVMBasic|MVVMLight|CodeBehind|CaliburnMicro|Prism & groupidentity == wts.Service.SecuredWebApi",
"wts.version": "1.0.0",
"wts.compositionOrder": "1",
"wts.outputToParent": "true"
"wts.outputToParent": "true",
"wts.licenses": "[AspNetCore](https://github.com/dotnet/aspnetcore/blob/master/LICENSE.txt)"
},
"sourceName": "WebApiFeature",
"preferNameDirectory": true,
Expand All @@ -37,5 +38,17 @@
"replaces": "Param_RootNamespace"
}
},
"postActions": [ ]
"postActions": [
{
"description": "Add nuget package",
"manualInstructions": [ ],
"actionId": "0B814718-16A3-4F7F-89F1-69C0F9170EAD",
"args": {
"packageId" : "Microsoft.AspNetCore.Authentication.JwtBearer",
"version" : "3.1.3",
"projectPath": "Param_ProjectName.WebApi\\Param_ProjectName.WebApi.csproj"
},
"continueOnError": true
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
//{[{
services.ProtectWebApiWithJwtBearer(Configuration);
//}]}
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseHttpsRedirection();
app.UseRouting();
//{[{
app.UseAuthentication();
app.UseAuthorization();
//}]}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
//^^
//{[{
"AuthenticationSettings": {
"ClientId": "set_your_client_id",
"TenantId": "set_your_tenant_id",
"Audience": "set_your_audience",
"Scope": "set_your_scope"
},
//}]}
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,11 @@
},
//}]}
"Logging": {
"IncludeScopes": false,
"Debug": {
"LogLevel": {
"Default": "Warning"
}
},
"Console": {
"LogLevel": {
"Default": "Warning"
}
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
},
"AllowedHosts": "*"
}

0 comments on commit 7e35d7e

Please sign in to comment.