View JwtToken
#region JwtTokenSection | |
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear(); | |
services.AddAuthentication() | |
.AddJwtBearer(cfg => | |
{ | |
cfg.RequireHttpsMetadata = false; | |
cfg.SaveToken = true; | |
cfg.TokenValidationParameters = new TokenValidationParameters |
View appsettings.json(V3)
{ | |
"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": { |
View Company.Application.WebApi.VM.TokenModel.cs
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> |
View Company.Application.WebApi.VM.LoginModel.cs
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> |
View Company.Application.WebApi.Controllers.TokenController.cs
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; |
View Company.Application.WebApi.Interfaces.ITokenController.cs
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); |
View AppResourceController(ver2)
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; |
View Startup(ver3)
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; |
View CustomerController(ver2)
using Company.Application.Common.Api; | |
using Company.Application.Common.Api.Base; | |
using Company.Application.Data.Entities; | |
using Company.Application.Dto; | |
using System; | |
using Microsoft.EntityFrameworkCore; | |
using System.Linq; | |
using AutoMapper; | |
using Microsoft.AspNetCore.Http; | |
using System.Collections.Generic; |
NewerOlder