forked from AcaMate/AcaMate_API
28 lines
787 B
C#
28 lines
787 B
C#
using Back.Program.Common.Auth.Interface;
|
|
using Back.Program.Common.Data;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Back.Program.Common.Auth
|
|
{
|
|
/// <summary>
|
|
/// DB에서 헤더 키값 찾아서 그 밸류 값 빼오기 위해서 사용
|
|
/// </summary>
|
|
public class HeaderConfigRepository : IHeaderConfig
|
|
{
|
|
private readonly AppDbContext _dbContext;
|
|
|
|
public HeaderConfigRepository(AppDbContext dbContext)
|
|
{
|
|
_dbContext = dbContext;
|
|
}
|
|
|
|
public async Task<string> GetExpectedHeaderValueAsync(string headerValue)
|
|
{
|
|
var config = await _dbContext.APIHeader
|
|
.FirstOrDefaultAsync(h => h.h_value == headerValue);
|
|
return config?.h_key ?? string.Empty;
|
|
}
|
|
|
|
}
|
|
}
|