Exemple #1
0
        public async Task <SignOutValidationResult> ValidateAsync(SignOutRequestMessage message)
        {
            Logger.Info("Start WS-Federation signout request validation");
            var result = new SignOutValidationResult();

            // check realm
            var realm = message.GetParameter("wtrealm");

            if (String.IsNullOrWhiteSpace(realm))
            {
                LogError("Realm has not been provided", result);
            }
            result.Realm = realm;
            var rp = await _relyingParties.GetByRealmAsync(realm);

            if (rp == null || rp.Enabled == false)
            {
                LogError("Relying party not found: " + realm, result);

                return(new SignOutValidationResult
                {
                    IsError = true,
                    Error = "invalid_relying_party"
                });
            }

            result.RelyingParty = rp;

            LogSuccess(result);
            return(result);
        }
Exemple #2
0
        private void LogError(string message, SignOutValidationResult result)
        {
            var log = LogSerializer.Serialize(new SignOutValidationLog(result));

            Logger.ErrorFormat("{0}\n{1}", message, log);
        }
Exemple #3
0
        private void LogSuccess(SignOutValidationResult result)
        {
            var log = LogSerializer.Serialize(new SignOutValidationLog(result));

            Logger.InfoFormat("End WS-Federation signout request validation\n{0}", log);
        }