import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import fs from 'fs';
export default defineConfig({
plugins: [sveltekit()],
server: {
https: {
key: fs.readFileSync(`${__dirname}/privkey.pem`),
cert: fs.readFileSync(`${__dirname}/fullchain.pem`)
}
}
});
FROM node:latest
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm ci
COPY . ./
RUN npm run build
EXPOSE 8081
EXPOSE 444
CMD ["npm", "run", "preview"]
Вот мой Dockerfile <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>59bf8b10-c960-44c6-8764-2753f8df9967</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BCrypt.Net" Version="0.1.0" />
<PackageReference Include="dotenv.net" Version="3.1.2" />
<PackageReference Include="DotNetEnv" Version="2.5.0" />
<PackageReference Include="Facebook" Version="7.0.6" />
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.3.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="7.0.10" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.10" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.32.3" />
<PackageReference Include="System.Runtime.Caching" Version="7.0.0" />
</ItemGroup>
</Project>
. Структура: string token = HttpContext.Request.Headers["Authorization"].FirstOrDefault()?.Replace("Bearer ", "");
Токен в лог выводится, а вот username, которое я добавлял в Claim, а claims в токен при генерации, равно nullList<Claim> claims = new() {
new Claim(ClaimTypes.Name, username)
};
То есть получается программа не может из токена вытащить даже username, но я не могу понять почему