Example #1
0
        private static void HandleSecurity(this SecurityConfig securityConfig, XmlNode node)
        {
            foreach (XmlNode child in node.ChildNodes)
            {
                var nodeName = CleanNodeName(child);
                if ("username-password".Equals(nodeName))
                {
                    securityConfig.ConfigureUsernamePasswordIdentity(GetAttribute(child, "username"),
                                                                     GetAttribute(child, "password"));
                }
                else if ("token".Equals(nodeName))
                {
                    var encodingLabel = GetAttribute(node, "encoding");
                    var encodedToken  = GetTextContent(node);

                    TokenEncoding tokenEncoding = Enum.TryParse(encodingLabel, true, out tokenEncoding)
                        ? tokenEncoding
                        : TokenEncoding.None;
                    securityConfig.ConfigureTokenIdentity(encodedToken, tokenEncoding);
                }
                else if ("credentials-factory".Equals(nodeName))
                {
                    securityConfig.HandleCredentialsFactory(child);
                }
            }
        }
Example #2
0
        private static void HandleCredentialsFactory(this SecurityConfig securityConfig, XmlNode node)
        {
            var typeName = GetAttribute(node, "class-name");
            var prop     = new Dictionary <string, string>();

            foreach (XmlNode child in node.ChildNodes)
            {
                var nodeName = CleanNodeName(child.Name);
                if ("properties".Equals(nodeName))
                {
                    prop.FillProperties(child);
                    break;
                }
            }
            securityConfig.ConfigureCredentialsFactory(typeName, prop);
        }