Изменить имя по умолчанию на другое - PullRequest
0 голосов
/ 25 октября 2018

после выдачи утверждений ADFS, Как изменить имя пользователя (HttpContext.Current.User.Identity.Name) до

http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn из http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name

Мой запуск.Auth.cs в App_Start имеет значение

public partial class Startup
{


    private static string realm = ConfigurationManager.AppSettings["ida:Wtrealm"];
    private static string adfsMetadata = ConfigurationManager.AppSettings["ida:ADFSMetadata"];


    public void ConfigureAuth(IAppBuilder app)
    {



        app.UseCookieAuthentication(new CookieAuthenticationOptions
        {

            CookieManager = new SystemWebCookieManager()
        });

        app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);

        app.UseCookieAuthentication(new CookieAuthenticationOptions());

        app.UseWsFederationAuthentication(
            new WsFederationAuthenticationOptions
            {
                Wtrealm = realm,
                MetadataAddress = adfsMetadata
            });
    }
}

, а startup.cs имеет значение

 public partial class Startup
{
    public void Configuration(IAppBuilder app)
    {
        ConfigureAuth(app);
        IEnumerable<Claim> claims = ClaimsPrincipal.Current.Claims;
    }
}

в конце, если я получаю доступ к HttpContext.Current.User.Identity.Name, я должен получить значениеupn а не Name

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...