Kurulum
Doğrudan Nuget’ten Yükle
Aşağıdaki komutu kullanarak doğrudan NuGet’ten yükleyebilirsiniz:
Install-Package IdentityServer4 -Version 4.0.4
IdentityServer4 şablonlarını yükleyin
dotnet new -i IdentityServer4.Templates
Quickui Dosyaları ve ASP.NET Kimlik (İsteğe Bağlı) ekleyin
dotnet new is4aspid --force
Startup.cs içindeki configureServices () yöntemini aşağıdaki gibi güncelle:
services.AddControllersWithViews();
Ayrıca startup.cs’deki configure () yöntemini güncelle:
app.UseRouting();
app.UseIdentityServer();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
Projeyi oluşturun ve çalıştırın Discovery uç noktalarının çalışır durumda olduğundan emin olmak için “/.well-bewn/openid-configuration” göz atın.
Docker’da çalışıyor
- Boş bir ASP.NET Çekirdek Projesi Oluşturun (‘Docker desteğini etkinleştir”)
- Proje dosyasının Linux OS Linux’u hedeflediğinden emin olun
- Docker dosyasını aşağıdaki gibi değiştirin:
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”\]
- Aşağıdaki komutu çalıştırarak IdentityServer 4 ekleyin:
dotnet add package IdentityServer4