EntegratorPro.Identity 1.0.2

dotnet add package EntegratorPro.Identity --version 1.0.2                
NuGet\Install-Package EntegratorPro.Identity -Version 1.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EntegratorPro.Identity" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EntegratorPro.Identity --version 1.0.2                
#r "nuget: EntegratorPro.Identity, 1.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EntegratorPro.Identity as a Cake Addin
#addin nuget:?package=EntegratorPro.Identity&version=1.0.2

// Install EntegratorPro.Identity as a Cake Tool
#tool nuget:?package=EntegratorPro.Identity&version=1.0.2                

EntegratorPro.Identity

Bu proje, ASP.NET Core uygulamaları için JWT (JSON Web Token) tabanlı kimlik doğrulama ve kullanıcı yönetimi sağlayan bir kütüphane sunar.

Özellikler

  • JWT Desteği: JSON Web Token oluşturma ve doğrulama.
  • ClaimsPrincipal Genişletmeleri: Kullanıcı ve şirket bilgilerini kolayca erişilebilir hale getirir.
  • Kullanıcı Servisleri: Kullanıcı oturum bilgilerini yöneten servisler.
  • Esnek Yapı: Dependency Injection (DI) ile kolay entegrasyon.

Kurulum

  1. Projenize EntegratorPro.Identity kütüphanesini ekleyin.
  2. Gerekli servisleri Startup.cs veya Program.cs dosyasına entegre edin.

Örnek Servis Ekleme:

public void ConfigureServices(IServiceCollection services)
{
    services.AddJwtService(new JwtOption(
        audience: "your-audience",
        issuer: "your-issuer",
        accessTokenExpiration: 30,
        securityKey: "your-security-key"));

    services.AddUserService();
}

Bileşenler

1. JWT Servisi (JwtService)

Bu servis, kullanıcı ve şirket bilgilerini kullanarak JWT oluşturur.

Yöntemler:
  • Token Create<TKey, TCompanyKey>(TKey id, TCompanyKey companyId, string companyName, string fullName, string uniqueId)
  • Token Create<TKey, TCompanyKey>(TKey id, TCompanyKey companyId, List<Claim> claims)
Örnek Kullanım:
var token = jwtService.Create(
    id: userId,
    companyId: companyId,
    companyName: "Example Company",
    fullName: "John Doe",
    uniqueId: "12345"
);

2. Kullanıcı Servisi (UserService)

Kullanıcının oturum bilgilerine kolay erişim sağlar.

Özellikler:
  • Id: Kullanıcı kimliği.
  • CompanyId: Şirket kimliği.
  • CompanyName: Şirket adı.
  • FullName: Kullanıcının tam adı.
  • IsAuthenticated: Kullanıcının oturum açma durumu.
  • GetClaimValue(string claimName): Belirtilen claim'in değerini alır.
Örnek Kullanım:
var userId = userService.Id;
var companyName = userService.CompanyName;
var isAuthenticated = userService.IsAuthenticated;

3. ClaimsPrincipal Extensions

Kullanıcı bilgilerinin ClaimsPrincipal üzerinden kolayca erişilmesini sağlayan metotlar.

Sağlanan Metotlar:
  • Id<TKey>()
  • CompanyId<TCompanyKey>()
  • CompanyName()
  • FullName()
  • UniqueId()
  • GetClaim(string claimName)
Örnek Kullanım:
var userId = HttpContext.User.Id<Guid>();
var companyName = HttpContext.User.CompanyName();

4. ServiceCollectionExtensions

Projeye JWT ve Kullanıcı Servislerini kolayca eklemek için kullanılan genişletme metotları.

Kullanım:

JWT Servisini Eklemek

services.AddJwtService(new JwtOption(
    audience: "your-audience",
    issuer: "your-issuer",
    accessTokenExpiration: 30,
    securityKey: "your-security-key"));

Kullanıcı Servisini Eklemek

services.AddUserService();

5. Token Sınıfı

JWT ve yenileme tokenlarını temsil eden sınıf.

Özellikler:
  • AccessToken: JWT token.
  • RefreshToken: Yenileme (refresh) token.
  • Expired: Token süresinin dolum tarihi.

JWT Ayarları

JwtOption sınıfı, JWT yapılandırması için kullanılır.

Örnek Ayar:
var jwtOption = new JwtOption(
    audience: "your-audience",
    issuer: "your-issuer",
    accessTokenExpiration: 30, // Dakika cinsinden
    securityKey: "your-security-key"
);

Gereksinimler

  • .NET 6 veya daha üstü
  • Microsoft.IdentityModel.Tokens paketi

Lisans

Bu proje açık kaynaklıdır ve özgürce kullanılabilir.


Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 293 2/23/2025
1.0.1 78 2/23/2025