I hereby claim:
- I am lugrugzo on github.
- I am ozgur (https://keybase.io/ozgur) on keybase.
- I have a public key ASAnJvaV_mB0CO6vKWcGA1oJUxE2iwUphWQ0jVIpSiCXgAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| <Project Sdk="Microsoft.NET.Sdk.Web"> | |
| <PropertyGroup> | |
| <TargetFramework>netcoreapp2.0</TargetFramework> | |
| <UserSecretsId>aspnet-WebApiJwt-9EB56A08-D5EE-4EEF-B339-DEE0A5CA6277</UserSecretsId> | |
| </PropertyGroup> | |
| <ItemGroup> | |
| <Folder Include="wwwroot\" /> | |
| </ItemGroup> | |
| <ItemGroup> | |
| <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" /> |
| namespace WebApiJwt.Entities | |
| { | |
| public class ApplicationDbContext : IdentityDbContext | |
| { | |
| protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | |
| { | |
| optionsBuilder.UseMySql(GetConnectionString()); | |
| } | |
| private static string GetConnectionString() |
| using System; | |
| using System.Collections.Generic; | |
| using System.IdentityModel.Tokens.Jwt; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| using Microsoft.AspNetCore.Authentication.JwtBearer; | |
| using Microsoft.AspNetCore.Builder; | |
| using Microsoft.AspNetCore.Hosting; | |
| using Microsoft.AspNetCore.Identity; |
| using System; | |
| using System.Collections.Generic; | |
| using System.IdentityModel.Tokens.Jwt; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| using Microsoft.AspNetCore.Authentication.JwtBearer; | |
| using Microsoft.AspNetCore.Builder; | |
| using Microsoft.AspNetCore.Hosting; | |
| using Microsoft.AspNetCore.Identity; |
| using System; | |
| using System.Collections.Generic; | |
| using System.ComponentModel.DataAnnotations; | |
| using System.IdentityModel.Tokens.Jwt; | |
| using System.Linq; | |
| using System.Security.Claims; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| using Microsoft.AspNetCore.Identity; | |
| using Microsoft.AspNetCore.Mvc; |
| curl -X POST \ | |
| http://localhost:5000/Account/Register \ | |
| -H 'cache-control: no-cache' \ | |
| -H 'content-type: application/json' \ | |
| -d '{ | |
| "Email": "me@ozgur.dk", | |
| "Password": "SomeSecurePassword123!" | |
| }' |
| curl -X GET \ | |
| http://localhost:5000/Account/Protected \ | |
| -H 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJtZUBvemd1ci5kayIsImp0aSI6ImMwMTgxMmQ4LTI3MjktNGJhYS04YWQwLTk1ZTI4YjgzNzc1NCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWVpZGVudGlmaWVyIjoiZDc2MTRiNzEtN2MyOS00OTk3LTlmODUtNDNkYzlmMDI2NzZlIiwiZXhwIjoxNTExNDIwNTQ3LCJpc3MiOiJodHRwOi8veW91cmRvbWFpbi5jb20iLCJhdWQiOiJodHRwOi8veW91cmRvbWFpbi5jb20ifQ.v8YLTMTUraD7KqoHTskvcg9X_zH5WdWkcpGuHHeqYKM' \ | |
| -H 'cache-control: no-cache' \ | |
| -H 'content-type: application/json' |
| <Project Sdk="Microsoft.NET.Sdk.Web"> | |
| <PropertyGroup> | |
| <TargetFramework>netcoreapp2.0</TargetFramework> | |
| </PropertyGroup> | |
| <ItemGroup> | |
| <Folder Include="wwwroot\" /> | |
| </ItemGroup> |
| using Microsoft.EntityFrameworkCore; | |
| namespace SimpleCrudApi.Entities | |
| { | |
| public class ApplicationDbContext : DbContext | |
| { | |
| public DbSet<User> Users { get; set; } | |
| public DbSet<Announcement> Announcements { get; set; } | |
| protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) |