This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
const string corsUrlKey = "Security:Cors:Url"; | |
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); | |
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) | |
.AddJwtBearer(options => | |
{ | |
options.SaveToken = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) | |
.AddJwtBearer(options => | |
{ | |
options.SaveToken = true; | |
options.TokenValidationParameters = new TokenValidationParameters() | |
{ | |
ValidateIssuer = true, | |
ValidateAudience = true, | |
ValidateLifetime = true, | |
ValidateIssuerSigningKey = true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Controller to log, create user | |
/// </summary> | |
[Authorize] | |
[Route("api/[Controller]")] | |
[ApiController] | |
public class UserController : ControllerBase | |
{ | |
#region Fields | |
private IConfiguration _configuration = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE [dbo].[Droide]( | |
[Id] [int] IDENTITY(1,1) NOT NULL, | |
[Matricule] [varchar](250) NOT NULL, | |
CONSTRAINT [PK_Droide] PRIMARY KEY CLUSTERED | |
( | |
[Id] ASC | |
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] | |
) ON [PRIMARY] | |
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE [JeuDontOnEstLeHeros.database.dev] | |
GO | |
DECLARE @PARAGRAPHE_IDs TABLE(ID INT); | |
DECLARE @QUESTION_IDs TABLE(ID INT); | |
INSERT [dbo].[Paragraphe] | |
OUTPUT inserted.ID INTO @PARAGRAPHE_IDs(ID) | |
SELECT 1, | |
'Un début intriguant', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DefaultIntegrationTest : IClassFixture<WebApplicationFactory<Startup>> | |
{ | |
#region Fields | |
private WebApplicationFactory<Startup> _factory = null; | |
#endregion | |
#region Constructors | |
public DefaultIntegrationTest(WebApplicationFactory<Startup> factory) => this._factory = factory; | |
#endregion | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BookMyCourses.API.Web.UI; | |
using BookMyCourses.API.Web.UI.Models; | |
using Microsoft.AspNetCore.Mvc.Testing; | |
using System; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
using Xunit; | |
namespace Tests.Integrations | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UserDataLayer | |
{ | |
#region Fields | |
private SignInManager<User> _signInManager = null; | |
#endregion | |
#region Constructors | |
public UserDataLayer(DefaultContext context, SignInManager<User> signInManager) : base(context) | |
{ | |
this._signInManager = signInManager; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BookMyCourses.API.Core.Models; | |
using Microsoft.AspNetCore.Authentication; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.AspNetCore.Identity; | |
using Microsoft.Extensions.Logging; | |
using Microsoft.Extensions.Options; | |
using Moq; | |
using System; | |
using System.Collections.Generic; | |
using System.Text; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BookMyCourses.API.Core.DataLayers.Database; | |
using BookMyCourses.API.Core.Interfaces.Models; | |
using BookMyCourses.API.Core.Models; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.AspNetCore.Identity; | |
using Microsoft.EntityFrameworkCore; | |
using Microsoft.Extensions.Options; | |
using Moq; | |
using System; | |
using System.Collections.Generic; |