diegimas
Įdiekite tiesiogiai iš „Nuget“
Galite įdiegti tiesiogiai iš „Nuget“ naudodami šią komandą:
Install-Package IdentityServer4 -Version 4.0.4
Įdiegti „IdentityServer4“ šablonus
dotnet new -i IdentityServer4.Templates
Pridėkite „Quickui“ failus ir ASP.NET tapatybę (pasirenkama)
dotnet new is4aspid --force
Atnaujinti „ConfigureServices“ () metodą „Startup.cs“, kaip nurodyta toliau:
services.AddControllersWithViews();
Taip pat atnaujinkite „Configure ()“ metodą „Startup.cs“:
app.UseRouting();
app.UseIdentityServer();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
Sukurkite ir vykdykite projektą Naršykite „/.well-žinoma/openid-configuration“, kad įsitikintumėte, jog „Discovery Endpoints“ veikia ir veikia.
Bėgimas Docker
- Sukurkite tuščią ASP.NET pagrindinį projektą (patikrinkite „Įgalinti„ Docker “palaikymą“)
- Įsitikinkite, kad projekto failas nukreiptas į „Linux OS Linux“
- Pakeiskite „Docker“ failą, kaip nurodyta toliau:
FROM microsoft/dotnet:2.2-runtime AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM microsoft/dotnet:2.2-sdk AS build
WORKDIR /src
COPY \[“JrTech.Identity.Web/JrTech.Identity.Web.csproj“, “JrTech.Identity.Web/”\]
RUN dotnet restore “JrTech.Identity.Web/JrTech.Identity.Web.csproj“
COPY . .
WORKDIR “/src/JrTech.Identity.Web”
RUN dotnet build “JrTech.Identity.Web.csproj” -c Release -o /app
FROM build AS publish
RUN dotnet publish “JrTech.Identity.Web.csproj” -c Release -o /app
FROM base AS final
WORKDIR /app
COPY –from=publish /app .
ENTRYPOINT \[“dotnet”, “JrTech.Identity.Web.dll”\]
- Pridėkite „IdentityServer 4“, paleisdami šią komandą:
dotnet add package IdentityServer4