private void VerifyLoginRequestMessage()
        {
            logger.Verbose("[AuthenticationController.VerifyLoginRequestMessage] called");

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

            var protection    = settings.GetInternalProtectionSettings();
            var signInMessage = SignInMessage.FromJwt(
                message,
                protection.Issuer,
                protection.Audience,
                protection.SigningKey);
        }
        private SignInMessage LoadLoginRequestMessage()
        {
            logger.Verbose("[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 protection    = settings.GetInternalProtectionSettings();
            var signInMessage = SignInMessage.FromJwt(
                message,
                protection.Issuer,
                protection.Audience,
                protection.SigningKey);

            return(signInMessage);
        }
Exemple #3
0
        private void SaveLoginRequestMessage(string message)
        {
            logger.Verbose("[AuthenticationController.SaveLoginRequestMessage] called");

            var protection    = settings.GetInternalProtectionSettings();
            var signInMessage = SignInMessage.FromJwt(
                message,
                protection.Issuer,
                protection.Audience,
                protection.SigningKey);

            var ctx = Request.GetOwinContext();

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