Identity Server 4

닷넷디벨·2023년 8월 2일
0

Identity Server4는 Open을 사용하는 오픈 소스 인증 공급자
.ID 연결 및 ASP용 OAuth 2.0 프레임워크.NET 코어.중앙 집중식 인증 공급자 또는 STS(보안 토큰 서버) 역할을 합니다.API/마이크로서비스 애플리케이션이 여러 개인 경우 계층을 통과하는 것이 이상적이며, 각 애플리케이션에서 인증을 정의할 필요가 없도록 인증을 처리할 단일 보안 토큰 서버가 있어야 합니다.

Install-Package IdentityServer4

1) Test 사용자

 new TestUser
        {
            SubjectId = "123",
            Username = "Gowtham",
            Password = "Test@123",
            Claims =
            {
                new Claim(JwtClaimTypes.Name, "Gowtham K"),
                new Claim(JwtClaimTypes.GivenName, "Gowtham"),
                new Claim(JwtClaimTypes.FamilyName, "Kumar"),
                new Claim(JwtClaimTypes.WebSite, "https://gowthamcbe.com/"),
            }
        }

2) 아이덴티티 Resource

new IdentityResource[]
    {
        new IdentityResources.OpenId(),
        new IdentityResources.Profile(),
    };

3) API SCOPE

        new ApiScope("api.read"),
        new ApiScope("api.write"),

4) API Resource

 Scopes = new List<string>{ "Api.read","Api.write" },
            ApiSecrets = new List<Secret>{ new Secret("secret".Sha256()) }
profile
hardcore developer

1개의 댓글

comment-user-thumbnail
2023년 8월 2일

좋은 정보 감사합니다

답글 달기