Ejemplo n.º 1
0
        /// <summary>
        /// Initialize method implementation
        /// </summary>
        public static void Initialize(MFAConfig config, AuthenticationContext context, Uri request)
        {
            WebThemesClient manager = new WebThemesClient();

            manager.Initialize();
            try
            {
                IWebThemeManager client = manager.Open();
                try
                {
                    WebThemesParametersRecord message = new WebThemesParametersRecord()
                    {
                        Identifier = context.ThemeIdentifier,
                        LCID       = context.Lcid
                    };
                    var servernames = (from server in config.Hosts.ADFSFarm.Servers
                                       select(server.FQDN.ToLower(), server.NodeType.ToLower().Equals("primarycomputer")));

                    Dictionary <string, bool> dic = servernames.ToDictionary(pair => pair.Item1, pair => pair.Item2);
                    string identifier             = string.Empty;
                    if (client.Initialize(dic, message, request.OriginalString, out identifier))
                    {
                        context.ThemeIdentifier = identifier;
                    }
                }
                finally
                {
                    manager.Close(client);
                }
            }
            finally
            {
                manager.UnInitialize();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// GetIllustrationAddress method implementation
        /// </summary>
        public static string GetIllustrationAddress(AuthenticationContext context)
        {
            WebThemesClient manager = new WebThemesClient();

            manager.Initialize();
            try
            {
                IWebThemeManager client = manager.Open();
                try
                {
                    WebThemesParametersRecord message = new WebThemesParametersRecord()
                    {
                        Identifier = context.ThemeIdentifier,
                        LCID       = context.Lcid
                    };
                    return(client.GetIllustrationAddress(message));
                }
                catch (Exception)
                {
                    return(string.Empty);
                }
                finally
                {
                    manager.Close(client);
                }
            }
            finally
            {
                manager.UnInitialize();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// GetAddresses method implmentation
        /// </summary>
        public static Dictionary <WebThemeAddressKind, string> GetAddresses(AuthenticationContext context)
        {
            WebThemesClient manager = new WebThemesClient();

            manager.Initialize();
            try
            {
                IWebThemeManager client = manager.Open();
                try
                {
                    WebThemesParametersRecord message = new WebThemesParametersRecord()
                    {
                        Identifier = context.ThemeIdentifier,
                        LCID       = context.Lcid
                    };
                    return(client.GetAddresses(message));
                }
                catch (Exception)
                {
                    return(null);
                }
                finally
                {
                    manager.Close(client);
                }
            }
            finally
            {
                manager.UnInitialize();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// HasRelyingPartyTheme
        /// </summary>
        public static bool HasRelyingPartyTheme(AuthenticationContext context)
        {
            WebThemesClient manager = new WebThemesClient();

            manager.Initialize();
            try
            {
                IWebThemeManager client = manager.Open();
                try
                {
                    WebThemesParametersRecord message = new WebThemesParametersRecord()
                    {
                        Identifier = context.ThemeIdentifier,
                        LCID       = context.Lcid
                    };
                    return(client.HasRelyingPartyTheme(message));
                }
                catch (Exception)
                {
                    return(false);
                }
                finally
                {
                    manager.Close(client);
                }
            }
            finally
            {
                manager.UnInitialize();
            }
        }