Beispiel #1
0
 public Preset(JObject obj)
 {
     Marketplace = obj["marketplace"].Value <string>();
     App         = App.LoadFromJson(obj["app"].Value <JObject>());
     Api         = Api.LoadFromJson(obj["api"].Value <JObject>());
     Connec      = Connec.LoadFromJson(obj["connec"].Value <JObject>());
     Webhook     = Webhook.LoadFromJson(obj["webhooks"].Value <JObject>());
     Sso         = Sso.LoadFromJson(Marketplace, App, Api, obj["sso"].Value <JObject>());
 }
Beispiel #2
0
 /// <summary>
 /// Constructor only used for testing
 /// </summary>
 /// <param name="marketplace">The marketplace (e.g.: maestrano)</param>
 public Preset(string marketplace)
 {
     Marketplace = marketplace;
     App         = new App();
     Api         = new Api();
     Connec      = new Connec();
     Webhook     = new Webhook();
     Sso         = new Sso(marketplace, Api);
 }
Beispiel #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="name">The preset name (e.g.: maestrano)</param>
 public Preset(string name)
 {
     Name    = name;
     App     = App.Load(name);
     Api     = Api.Load(name);
     Connec  = Connec.Load(name);
     Webhook = Webhook.Load(name);
     Sso     = Sso.Load(name);
 }
Beispiel #4
0
        /// <summary>
        /// Load Sso configuration into a Sso configuration object
        /// </summary>
        /// <returns>A Sso configuration object</returns>
        public static Sso Load()
        {
            var config = ConfigurationManager.GetSection("maestrano/sso") as Sso;

            if (config == null)
            {
                config = new Sso();
            }

            return(config);
        }
Beispiel #5
0
        /// <summary>
        /// Load Sso configuration into a Sso configuration object
        /// </summary>
        /// <returns>A Sso configuration object</returns>
        public static Sso Load(string preset = "maestrano")
        {
            var config = ConfigurationManager.GetSection(preset + "/sso") as Sso;

            if (config == null)
            {
                config = new Sso();
            }
            config.presetName = preset;

            return(config);
        }
Beispiel #6
0
        /// <summary>
        /// Load configuration into a Sso configuration object from a JObject
        /// </summary>
        /// <returns>A Sso configuration object</returns>
        public static Sso LoadFromJson(string preset, JObject obj)
        {
            var config = new Sso();

            config.presetName      = preset;
            config.InitPath        = obj["init_path"].Value <String>();
            config.ConsumePath     = obj["consume_path"].Value <String>();
            config.Idm             = obj["idm"].Value <String>();
            config.Idp             = obj["idp"].Value <String>();
            config.X509Fingerprint = obj["x509_fingerprint"].Value <String>();
            config.X509Certificate = obj["x509_certificate"].Value <String>();
            return(config);
        }
Beispiel #7
0
        /// <summary>
        /// Load configuration into a Sso configuration object from a JObject
        /// </summary>
        /// <returns>A Sso configuration object</returns>
        public static Sso LoadFromJson(String marketplace, App appConfiguration, Api apiConfiguration, JObject obj)
        {
            var config = new Sso(marketplace, apiConfiguration);

            config.InitPath    = obj["init_path"].Value <String>();
            config.ConsumePath = obj["consume_path"].Value <String>();
            var idm = obj["idm"].Value <String>();

            // if idm is null, we take the host by default
            if (String.IsNullOrEmpty(idm))
            {
                idm = appConfiguration.Host;
            }
            config.Idm             = idm;
            config.Idp             = obj["idp"].Value <String>();
            config.X509Fingerprint = obj["x509_fingerprint"].Value <String>();
            config.X509Certificate = obj["x509_certificate"].Value <String>();
            return(config);
        }
Beispiel #8
0
        /// <summary>
        /// Load Sso configuration into a Sso configuration object
        /// </summary>
        /// <returns>A Sso configuration object</returns>
        public static Sso Load(string preset = "maestrano")
        {
            var config = ConfigurationManager.GetSection(preset + "/sso") as Sso;
            if (config == null) config = new Sso();

            return config;
        }