private SignInMessage Unprotect(string data)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            return(SignInMessage.Unprotect(data, options.DataProtector));
        }
예제 #2
0
        private void VerifyLoginRequestMessage()
        {
            Logger.Debug("[AuthenticationController.VerifyLoginRequestMessage] called");

            var ctx     = Request.GetOwinContext();
            var message = ctx.Request.Cookies[LoginRequestMessageCookieName];

            var signInMessage = SignInMessage.Unprotect(
                message,
                _internalConfiguration.DataProtector);
        }
예제 #3
0
        private SignInMessage LoadSignInMessage()
        {
            var ctx     = Request.GetOwinContext();
            var message = ctx.Request.Cookies[_options.CookieOptions.Prefix + SignInMessageCookieName];

            if (message.IsMissing())
            {
                Logger.Error("signin message cookie is empty");
                throw new Exception("SignInMessage cookie is empty.");
            }

            var signInMessage = SignInMessage.Unprotect(
                message,
                _options.DataProtector);

            return(signInMessage);
        }
예제 #4
0
        private SignInMessage LoadLoginRequestMessage()
        {
            Logger.Debug("[AuthenticationController.LoadLoginRequestMessage] called");

            var ctx     = Request.GetOwinContext();
            var message = ctx.Request.Cookies[LoginRequestMessageCookieName];

            if (message.IsMissing())
            {
                Logger.Error("LoginRequestMessage cookie is empty.");
                throw new Exception("LoginRequestMessage cookie is empty.");
            }

            var signInMessage = SignInMessage.Unprotect(
                message,
                _internalConfiguration.DataProtector);

            return(signInMessage);
        }
예제 #5
0
        private SignInMessage SaveLoginRequestMessage(string message)
        {
            Logger.Debug("[AuthenticationController.SaveLoginRequestMessage] called");

            var signInMessage = SignInMessage.Unprotect(
                message,
                _internalConfiguration.DataProtector);

            var ctx = Request.GetOwinContext();

            ctx.Response.Cookies.Append(
                LoginRequestMessageCookieName,
                message,
                new Microsoft.Owin.CookieOptions
            {
                HttpOnly = true,
                Secure   = Request.RequestUri.Scheme == Uri.UriSchemeHttps
            });

            return(signInMessage);
        }
예제 #6
0
        private void VerifySignInMessage()
        {
            var ctx     = Request.GetOwinContext();
            var message = ctx.Request.Cookies[_options.CookieOptions.Prefix + SignInMessageCookieName];

            if (message.IsMissing())
            {
                Logger.Error("signin message cookie is empty");
                throw new Exception("SignInMessage cookie is empty.");
            }

            try
            {
                SignInMessage.Unprotect(
                    message,
                    _options.DataProtector);
            }
            catch
            {
                Logger.Error("signin message failed to validate");
                throw;
            }
        }
예제 #7
0
        private SignInMessage SaveSignInMessage(string message)
        {
            if (message == null)
            {
                throw new ArgumentNullException("message");
            }

            var signInMessage = SignInMessage.Unprotect(
                message,
                _options.DataProtector);

            var ctx = Request.GetOwinContext();

            ctx.Response.Cookies.Append(
                _options.CookieOptions.Prefix + SignInMessageCookieName,
                message,
                new Microsoft.Owin.CookieOptions
            {
                HttpOnly = true,
                Secure   = Request.RequestUri.Scheme == Uri.UriSchemeHttps
            });

            return(signInMessage);
        }