Пример #1
0
        /// <summary>
        /// Called when the message has been received,
        /// after it passes through the channel binding elements.
        /// </summary>
        void IMessageWithEvents.OnReceiving()
        {
            var extraData = ((IMessage)this).ExtraData;

            this.ActualPolicies.Clear();
            string[] actualPolicies = this.actualPoliciesString.Split(' ');
            foreach (string policy in actualPolicies)
            {
                if (policy.Length > 0 && policy != AuthenticationPolicies.None)
                {
                    this.ActualPolicies.Add(policy);
                }
            }

            this.AssuranceLevels.Clear();
            AliasManager authLevelAliases = PapeUtilities.FindIncomingAliases(extraData);

            foreach (string authLevelAlias in authLevelAliases.Aliases)
            {
                string authValue;
                if (extraData.TryGetValue(AuthLevelAliasPrefix + authLevelAlias, out authValue))
                {
                    string authLevelType = authLevelAliases.ResolveAlias(authLevelAlias);
                    this.AssuranceLevels[authLevelType] = authValue;
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Called when the message has been received,
        /// after it passes through the channel binding elements.
        /// </summary>
        void IMessageWithEvents.OnReceiving()
        {
            var extraData = ((IMessage)this).ExtraData;

            this.PreferredPolicies.Clear();
            string[] preferredPolicies = this.preferredPoliciesString.Split(' ');
            foreach (string policy in preferredPolicies)
            {
                if (policy.Length > 0)
                {
                    this.PreferredPolicies.Add(policy);
                }
            }

            this.PreferredAuthLevelTypes.Clear();
            AliasManager authLevelAliases = PapeUtilities.FindIncomingAliases(extraData);
            string       preferredAuthLevelAliases;

            if (extraData.TryGetValue(Constants.RequestParameters.PreferredAuthLevelTypes, out preferredAuthLevelAliases))
            {
                foreach (string authLevelAlias in preferredAuthLevelAliases.Split(' '))
                {
                    if (authLevelAlias.Length == 0)
                    {
                        continue;
                    }
                    this.PreferredAuthLevelTypes.Add(authLevelAliases.ResolveAlias(authLevelAlias));
                }
            }
        }
Пример #3
0
 /// <summary>
 /// Serializes the applied policies for transmission from the Provider
 /// to the Relying Party.
 /// </summary>
 /// <param name="policies">The applied policies.</param>
 /// <returns>A space-delimited list of applied policies.</returns>
 private static string SerializePolicies(IList <string> policies)
 {
     if (policies.Count == 0)
     {
         return(AuthenticationPolicies.None);
     }
     else
     {
         return(PapeUtilities.ConcatenateListOfElements(policies));
     }
 }
Пример #4
0
        /// <summary>
        /// Serializes the auth levels to a list of aliases.
        /// </summary>
        /// <param name="preferredAuthLevelTypes">The preferred auth level types.</param>
        /// <param name="aliases">The alias manager.</param>
        /// <returns>A space-delimited list of aliases.</returns>
        private static string SerializeAuthLevels(IList <string> preferredAuthLevelTypes, AliasManager aliases)
        {
            var aliasList = new List <string>();

            foreach (string typeUri in preferredAuthLevelTypes)
            {
                aliasList.Add(aliases.GetAlias(typeUri));
            }

            return(PapeUtilities.ConcatenateListOfElements(aliasList));
        }
Пример #5
0
 /// <summary>
 /// Serializes the policies as a single string per the PAPE spec..
 /// </summary>
 /// <param name="policies">The policies to include in the list.</param>
 /// <returns>The concatenated string of the given policies.</returns>
 private static string SerializePolicies(IEnumerable <string> policies)
 {
     return(PapeUtilities.ConcatenateListOfElements(policies));
 }