Skip to content

Commit 10aa9bb

Browse files
author
Release-Agent
committed
Sync up from Mainline branch for CommitId d3fc36f28a5cd837ef7e5caff5f3b25817e5c495
1 parent 710f307 commit 10aa9bb

File tree

10 files changed

+904
-663
lines changed

10 files changed

+904
-663
lines changed

src/GeneralTools/CDSClient/Client/Auth/AuthProcessor.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ internal async static Task<AuthenticationResult> ObtainAccessTokenAsync(
269269
{
270270
if (clientCredentialsCheck && !useDefaultCreds && !(promptBehavior == PromptBehavior.Always || promptBehavior == PromptBehavior.SelectAccount))
271271
{
272-
logSink.Log("ObtainAccessToken - CRED", TraceEventType.Verbose);
273272
_authenticationResult = publicAppClient.AcquireTokenByUsernamePassword(scopes, clientCredentials.UserName.UserName, CdsServiceClient.MakeSecureString(clientCredentials.UserName.Password)).ExecuteAsync().Result;
274273
}
275274
else
@@ -278,12 +277,10 @@ internal async static Task<AuthenticationResult> ObtainAccessTokenAsync(
278277
{
279278
if (!string.IsNullOrEmpty(loginUserHint))
280279
{
281-
logSink.Log("ObtainAccessToken - DEFAULT CREDS - Passed UPN", TraceEventType.Verbose);
282280
_authenticationResult = await publicAppClient.AcquireTokenByIntegratedWindowsAuth(scopes).WithUsername(loginUserHint).ExecuteAsync();
283281
}
284282
else
285283
{
286-
logSink.Log("ObtainAccessToken - DEFAULT CREDS", TraceEventType.Verbose);
287284
_authenticationResult = await publicAppClient.AcquireTokenByIntegratedWindowsAuth(scopes).ExecuteAsync();
288285
}
289286
}
@@ -351,7 +348,6 @@ internal async static Task<AuthenticationResult> ObtainAccessTokenAsync(
351348
AuthenticationResult _authenticationResult = null;
352349
if (confidentialAppClient != null)
353350
{
354-
logSink.Log("ObtainAccessToken - Confidential Client", TraceEventType.Verbose);
355351
_authenticationResult = await confidentialAppClient.AcquireTokenForClient(scopes).ExecuteAsync();
356352
}
357353
else

src/GeneralTools/CDSClient/Client/CdsConnectionService.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,9 +1371,6 @@ internal void SetClonedProperties(CdsServiceClient sourceClient)
13711371
TenantId = sourceClient.TenantId;
13721372
EnvironmentId = sourceClient.EnvironmentId;
13731373
GetAccessTokenAsync = sourceClient.GetAccessToken;
1374-
//_authority = sourceClient.CdsConnectionSvc.AuthContext == null
1375-
// ? string.Empty
1376-
// : sourceClient.CdsConnectionSvc.AuthContext.Authority;
13771374
}
13781375

13791376
#region WebAPI Interface Utilities

src/GeneralTools/CDSClient/Client/CdsServiceClient.cs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -911,11 +911,12 @@ internal void ConnectToCdsService(string cdsConnectionString)
911911
/// <param name="externalOrgWebProxyClient">User Provided Organization Web Proxy Client</param>
912912
/// <param name="isCloned">when true, skips init</param>
913913
/// <param name="orginalAuthType">Auth type of source connection</param>
914-
internal CdsServiceClient(OrganizationWebProxyClient externalOrgWebProxyClient, bool isCloned = true , AuthenticationType orginalAuthType = AuthenticationType.OAuth)
914+
/// <param name="sourceOrgVersion">source organization version</param>
915+
internal CdsServiceClient(OrganizationWebProxyClient externalOrgWebProxyClient, bool isCloned = true , AuthenticationType orginalAuthType = AuthenticationType.OAuth , Version sourceOrgVersion = null)
915916
{
916917
CreateCdsServiceConnection(null, orginalAuthType, string.Empty, string.Empty, string.Empty, null, string.Empty,
917918
MakeSecureString(string.Empty), string.Empty, string.Empty, string.Empty, false, false, null, string.Empty, null,
918-
PromptBehavior.Auto, externalOrgWebProxyClient, isCloned: isCloned);
919+
PromptBehavior.Auto, externalOrgWebProxyClient, isCloned: isCloned , incomingOrgVersion: sourceOrgVersion);
919920
}
920921

921922

@@ -945,8 +946,9 @@ internal CdsServiceClient(OrganizationWebProxyClient externalOrgWebProxyClient,
945946
/// <param name="certificateStoreName">StoreName to look in for certificate identified by certificateThumbPrint</param>
946947
/// <param name="certificateThumbPrint">ThumbPrint of the Certificate to load</param>
947948
/// <param name="instanceUrl">Actual URI of the Organization Instance</param>
948-
/// <param name="isCloned">When True, Indicates that the contruction request is coming from a clone operation. </param>
949+
/// <param name="isCloned">When True, Indicates that the construction request is coming from a clone operation. </param>
949950
/// <param name="useDefaultCreds">(optional) If true attempts login using current user ( Online ) </param>
951+
/// <param name="incomingOrgVersion">Incoming Org Version, used as part of clone.</param>
950952
internal void CreateCdsServiceConnection(
951953
object externalOrgServiceProxy,
952954
AuthenticationType requestedAuthType,
@@ -971,7 +973,8 @@ internal void CreateCdsServiceConnection(
971973
X509Certificate2 certificate = null,
972974
Uri instanceUrl = null,
973975
bool isCloned = false,
974-
bool useDefaultCreds = false
976+
bool useDefaultCreds = false,
977+
Version incomingOrgVersion = null
975978
)
976979
{
977980

@@ -1037,6 +1040,10 @@ internal void CreateCdsServiceConnection(
10371040
{
10381041
CdsConnectionSvc = new CdsConnectionService(externalOrgWebProxyClient, logEntry);
10391042
CdsConnectionSvc.IsAClone = isCloned;
1043+
if ( isCloned && incomingOrgVersion != null)
1044+
{
1045+
CdsConnectionSvc.OrganizationVersion = incomingOrgVersion;
1046+
}
10401047
}
10411048
else
10421049
{
@@ -1196,9 +1203,8 @@ public CdsServiceClient Clone(System.Reflection.Assembly strongTypeAsm)
11961203
if (proxy != null)
11971204
{
11981205
proxy.HeaderToken = CdsConnectionSvc.CdsWebClient.HeaderToken;
1199-
var SvcClient = new CdsServiceClient(proxy, true , CdsConnectionSvc.AuthenticationTypeInUse);
1206+
var SvcClient = new CdsServiceClient(proxy, true , CdsConnectionSvc.AuthenticationTypeInUse ,CdsConnectionSvc.OrganizationVersion);
12001207
SvcClient.CdsConnectionSvc.SetClonedProperties(this);
1201-
SvcClient._BatchManager = _BatchManager;
12021208
SvcClient.CallerAADObjectId = CallerAADObjectId;
12031209
SvcClient.CallerId = CallerId;
12041210
SvcClient.MaxRetryCount = _maxRetryCount;
@@ -4826,7 +4832,7 @@ internal bool AddRequestToBatch(Guid batchId, OrganizationRequest req, string ba
48264832
{
48274833
// if request should bypass plugin exec.
48284834
if (bypassPluginExecution && ConnectedOrgVersion >= Utilities.CDSFeatureVersionMinimums.AllowBypassCustomPlugin)
4829-
req.Parameters.Add(Utilities.CDSRequestHeaders.BYPASSCUSTOMPLUGINEXECUTION, "true");
4835+
req.Parameters.Add(Utilities.CDSRequestHeaders.BYPASSCUSTOMPLUGINEXECUTION, true);
48304836

48314837
if (IsBatchOperationsAvailable)
48324838
{
@@ -5478,7 +5484,7 @@ internal OrganizationResponse CdsCommand_Execute(OrganizationRequest req, string
54785484

54795485
// if request should bypass plugin exec.
54805486
if (bypassPluginExecution && ConnectedOrgVersion >= Utilities.CDSFeatureVersionMinimums.AllowBypassCustomPlugin)
5481-
req.Parameters.Add(Utilities.CDSRequestHeaders.BYPASSCUSTOMPLUGINEXECUTION, "true");
5487+
req.Parameters.Add(Utilities.CDSRequestHeaders.BYPASSCUSTOMPLUGINEXECUTION, true);
54825488

54835489
logEntry.Log(string.Format(CultureInfo.InvariantCulture, "Execute Command - {0}{1}: RequestID={2} {3}",
54845490
req.RequestName,
@@ -5691,8 +5697,8 @@ private void LogException(OrganizationRequest req, Exception ex, string errorStr
56915697
else if (ex is HttpOperationException httpOperationException)
56925698
{
56935699
JObject contentBody = JObject.Parse(httpOperationException.Response.Content);
5694-
var errorMessage = CdsTraceLogger.GetFirstLineFromString(contentBody["error"]["message"].ToString()).Trim();
5695-
logEntry.Log(string.Format(CultureInfo.InvariantCulture, "************ {3} - {2} : {0} |=> {1}", errorStringCheck, errorMessage, webUriMessageReq, ex.GetType().Name), TraceEventType.Error, ex);
5700+
CdsClientOperationException ex01 = CdsClientOperationException.GenerateCdsClientOperationException(httpOperationException);
5701+
logEntry.Log(string.Format(CultureInfo.InvariantCulture, "************ {3} - {2} : {0} |=> {1}", errorStringCheck, CdsTraceLogger.GetFirstLineFromString(contentBody["error"]["message"].ToString()).Trim(), webUriMessageReq, ex.GetType().Name), TraceEventType.Error, ex01);
56965702
}
56975703
else
56985704
{

0 commit comments

Comments
 (0)