Многопользовательская реализация с Identity Server 4 с использованием ASP. NET Core - PullRequest
0 голосов
/ 19 марта 2020

Я пытаюсь реализовать многопользовательский режим в IdentityServer4. Я настраиваю Identity Server на страницу выбора арендатора и выдаю специфичные для арендатора c претензии в токене доступа.

Я имею в виду эту статью

public class AccountChooserResponseGenerator : AuthorizeInteractionResponseGenerator
{
    public AccountChooserResponseGenerator(ISystemClock clock,
        ILogger<AuthorizeInteractionResponseGenerator> logger,
        IConsentService consent, IProfileService profile)
        : base(clock, logger, consent, profile)
    {
    }

    public override async Task<InteractionResponse> ProcessInteractionAsync(ValidatedAuthorizeRequest request, ConsentResponse consent = null)
    {
        return new InteractionResponse
        {
            RedirectUrl = "/TenantSelection"
        };
    }
}

Пользователь будет перенаправлен на контроллер выбора арендатора после проверки имени пользователя / пароля. В методе Controller Action, который выполняется после выбора Арендатора, я вызвал:

await HttpContext.SignInAsync(User.Claims.Single(r=> r.Type == "sub").Value,
            new System.Security.Claims.Claim("TenantId", tenant.Id.ToString()));

        return Redirect(ReturnUrl);

Вопрос: Как бы я получил ReturnUrl в приведенном выше фрагменте действия внутри контроллера? Я получаю ReturnUrl в ProcessInteractionAsyn c, но как передать его контроллеру.

Спасибо!

StaySafeFromCoronaEveryone

...