Пример #1
0
 public void OnAuthenticationPipelineLoad(IAuthenticationMethodConfigData configData)
 {
     //this is where AD FS passes us the config data, if such data was supplied at registration of the adapter
     if (configData != null)
     {
         if (configData.Data != null)
         {
             // load the config file
             // TODO: Handle errors and exceptions
             using (StreamReader reader = new StreamReader(configData.Data, Encoding.UTF8))
             {
                 XmlRootAttribute xRoot = new XmlRootAttribute
                 {
                     ElementName = "server",
                     IsNullable  = true
                 };
                 XmlSerializer serializer    = new XmlSerializer(typeof(ADFSserver), xRoot);
                 ADFSserver    server_config = (ADFSserver)serializer.Deserialize(reader);
                 admin_pw         = server_config.adminpw;
                 admin_user       = server_config.adminuser;
                 ssl              = server_config.ssl.ToLower() == "false" ? false : true;
                 use_upn          = server_config.upn.ToLower() == "false" ? false : true;
                 privacyIDEArealm = server_config.realm;
                 privacyIDEAurl   = server_config.url;
                 uidefinition     = server_config.@interface;
             }
         }
     }
 }
Пример #2
0
        public void OnAuthenticationPipelineLoad(IAuthenticationMethodConfigData configData)
        {
#if DEBUG
            Debug.WriteLine($"{Helper.debugPrefix} Loading version {Assembly.GetExecutingAssembly().GetName().Version.ToString()}");
#endif

            //this is where AD FS passes us the config data, if such data was supplied at registration of the adapter
            if ((configData != null) && (configData.Data != null))
            {
                try
                {
                    // load the config file
                    using (StreamReader reader = new StreamReader(configData.Data, Encoding.UTF8))
                    {
                        XmlRootAttribute xRoot = new XmlRootAttribute
                        {
                            ElementName = "server",
                            IsNullable  = true
                        };
                        XmlSerializer serializer    = new XmlSerializer(typeof(ADFSserver), xRoot);
                        XmlReader     xmlreader     = XmlReader.Create(reader);
                        ADFSserver    server_config = (ADFSserver)serializer.Deserialize(xmlreader);
                        xmlreader.Dispose();
                        admin_pw         = server_config.adminpw;
                        admin_user       = server_config.adminuser;
                        ssl              = server_config.ssl.ToLower(new CultureInfo(Metadata.AvailableLcids[0])) == "true";
                        privacyIDEArealm = server_config.realm;
                        privacyIDEAurl   = server_config.url;
                        uidefinition     = server_config.@interface;
                    }
                }
#pragma warning disable CA1031 // Do not catch general exception types
                catch (Exception ex)
#pragma warning restore CA1031 // Do not catch general exception types
                {
#if DEBUG
                    Debug.WriteLine($"{Helper.debugPrefix} OnAuthenticationPipelineLoad() exception: {ex.Message}");
#endif
                    Helper.LogEvent($"OnAuthenticationPipelineLoad() exception: {ex.Message}", EventLogEntryType.Error);
                }
            }
        }