public AuthorizeInteractionResponseGenerator(CoreSettings settings, IConsentService consent)
 {
     _signIn = new SignInMessage();
     
     _settings = settings;
     _consent = consent;
 }
        public static string GetRedirectUrl(SignInMessage message, IDictionary<string, object> env, IDataProtector protector)
        {
            var result = new LoginResult(message, env, protector);
            var response = result.Execute();

            return response.Headers.Location.AbsoluteUri;
        }
        public static string GetRedirectUrl(SignInMessage message, HttpRequestMessage request, CoreSettings settings, InternalConfiguration internalConfig)
        {
            var result = new LoginResult(message, request, settings, internalConfig, internalConfig.LoginPageUrl);
            var response = result.Execute();

            return response.Headers.Location.AbsoluteUri;
        }
 public LoginResult(SignInMessage message, HttpRequestMessage request, CoreSettings settings, InternalConfiguration internalConfig, string loginPageUrl = "")
 {
     _message = message;
     _settings = settings;
     _request = request;
     _internalConfig = internalConfig;
     _loginPageUrl = loginPageUrl;
 }
        public static SignInMessage FromJwt(string jwt, string issuer, string audience, string key)
        {
            var message = new SignInMessage();
            var handler = new JwtSecurityTokenHandler();
            var parameters = new TokenValidationParameters
            {
                AllowedAudience = audience,
                ValidIssuer = issuer,
                SigningToken = new BinarySecretSecurityToken(Convert.FromBase64String(key))
            };

            var principal = handler.ValidateToken(jwt, parameters);

            var claim = principal.FindFirst("returnUrl");
            if (claim != null)
            {
                message.ReturnUrl = claim.Value;
            }

            return message;
        }
        IHttpActionResult RedirectToLogin(ICoreSettings settings)
        {
            var message = new SignInMessage();
            message.ReturnUrl = Request.RequestUri.AbsoluteUri;

            return new LoginResult(message, this.Request, settings);
        }
        IHttpActionResult RedirectToLogin(CoreSettings settings, SignInValidationResult result)
        {
            var message = new SignInMessage();
            message.ReturnUrl = Request.RequestUri.AbsoluteUri;

            if (result.HomeRealm.IsPresent())
            {
                message.IdP = result.HomeRealm;
            }

            var url = LoginResult.GetRedirectUrl(message, this.Request, settings, _internalConfig);
            return Redirect(url);
        }
 public AuthorizeInteractionResponseGenerator(IConsentService consent)
 {
     _signIn = new SignInMessage();
     _consent = consent;
 }
 public LoginResult(SignInMessage message, HttpRequestMessage request, ICoreSettings settings)
 {
     _message = message;
     _settings = settings;
     _request = request;
 }
 public LoginResult(SignInMessage message, IDictionary<string, object> env, IDataProtector protector)
 {
     _message = message;
     _env = env;
     _protector = protector;
 }
 public LoginResult(SignInMessage message, HttpRequestMessage request, ICoreSettings settings)
 {
     _message  = message;
     _settings = settings;
     _request  = request;
 }
        IHttpActionResult RedirectToLogin(SignInValidationResult result)
        {
            var message = new SignInMessage();
            message.ReturnUrl = Request.RequestUri.AbsoluteUri;

            if (result.HomeRealm.IsPresent())
            {
                message.IdP = result.HomeRealm;
            }

            var url = LoginResult.GetRedirectUrl(message, this.Request.GetOwinContext().Environment, _wsFedOptions.DataProtector);
            return Redirect(url);
        }