简体   繁体   中英

net core 2.2, share data protection tokens across applications

I got several .net core 2.2 applications published to a single IIS instance. My dataprotection setup is

public static IDataProtectionBuilder AddCaDataProtection(this IServiceCollection services)
{
    const string applicationName = "CertificationAuthority";
    var registryKey = Registry.CurrentUser.CreateSubKey($@"SOFTWARE\{applicationName}\keys");
    return services
        .AddDataProtection()
        .SetApplicationName(applicationName)
        .ProtectKeysWithDpapi()
        .PersistKeysToRegistry(registryKey);
}

Every application invokes this static method from its Startup.ConfigureServices . Applications are running in separate pools under the same single windows user account. Although, when one application tries to validate data protection token generated in another application validation fails with InvalidToken result. What I am doing wrong?

PS. What exactly I am trying to do is to generate code with UserManager.GenerateEmailConfirmationTokenAsync in one app, and then do UserManager.ConfirmEmailAsync in another.

问题的原因是应用程序池使用PoolIdentity凭据运行,这实际上意味着每个池都有单独的用户配置文件

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM