Skip to content

Commit b461e1f

Browse files
committed
Feat: Ilogger 추가
1 parent b3bfc11 commit b461e1f

File tree

7 files changed

+54
-11
lines changed

7 files changed

+54
-11
lines changed

EveryPinApi.Presentation/Controllers/AuthenticationController.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.Extensions.Logging;
23
using Service.Contracts;
34
using Shared.DataTransferObject;
45
using System;
@@ -14,8 +15,14 @@ namespace EveryPinApi.Presentation.Controllers
1415
[ApiController]
1516
public class AuthenticationController : ControllerBase
1617
{
18+
private readonly ILogger _logger;
1719
private readonly IServiceManager _service;
18-
public AuthenticationController(IServiceManager service) => _service = service;
20+
21+
public AuthenticationController(ILogger<AuthenticationController> logger, IServiceManager service)
22+
{
23+
_logger = logger;
24+
_service = service;
25+
}
1926

2027
[HttpPost]
2128
//[ServiceFilter(typeof(ValidationFilterAttribute))]

EveryPinApi.Presentation/Controllers/CommentController.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,22 @@
77
using System.Runtime.InteropServices;
88
using System.Text;
99
using System.Threading.Tasks;
10+
using Microsoft.Extensions.Logging;
1011

1112
namespace EveryPinApi.Presentation.Controllers
1213
{
1314
[Route("api/comment")]
1415
[ApiController]
1516
public class CommentController : ControllerBase
1617
{
18+
private readonly ILogger _logger;
1719
private readonly IServiceManager _service;
18-
public CommentController(IServiceManager service) => _service = service;
20+
21+
public CommentController(ILogger<CommentController> logger, IServiceManager service)
22+
{
23+
_logger = logger;
24+
_service = service;
25+
}
1926

2027
[HttpGet]
2128
public IActionResult GetAllComment()

EveryPinApi.Presentation/Controllers/LikeController.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.Extensions.Logging;
23
using Service.Contracts;
34
using System;
45
using System.Collections.Generic;
@@ -12,8 +13,14 @@ namespace EveryPinApi.Presentation.Controllers
1213
[ApiController]
1314
public class LikeController : ControllerBase
1415
{
16+
private readonly ILogger _logger;
1517
private readonly IServiceManager _service;
16-
public LikeController(IServiceManager service) => _service = service;
18+
19+
public LikeController(ILogger<LikeController> logger, IServiceManager service)
20+
{
21+
_logger = logger;
22+
_service = service;
23+
}
1724

1825
[HttpGet]
1926
public IActionResult GetAllLike()

EveryPinApi.Presentation/Controllers/PostController.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.Extensions.Logging;
23
using Service.Contracts;
34
using System;
45
using System.Collections.Generic;
@@ -12,8 +13,14 @@ namespace EveryPinApi.Presentation.Controllers
1213
[ApiController]
1314
public class PostController : ControllerBase
1415
{
16+
private readonly ILogger _logger;
1517
private readonly IServiceManager _service;
16-
public PostController(IServiceManager service) => _service = service;
18+
19+
public PostController(ILogger<PostController> logger, IServiceManager service)
20+
{
21+
_logger = logger;
22+
_service = service;
23+
}
1724

1825
[HttpGet]
1926
public IActionResult GetAllPost()

EveryPinApi.Presentation/Controllers/PostPhotoController.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.Extensions.Logging;
23
using Service.Contracts;
34
using System;
45
using System.Collections.Generic;
@@ -12,8 +13,14 @@ namespace EveryPinApi.Presentation.Controllers
1213
[ApiController]
1314
public class PostPhotoController : ControllerBase
1415
{
16+
private readonly ILogger _logger;
1517
private readonly IServiceManager _service;
16-
public PostPhotoController(IServiceManager service) => _service = service;
18+
19+
public PostPhotoController(ILogger<PostPhotoController> logger, IServiceManager service)
20+
{
21+
_logger = logger;
22+
_service = service;
23+
}
1724

1825
[HttpGet]
1926
public IActionResult GetAllPostPhoto()

EveryPinApi.Presentation/Controllers/ProfileController.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.Extensions.Logging;
23
using Service.Contracts;
34
using System;
45
using System.Collections.Generic;
@@ -12,8 +13,14 @@ namespace EveryPinApi.Presentation.Controllers
1213
[ApiController]
1314
public class ProfileController : ControllerBase
1415
{
16+
private readonly ILogger _logger;
1517
private readonly IServiceManager _service;
16-
public ProfileController(IServiceManager service) => _service = service;
18+
19+
public ProfileController(ILogger<ProfileController> logger, IServiceManager service)
20+
{
21+
_logger = logger;
22+
_service = service;
23+
}
1724

1825
[HttpGet]
1926
public IActionResult GetAllProfile()

EveryPinApi/Extensions/ServiceExtensions.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,9 @@ public static void ConfigureIdentity(this IServiceCollection services)
8888

8989
public static void ConfigureJWT(this IServiceCollection services, IConfiguration configuration)
9090
{
91-
var jwtSettings = configuration.GetSection("JwtSettings");
92-
var secretKey = jwtSettings["jwtSecret"];
91+
var validIssuer = configuration.GetSection("JwtSettings-validIssuer");
92+
var validAudience = configuration.GetSection("JwtSettings-validAudience");
93+
var secretKey = configuration.GetSection("JwtSettings-SECRET");
9394
services.AddAuthentication(opt =>
9495
{
9596
opt.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
@@ -103,9 +104,9 @@ public static void ConfigureJWT(this IServiceCollection services, IConfiguration
103104
ValidateAudience = true,
104105
ValidateLifetime = true,
105106
ValidateIssuerSigningKey = true,
106-
ValidIssuer = jwtSettings["validIssuer"],
107-
ValidAudience = jwtSettings["validAudience"],
108-
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(secretKey))
107+
ValidIssuer = validIssuer.Value,
108+
ValidAudience = validAudience.Value,
109+
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(secretKey.Value))
109110
};
110111
});
111112
}

0 commit comments

Comments
 (0)