|
1 | | -using System; |
2 | | -using System.Collections.Generic; |
3 | | -using System.Linq; |
4 | | -using System.Threading.Tasks; |
5 | | -using AgileConfig.Server.Apisite.Controllers.api.Models; |
| 1 | +using AgileConfig.Server.Apisite.Controllers.api.Models; |
6 | 2 | using AgileConfig.Server.Apisite.Filters; |
7 | 3 | using AgileConfig.Server.Apisite.Metrics; |
8 | 4 | using AgileConfig.Server.Apisite.Models; |
9 | 5 | using AgileConfig.Server.Apisite.Models.Mapping; |
| 6 | +using AgileConfig.Server.Common; |
10 | 7 | using AgileConfig.Server.Data.Entity; |
11 | 8 | using AgileConfig.Server.IService; |
12 | 9 | using Microsoft.AspNetCore.Http; |
13 | 10 | using Microsoft.AspNetCore.Mvc; |
14 | 11 | using Microsoft.Extensions.Caching.Memory; |
| 12 | +using System; |
| 13 | +using System.Collections.Generic; |
| 14 | +using System.Linq; |
| 15 | +using System.Threading.Tasks; |
15 | 16 |
|
16 | 17 | // For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 |
17 | 18 |
|
@@ -54,6 +55,14 @@ public async Task<ActionResult<List<ApiConfigVM>>> GetAppConfig(string appId, [F |
54 | 55 | { |
55 | 56 | ArgumentException.ThrowIfNullOrEmpty(appId); |
56 | 57 |
|
| 58 | + var idInHeader = Encrypt.UnboxBasicAuth(HttpContext.Request).Item1; |
| 59 | + |
| 60 | + if (appId != idInHeader) |
| 61 | + { |
| 62 | + await Response.WriteAsync("The AppId does not match the ID in Basic Authentication."); |
| 63 | + return BadRequest(); |
| 64 | + } |
| 65 | + |
57 | 66 | var app = await _appService.GetAsync(appId); |
58 | 67 | if (!app.Enabled) return NotFound(); |
59 | 68 |
|
|
0 commit comments