-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLegacyFileController.cs
140 lines (130 loc) · 5.15 KB
/
LegacyFileController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
using Altinn.Broker.Application.ConfirmDownloadCommand;
using Altinn.Broker.Application.DownloadFileQuery;
using Altinn.Broker.Application.GetFileDetailsQuery;
using Altinn.Broker.Application.GetFileOverviewQuery;
using Altinn.Broker.Application.GetFilesQuery;
using Altinn.Broker.Application.InitializeFileCommand;
using Altinn.Broker.Application.UploadFileCommand;
using Altinn.Broker.Core.Domain.Enums;
using Altinn.Broker.Core.Models;
using Altinn.Broker.Enums;
using Altinn.Broker.Helpers;
using Altinn.Broker.Mappers;
using Altinn.Broker.Middlewares;
using Altinn.Broker.Models;
using Altinn.Broker.Models.Maskinporten;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Infrastructure;
namespace Altinn.Broker.Controllers
{
/// <summary>
/// The LegacyFileController allows integration from the Altinn 2 BrokerBridge component to allow legacy users access to Altinn 3 Broker
/// </summary>
[ApiController]
[Route("broker/api/legacy/v1/file")]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
[Authorize(Policy = "Legacy")]
public class LegacyFileController : Controller
{
private readonly ILogger<LegacyFileController> _logger;
private readonly ProblemDetailsFactory _problemDetailsFactory;
public LegacyFileController(ILogger<LegacyFileController> logger, ProblemDetailsFactory problemDetailsFactory)
{
_logger = logger;
_problemDetailsFactory = problemDetailsFactory;
}
/// <summary>
/// Initialize a file upload
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<ActionResult<Guid>> InitializeFile(FileInitalizeExt initializeExt, [ModelBinder(typeof(MaskinportenModelBinder))] MaskinportenToken token, [FromServices] InitializeFileCommandHandler handler)
{
throw new NotImplementedException();
}
/// <summary>
/// Upload to an initialized file using a binary stream.
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("{fileId}/upload")]
[Consumes("application/octet-stream")]
public async Task<ActionResult> UploadFileStreamed(
Guid fileId,
[ModelBinder(typeof(MaskinportenModelBinder))] MaskinportenToken token,
[FromServices] UploadFileCommandHandler handler
)
{
throw new NotImplementedException();
}
/// <summary>
/// Get information about the file and its current status
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("{fileId}")]
public async Task<ActionResult<FileOverviewExt>> GetFileOverview(
Guid fileId,
[ModelBinder(typeof(MaskinportenModelBinder))] MaskinportenToken token,
[FromServices] GetFileOverviewQueryHandler handler)
{
throw new NotImplementedException();
}
/// <summary>
/// Get more detailed information about the file upload for auditing and troubleshooting purposes
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("{fileId}/details")]
public async Task<ActionResult<FileStatusDetailsExt>> GetFileDetails(
Guid fileId,
[ModelBinder(typeof(MaskinportenModelBinder))] MaskinportenToken token,
[FromServices] GetFileDetailsQueryHandler handler)
{
throw new NotImplementedException();
}
/// <summary>
/// Get files that can be accessed by the caller according to specified filters.
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<ActionResult<List<Guid>>> GetFiles(
[FromQuery] FileStatusExt? status,
[FromQuery] RecipientFileStatusExt? recipientStatus,
[FromQuery] DateTimeOffset? from,
[FromQuery] DateTimeOffset? to,
[ModelBinder(typeof(MaskinportenModelBinder))] MaskinportenToken token,
[FromServices] GetFilesQueryHandler handler)
{
throw new NotImplementedException();
}
/// <summary>
/// Downloads the file
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("{fileId}/download")]
public async Task<ActionResult> DownloadFile(
Guid fileId,
[ModelBinder(typeof(MaskinportenModelBinder))] MaskinportenToken token,
[FromServices] DownloadFileQueryHandler handler)
{
throw new NotImplementedException();
}
/// <summary>
/// Confirms that the file has been downloaded
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("{fileId}/confirmdownload")]
public async Task<ActionResult> ConfirmDownload(
Guid fileId,
[ModelBinder(typeof(MaskinportenModelBinder))] MaskinportenToken token,
[FromServices] ConfirmDownloadCommandHandler handler)
{
throw new NotImplementedException();
}
}
}