AspNetCore.Authentication.Static
v1.0.1
이 repo에는 Proge-Software의 ASP.NET Core 용 보안 및 인증 정적 미들웨어가 포함되어 있습니다.
탐색 적 또는 자동 통합 테스트를 수행하든 ASP.NET Core 응용 프로그램의 인증을 테스트하는 것은 복잡하고 비효율적 일 수 있습니다.
Active Directory에서 전용 계정을 설정하고 로그인 프로세스를 거쳐 쿠키가 항상 같은 방식으로 재생되는지 확인해야 할 수도 있습니다.
AspnetCore.authentication.Static은 응용 프로그램을 테스트 할 때 인증을 단순화하는 것을 목표로하는 ASP.NET Core의 무자비한 미들웨어입니다.
응용 프로그램의 구성 파일에서 사용자를 정의하고 쿼리 문자열, 헤더 또는 환경 변수를 사용하여 이들 사이를 전환 할 수 있습니다.
그렇게 간단합니다.
패키지 관리자를 사용하여 Nuget 패키지를 설치하십시오.
Install-Package ProgeSoftware.AspNetCore.Authentication.Static
또는 .NET CLI :
dotnet add package ProgeSoftware.AspNetCore.Authentication.Static
Startup.cs 파일의 ConfigureServices 메소드에 미들웨어를 추가하십시오.
services
. AddAuthentication ( StaticAuthenticationDefaults . AuthenticationScheme )
. AddStatic ( options =>
{
Configuration . GetSection ( "StaticAuthentication" ) . Bind ( options ) ;
} ) ; appsettings.json 파일에서 구성합니다 (사용자 비밀을 사용하여 더 잘 수행해야 함) :
{
"StaticAuthentication" : {
"Identities" : {
"User" : {
"AuthenticationType" : " Custom " ,
"NameIdentifier" : " bt8rcnk3z7nhwb7e " ,
"Name" : " Giorgio Di Nardo " ,
"Claims" : [
{
"Type" : " http://schemas.microsoft.com/ws/2008/06/identity/claims/role " ,
"Value" : " User "
}
]
}
}
}달리다!

사용 방법에 대한 자세한 내용은 샘플을 살펴볼 수 있습니다.