AnsweredAssumed Answered

Rally Api authentication

Question asked by JonathanTorres1355981 on Mar 15, 2018
Latest reply on Mar 16, 2018 by Michael Bulkeley

I use to use rally api 3.0.1 and am trying to upgrade to api 3.2.1 but the way I'm connection is looping and I can't connect to rally. So any help would be appreciated. The yellow part is the part that look

 

 Code to connect to Rally:

 

Common.ValidateCertificate();

RallyRestApi restApi = Common.getRestApi;

 

Common.cs:

public static void ValidateCertificate()

        {

            // The following code is required to connect to an on-premise Rally server without a trusted cert uploaded

            // If we remove this code it throws the following error

            // Could not establish trust relationship for the SSL/TLS secure channel".

            // This code has to placed before starting any calls to the webservise.

            TrustAllCertificatePolicy trustAll = new TrustAllCertificatePolicy();

            System.Net.ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback(TrustAllCertificatePolicy.AcceptAllCerts);

        }

        public class TrustAllCertificatePolicy : ICertificatePolicy

        {

            //Default policy for certificate validation.

            public static bool DefaultValidate = false;

            public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate cert, WebRequest request, int problem)

            {

                return true;

            }

 

            public static bool AcceptAllCerts(object sender, X509Certificate cert, X509Chain chain, System.Net.Security.SslPolicyErrors SslPolicyErrors)

            {

                return true;

            }

        }

 

public static RallyRestApi getRestApi

        {

            //get { return _restApi;}

            get {

          

            RallyRestApi _restApi = new RallyRestApi(webServiceVersion: ReadAppSettingsValues("RallyURLVersion"));

            _restApi.Authenticate(ReadAppSettingsValues("RallyUserName"), ReadAppSettingsValues("RallyPassword"), ReadAppSettingsValues("RallyURL"),null,false);

            return _restApi;

            }

        }

        //public static RallyRestApi _restApi = new RallyRestApi(ReadAppSettingsValues("RallyUserName"), ReadAppSettingsValues("RallyPassword"), ReadAppSettingsValues("RallyURL"), ReadAppSettingsValues("RallyURLVersion"));

        public static RallyRestApi _restApi = new RallyRestApi();

Outcomes