@ -27,6 +27,7 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Hosting ;
using Microsoft.AspNetCore.Hosting ;
using Microsoft.Extensions.Hosting ;
using Microsoft.Extensions.Hosting ;
using Microsoft.AspNetCore.Http ;
using Microsoft.AspNetCore.Http ;
using Microsoft.AspNetCore.Authentication.JwtBearer ;
namespace IO.Swagger.Controllers
namespace IO.Swagger.Controllers
{
{
@ -59,7 +60,7 @@ namespace IO.Swagger.Controllers
/// <response code="500">Une erreur est survenue sur le serveur</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpPost]
[HttpPost]
[Route("/api/formations")]
[Route("/api/formations")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName )]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH" )]
[ValidateModelState]
[ValidateModelState]
[SwaggerOperation("AddFormation")]
[SwaggerOperation("AddFormation")]
[SwaggerResponse(statusCode: 201, type: typeof(FormationDTO), description: "Formation créée avec succès")]
[SwaggerResponse(statusCode: 201, type: typeof(FormationDTO), description: "Formation créée avec succès")]
@ -132,7 +133,7 @@ namespace IO.Swagger.Controllers
/// <response code="500">Une erreur est survenue sur le serveur</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpDelete]
[HttpDelete]
[Route("/api/formations/{idFormation}")]
[Route("/api/formations/{idFormation}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName )]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH" )]
[ValidateModelState]
[ValidateModelState]
[SwaggerOperation("DeleteFormation")]
[SwaggerOperation("DeleteFormation")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L'utilisateur souhaitant accéder à la ressource n'est pas authentifié")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L'utilisateur souhaitant accéder à la ressource n'est pas authentifié")]
@ -216,7 +217,7 @@ namespace IO.Swagger.Controllers
/// <response code="500">Une erreur est survenue sur le serveur</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[HttpGet]
[Route("/api/formations/{idFormation}")]
[Route("/api/formations/{idFormation}")]
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName )]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH" )]
[ValidateModelState]
[ValidateModelState]
[SwaggerOperation("GetFormationById")]
[SwaggerOperation("GetFormationById")]
[SwaggerResponse(statusCode: 200, type: typeof(FormationDTO), description: "OK")]
[SwaggerResponse(statusCode: 200, type: typeof(FormationDTO), description: "OK")]
@ -286,7 +287,7 @@ namespace IO.Swagger.Controllers
/// <response code="500">Une erreur est survenue sur le serveur</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[HttpGet]
[Route("/api/formations")]
[Route("/api/formations")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName )]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH" )]
[ValidateModelState]
[ValidateModelState]
[SwaggerOperation("GetFormations")]
[SwaggerOperation("GetFormations")]
[SwaggerResponse(statusCode: 200, type: typeof(List<FormationDetailsDTO>), description: "OK")]
[SwaggerResponse(statusCode: 200, type: typeof(List<FormationDetailsDTO>), description: "OK")]
@ -342,7 +343,7 @@ namespace IO.Swagger.Controllers
/// <response code="500">Une erreur est survenue sur le serveur</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[HttpGet]
[Route("/api/formations/count")]
[Route("/api/formations/count")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName )]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH" )]
[ValidateModelState]
[ValidateModelState]
[SwaggerOperation("GetFormationsCount")]
[SwaggerOperation("GetFormationsCount")]
[SwaggerResponse(statusCode: 200, type: typeof(long?), description: "OK")]
[SwaggerResponse(statusCode: 200, type: typeof(long?), description: "OK")]
@ -390,7 +391,7 @@ namespace IO.Swagger.Controllers
/// <response code="500">Une erreur est survenue sur le serveur</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[HttpGet]
[Route("/api/modesformation")]
[Route("/api/modesformation")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName )]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH" )]
[ValidateModelState]
[ValidateModelState]
[SwaggerOperation("GetModesFormation")]
[SwaggerOperation("GetModesFormation")]
[SwaggerResponse(statusCode: 200, type: typeof(List<ModeFormationDTO>), description: "OK")]
[SwaggerResponse(statusCode: 200, type: typeof(List<ModeFormationDTO>), description: "OK")]
@ -437,7 +438,7 @@ namespace IO.Swagger.Controllers
/// <response code="500">Une erreur est survenue sur le serveur</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[HttpGet]
[Route("/api/originesformation")]
[Route("/api/originesformation")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName )]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH" )]
[ValidateModelState]
[ValidateModelState]
[SwaggerOperation("GetOriginesFormation")]
[SwaggerOperation("GetOriginesFormation")]
[SwaggerResponse(statusCode: 200, type: typeof(List<OrigineFormationDTO>), description: "OK")]
[SwaggerResponse(statusCode: 200, type: typeof(List<OrigineFormationDTO>), description: "OK")]
@ -484,7 +485,7 @@ namespace IO.Swagger.Controllers
/// <response code="500">Une erreur est survenue sur le serveur</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[HttpGet]
[Route("/api/statutsformation")]
[Route("/api/statutsformation")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName )]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH" )]
[ValidateModelState]
[ValidateModelState]
[SwaggerOperation("GetStatutsFormation")]
[SwaggerOperation("GetStatutsFormation")]
[SwaggerResponse(statusCode: 200, type: typeof(List<StatutFormationDTO>), description: "OK")]
[SwaggerResponse(statusCode: 200, type: typeof(List<StatutFormationDTO>), description: "OK")]
@ -531,7 +532,7 @@ namespace IO.Swagger.Controllers
/// <response code="500">Une erreur est survenue sur le serveur</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[HttpGet]
[Route("/api/typesformation")]
[Route("/api/typesformation")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName )]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH" )]
[ValidateModelState]
[ValidateModelState]
[SwaggerOperation("GetTypesFormation")]
[SwaggerOperation("GetTypesFormation")]
[SwaggerResponse(statusCode: 200, type: typeof(List<TypeFormationDTO>), description: "OK")]
[SwaggerResponse(statusCode: 200, type: typeof(List<TypeFormationDTO>), description: "OK")]
@ -582,7 +583,7 @@ namespace IO.Swagger.Controllers
/// <response code="500">Une erreur est survenue sur le serveur</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpPut]
[HttpPut]
[Route("/api/formations/{idFormation}")]
[Route("/api/formations/{idFormation}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName )]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH" )]
[ValidateModelState]
[ValidateModelState]
[SwaggerOperation("UpdateFormation")]
[SwaggerOperation("UpdateFormation")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L'utilisateur souhaitant accéder à la ressource n'est pas authentifié")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L'utilisateur souhaitant accéder à la ressource n'est pas authentifié")]