Skip to content

Instantly share code, notes, and snippets.

View mehmetalierol's full-sized avatar
🥑
Learning

Mehmet Ali EROL mehmetalierol

🥑
Learning
View GitHub Profile
using Application.Domain.Concrete;
using Application.Domain.Concrete.Directions;
using System;
using System.Linq;
using Xunit;
namespace Application.Tests.Domain
{
public class NasaRoverTests
{
[Authorize(Roles = "Admin", AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
#region JwtTokenSection
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
services.AddAuthentication()
.AddJwtBearer(cfg =>
{
cfg.RequireHttpsMetadata = false;
cfg.SaveToken = true;
cfg.TokenValidationParameters = new TokenValidationParameters
{
"ConnectionStrings": {
//"DefaultConnection": "Server=LAPTOP-TB0R0HIF\\SQLEXPRESS;Database=ApplicationDB;Trusted_Connection=True;MultipleActiveResultSets=true"
"DefaultConnection": "Server=DESKTOP-K8FNOCF\\SQLEXPRESS;Database=ApplicationDB;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"Tokens": {
"Key": "43C8E1117FE618591B25199BDF6FBTT",
"Issuer": "http://localhost:61025/"
},
"Logging": {
using Company.Application.Dto;
namespace Company.Application.WebApi.VM
{
/// <summary>
/// Kullanıcıya geri döneceğimiz token bilgilerini taşıyacak
/// </summary>
public class TokenModel
{
/// <summary>
using System.ComponentModel.DataAnnotations;
namespace Company.Application.WebApi.VM
{
/// <summary>
/// Login için kullanıcıdan istenen bilgileri taşır
/// </summary>
public class LoginModel
{
/// <summary>
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Routing;
using System;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Authorization;
using Company.Application.Common.Api;
using System.Threading.Tasks;
using Company.Application.WebApi.VM;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Company.Application.Common.Api;
using Company.Application.WebApi.VM;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
namespace Company.Application.WebApi.Interfaces
{
public interface ITokenController
{
Task<ApiResult> LoginAsync([FromBody] LoginModel loginModel);
using Company.Application.Common.Api;
using Company.Application.Common.Api.Base;
using Company.Application.Data.Entities;
using Company.Application.Dto;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
using System;
using Microsoft.Extensions.DependencyInjection;
using System.Collections.Generic;
using Microsoft.AspNetCore.Http;
using AutoMapper;
using Company.Application.Common.Paging;
using Company.Application.Common.Paging.Interface;
using Company.Application.Common.UnitofWork;
using Company.Application.Data.Context;
using Company.Application.Data.Entities;
using Company.Application.WebApi.Controllers;
using Company.Application.WebApi.Interfaces;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;