public void SendHttpRequestTest() { var fileName = ConfigurationManager.AppSettings["privateKeyFileName"]; var privateKey = File.ReadAllText(fileName); var payload = GetPayload(); var token = WebServiceExchangeHelper.CreateJwtToken(privateKey, payload); Assert.IsNotNull(token); var data = WebServiceExchangeHelper.GetCustomerTravelPlannerJson(); Assert.IsNotNull(data); var serviceUrl = ConfigurationManager.AppSettings["serviceUrl"]; var content = WebServiceExchangeHelper.SendHttpRequest(serviceUrl, token, data); }
public void CallSsoService() { var login = GetSsoDetails(); var privateKey = GetPrivateInfo(); var expiredSeconds = GetConfig(DataKey.SsoTokenExpired); var notBeforeSeconds = GetConfig(DataKey.SsoTokenNotBefore); var payload = GetPayload(login, expiredSeconds, notBeforeSeconds); var token = WebServiceExchangeHelper.CreateJwtToken(privateKey, payload); var data = WebServiceExchangeHelper.GetCustomerTravelPlannerJson(); var serviceUrl = GetConfig(DataKey.OwrUrlConfigName); var content = WebServiceExchangeHelper.SendHttpRequest(serviceUrl, token, data); var eventParams = WebServiceExchangeHelper.ContentToEventParams(content); FireEvent(EventName.SsoCompleteEvent, eventParams); }
public void CallSsoService(RequestActionEventArgs args) { var opportunityId = GetParamValue(args, EntityRecords.Configuration.OwrOpportunityIdParamName); var createdByInitials = GetCreatorsInitials(opportunityId); var login = GetSsoDetails(_client.CrmInterface.GetMyCrmUserId()); var privateKey = GetPrivateInfo(); var expiredSeconds = GetConfig(EntityRecords.Configuration.OwrSsoTokenExpired); var notBeforeSeconds = GetConfig(EntityRecords.Configuration.OwrSsoTokenNotBefore); var payload = GetPayload(login, expiredSeconds, notBeforeSeconds, createdByInitials); var token = _jtiService.CreateJwtToken(privateKey, payload); var data = WebServiceExchangeHelper.GetCustomerTravelPlannerJson(); var serviceUrl = GetConfig(EntityRecords.Configuration.OwrUrlConfigName); var content = _jtiService.SendHttpRequest(HttpMethod.Post, serviceUrl, token, data).Content; var eventParams = WebServiceExchangeHelper.ContentToEventParams(content); FireEvent(EntityRecords.Configuration.SsoCompleteEvent, eventParams); }