コード例 #1
0
        public IActionResult Challenge(string scheme, string returnUrl)
        {
            var result = _externalService.CreateChallenge(new ExtChallengeRequest
            {
                Scheme    = scheme,
                ReturnUrl = returnUrl.SomeNotNull()
            });

            return(result.Match(
                       none: e => throw new Exception(e),
                       some: r =>
            {
                var props = new AuthenticationProperties
                {
                    RedirectUri = Url.Action(nameof(Callback)),
                    Items =
                    {
                        { "returnUrl", r.TrustedReturnUrl },
                        { "scheme",    r.Scheme           },
                    }
                };

                return Challenge(props, scheme);
            }
                       ));
        }