Skip to content

Commit 434a1e9

Browse files
committed
update sample for to the last version
1 parent 00be0dc commit 434a1e9

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

samples/KK.AspNetCore.EasyAuthAuthentication.Samples.Web/Controllers/WeatherForecastController.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
namespace KK.AspNetCore.EasyAuthAuthentication.Samples.Web.Controllers
1+
namespace KK.AspNetCore.EasyAuthAuthentication.Samples.Web.Controllers
22
{
33
using System;
44
using System.Collections.Generic;
55
using System.Linq;
66
using KK.AspNetCore.EasyAuthAuthentication.Samples.Web.Models;
7+
using Microsoft.AspNetCore.Authorization;
78
using Microsoft.AspNetCore.Mvc;
89
using Microsoft.Extensions.Logging;
910

1011
[ApiController]
1112
[Route("[controller]")]
13+
[Authorize]
1214
public class WeatherForecastController : ControllerBase
1315
{
1416
private static readonly string[] Summaries = new[]

samples/KK.AspNetCore.EasyAuthAuthentication.Samples.Web/Startup.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
6363

6464
// Add Authentication middleware before MVC to get it working for MVC routes
6565
_ = app.UseAuthentication();
66+
6667

6768
_ = app.UseRouting();
68-
69+
_ = app.UseAuthorization();
6970
_ = app.UseEndpoints(
7071
endpoints => endpoints.MapControllerRoute(
7172
name: "default",

0 commit comments

Comments
 (0)