我正在尝试在多租户Web应用程序中使用Azure AD App使用RemoveProtection
。我不知道如何。我当前的设置是:
在IAuthDelegate
AuthenticationContext authContext = new AuthenticationContext(authority, tokenCache);
AuthenticationResult result;
var clientCred = new ClientCredential(appInfo.ApplicationId, clientSecret);
result = authContext.AcquireTokenAsync(resource, clientCred).Result;
return result.AccessToken;`
主控制器中的代码
string name = User.Identity.Name;
// Set path to bins folder.
var path = Path.Combine(
Directory.GetParent(Path.GetDirectoryName(new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath)).FullName,
Environment.Is64BitProcess ? "bin\\x64" : "bin\\x86");
MIP.Initialize(MipComponent.File, path);
ApplicationInfo appInfo = new ApplicationInfo()
{
ApplicationId = clientId,
ApplicationName = appName,
ApplicationVersion = appVersion
};
AuthDelegateImplementation authDelegate = new AuthDelegateImplementation(appInfo);
var profileSettings = new FileProfileSettings(mipPath, false, authDelegate, new ConsentDelegateImplementation(), appInfo, LogLevel.Trace);
var fileProfile = Task.Run(async () => await MIP.LoadFileProfileAsync(profileSettings)).Result;
var engineSettings = new FileEngineSettings(name, "", "en-US");
engineSettings.Identity = new Identity(name);
var fileEngine = Task.Run(async () => await fileProfile.AddEngineAsync(engineSettings)).Result;
我的问题是为什么我们需要租户ID才能获得令牌?为什么common
端点即使是多租户应用程序,并且我正在使用秘密使用client-credentials
流,也无法使用?