Exemplo n.º 1
0
        /// <summary>
        /// Validate that all configuration properties are set.
        /// </summary>
        public void Validate(string parentProperty)
        {
            // If any of ApplicationRegistration properties is provided,
            // then we will require that all are provided.

            if (null == ServiceApplication)
            {
                throw new Exception($"{parentProperty}.ServiceApplication" +
                                    " configuration property is missing.");
            }

            ServiceApplication.Validate($"{parentProperty}.ServiceApplication");

            if (null == ServiceApplicationSP)
            {
                throw new Exception($"{parentProperty}.ServiceApplicationSP" +
                                    " configuration property is missing.");
            }

            ServiceApplicationSP.Validate($"{parentProperty}.ServiceApplicationSP");

            if (null == ClientApplication)
            {
                throw new Exception($"{parentProperty}.ClientApplication" +
                                    " configuration property is missing.");
            }

            ClientApplication.Validate($"{parentProperty}.ClientApplication");

            if (null == ClientApplicationSP)
            {
                throw new Exception($"{parentProperty}.ClientApplicationSP" +
                                    " configuration property is missing.");
            }

            ClientApplicationSP.Validate($"{parentProperty}.ClientApplicationSP");

            if (null == AksApplication)
            {
                throw new Exception($"{parentProperty}.AksApplication" +
                                    " configuration property is missing.");
            }

            AksApplication.Validate($"{parentProperty}.AksApplication");

            if (null == AksApplicationSP)
            {
                throw new Exception($"{parentProperty}.AksApplicationSP" +
                                    " configuration property is missing.");
            }

            AksApplicationSP.Validate($"{parentProperty}.AksApplicationSP");

            if (string.IsNullOrEmpty(AksApplicationRbacSecret))
            {
                throw new Exception($"{parentProperty}.AksApplicationRbacSecret" +
                                    " configuration property is missing or is empty.");
            }
        }
        /// <summary>
        /// Validate that all configuration properties are set.
        /// </summary>
        public void Validate(string parentProperty)
        {
            // If any of ApplicationRegistration properties is provided,
            // then we will require that all are provided.

            // Details of service application
            if (null == ServiceApplication)
            {
                throw new Exception($"{parentProperty}.{nameof(ServiceApplication)}" +
                                    " configuration property is missing.");
            }

            ServiceApplication.Validate($"{parentProperty}.{nameof(ServiceApplication)}");

            if (null == ServiceApplicationSP)
            {
                throw new Exception($"{parentProperty}.{nameof(ServiceApplicationSP)}" +
                                    " configuration property is missing.");
            }

            ServiceApplicationSP.Validate($"{parentProperty}.{nameof(ServiceApplicationSP)}");

            if (string.IsNullOrEmpty(ServiceApplicationSecret))
            {
                throw new Exception($"{parentProperty}.{nameof(ServiceApplicationSecret)}" +
                                    " configuration property is missing or is empty.");
            }

            // Details of client application
            if (null == ClientApplication)
            {
                throw new Exception($"{parentProperty}.{nameof(ClientApplication)}" +
                                    " configuration property is missing.");
            }

            ClientApplication.Validate($"{parentProperty}.{nameof(ClientApplication)}");

            if (null == ClientApplicationSP)
            {
                throw new Exception($"{parentProperty}.{nameof(ClientApplicationSP)}" +
                                    " configuration property is missing.");
            }

            ClientApplicationSP.Validate($"{parentProperty}.{nameof(ClientApplicationSP)}");

            if (string.IsNullOrEmpty(ClientApplicationSecret))
            {
                throw new Exception($"{parentProperty}.{nameof(ClientApplicationSecret)}" +
                                    " configuration property is missing or is empty.");
            }

            // Details of aks application
            if (null == AksApplication)
            {
                throw new Exception($"{parentProperty}.{nameof(AksApplication)}" +
                                    " configuration property is missing.");
            }

            AksApplication.Validate($"{parentProperty}.{nameof(AksApplication)}");

            if (null == AksApplicationSP)
            {
                throw new Exception($"{parentProperty}.{nameof(AksApplicationSP)}" +
                                    " configuration property is missing.");
            }

            AksApplicationSP.Validate($"{parentProperty}.{nameof(AksApplicationSP)}");

            if (string.IsNullOrEmpty(AksApplicationSecret))
            {
                throw new Exception($"{parentProperty}.{nameof(AksApplicationSecret)}" +
                                    " configuration property is missing or is empty.");
            }
        }