Пример #1
0
        protected override Task ApplyResponseChallengeAsync()
        {
            if (Response.StatusCode != 401)
            {
                return(Task.FromResult <object>(null));
            }

            AuthenticationResponseChallenge challenge = Helper.LookupChallenge(Options.AuthenticationType, Options.AuthenticationMode);

            if (challenge != null)
            {
                string baseUri = Request.Scheme + Uri.SchemeDelimiter + Request.Host + Request.PathBase;

                string currentUri = baseUri + Request.Path + Request.QueryString;

                string redirectUri = baseUri + Options.CallbackPath;

                AuthenticationProperties extra = challenge.Properties;
                if (string.IsNullOrEmpty(extra.RedirectUri))
                {
                    extra.RedirectUri = currentUri;
                }

                string state = Options.StateDataFormat.Protect(extra);

                var authorizationEndpoint = ConstructFullAuthorizationUri(redirectUri);

                var redirectContext = new IFOAuthRedirectContext(Context, Options, extra, authorizationEndpoint);

                Options.Provider.ApplyRedirect(redirectContext);
            }

            return(Task.FromResult <object>(null));
        }
Пример #2
0
 /// <summary>
 /// Called when a Challenge causes a redirect to the authorize endpoint
 /// </summary>
 public virtual void ApplyRedirect(IFOAuthRedirectContext context)
 {
     OnApplyRedirect(context);
 }