2016-09-09 3 views
4

ADAL.Net 3.x에서 UserPasswordCredential은 2.x에서 UserCredential 위에 도입되었습니다. 그러나 동일한 UserPasswordCredential은 .Net Core에서 동일한 Nuget 패키지로 노출되지 않습니다.ADAL .Net Core nuget 패키지는 UserPasswordCredential을 지원하지 않습니다.

UserCredential 클래스 된 UserPasswordCredential 이후

namespace Microsoft.IdentityModel.Clients.ActiveDirectory 
{ 
    // 
    // Summary: 
    //  Credential used for integrated authentication on domain-joined machines. 
    public class UserCredential 
    { 
     // 
     // Summary: 
     //  Constructor to create user credential. Using this constructor would imply integrated 
     //  authentication with logged in user and it can only be used in domain joined scenarios. 
     public UserCredential(); 
     // 
     // Summary: 
     //  Constructor to create credential with client id and secret 
     // 
     // Parameters: 
     // userName: 
     //  Identifier of the user application requests token on behalf. 
     public UserCredential(string userName); 

     // 
     // Summary: 
     //  Gets identifier of the user. 
     public string UserName { get; } 
    } 
} 

가 .NetCore에서 사용할 수 없습니다 및 UserCredential 방법에 입력 한 사용자의 암호를하고 닷넷 핵심 코드 아래에 구현하는 하나의 매개 변수의 이름을, 소요 단 하나의 등록 사용자 이름을 가지고 ?

authContext.AcquireTokenAsync(WebAPIResourceId, ClientId, userPasswordCredential); 

나는 닷넷 코어 1.0 버전 3.13.4 버전 특히 ADAL를 사용하지하고

+0

가능한 중복 http://stackoverflow.com/questions/37465949/adal-net-v3-does -not-support-acquiretoken-with-usercredential) – blowdart

+0

동일한 패키지 및 동일한 버전으로 .NET Core에서 UserPasswordCredential을 사용할 수 없습니다. – racha

답변

3

당신이 올바른지, .NET 코어에 대한 UserPasswordCredentialis not availableUserCredential가 더 이상 사용자 이름과 암호를 사용할 수 있습니다. 즉, ADAL v3은 .NET 코어에서 사용자 이름/암호 흐름을 지원하지 않습니다.

+1

그리고 버그로 인해 주석이 닫힙니다. [ "설계 상 지원되지 않습니다."] (https : // github .com/AzureAD/azure-activedirectory-library-for-dotnet/issues/482) –

4

Azure AD에 대한 액세스 토큰을 얻기 위해 리소스 소유자 암호 자격 부여 흐름을 사용하려면 HttpClient를 사용하여 http 요청을 diectly 호출 할 수 있습니다. 여기 참조에 대한 예는 다음과 같습니다

[? UserCredential와 AcquireToken을 지원하지 않습니다 ADAL.NET v3의 (의
+0

client_secret도 필요합니다. –

+0

응용 프로그램의 유형에 따라 다릅니다. 이 시나리오에서는 웹 응용 프로그램에 client_secret이 필요합니다. –

+0

고챠, 고마워. 또한 모든 값이 본문에 URI로 인코딩되어야한다는 점에 유의할 가치가 있습니다. –

관련 문제