public void MakeCookieConnection(bool impersonate) { try { // Get SSO Ticket string ssoTicket = GetCookieTicket(impersonate); Log.Information("ssoTicket retrieved successfully."); r3Connection = new R3Connection(); r3Connection.Client = sapConfig.SapClient; r3Connection.Host = sapConfig.SapHost; r3Connection.SystemNumber = sapConfig.SapSystemNumber; r3Connection.LogonGroup = sapConfig.SapLogonGroup; r3Connection.Language = sapConfig.SapLanguage; r3Connection.MessageServer = sapConfig.SapMessageServer; r3Connection.Protocol = sapConfig.SapProtocol; r3Connection.SID = sapConfig.SapSid; r3Connection.UsesLoadBalancing = sapConfig.SapUsesLoadBalancing; Log.Information("Trying to Connect User - " + WindowsIdentity.GetCurrent().Name + " to SAP Using SSO Credentials"); r3Connection.OpenSSO(ssoTicket, sapConfig.SapUsesLoadBalancing); } catch (Exception exception) { r3Connection = null; Log.Error(exception, "Could not create R3Connection object using Cookie Request"); } }
public void SsoR3Connection(SapSsoToken sapSsoToken) { R3Connection r3Connection; try { r3Connection = new R3Connection(); r3Connection.Client = sapConfig.SapClient; r3Connection.Host = sapConfig.SapHost; r3Connection.SystemNumber = sapConfig.SapSystemNumber; r3Connection.LogonGroup = sapConfig.SapLogonGroup; r3Connection.Language = sapConfig.SapLanguage; r3Connection.MessageServer = sapConfig.SapMessageServer; r3Connection.Protocol = sapConfig.SapProtocol; r3Connection.SID = sapConfig.SapSid; r3Connection.UsesLoadBalancing = sapConfig.SapUsesLoadBalancing; r3Connection.OpenSSO(sapSsoToken.SsoToken, sapConfig.SapUsesLoadBalancing); } catch (Exception exception) { r3Connection = null; Log.Error(exception, "Could not create R3Connection object"); } }