public static OAuthCredentials CreateAsApp(InternalClientContext clientContext, RequestLogger requestLogger) { ArgumentValidator.ThrowIfNull("clientContext", clientContext); OrganizationId organizationId = clientContext.OrganizationId; string domain = clientContext.ADUser.PrimarySmtpAddress.Domain; string text = FaultInjection.TraceTest <string>((FaultInjection.LIDs) 2743479613U); if (!string.IsNullOrEmpty(text)) { domain = SmtpAddress.Parse(text).Domain; organizationId = OrganizationId.FromAcceptedDomain(domain); } OAuthCredentials oauthCredentialsForAppToken = OAuthCredentials.GetOAuthCredentialsForAppToken(organizationId, domain); OAuthCredentialsFactory.SetCredentialsProperties(oauthCredentialsForAppToken, clientContext, requestLogger); return(oauthCredentialsForAppToken); }
public static OAuthCredentials Create(InternalClientContext clientContext, RequestLogger requestLogger) { ArgumentValidator.ThrowIfNull("clientContext", clientContext); OrganizationId organizationId = clientContext.OrganizationId; ADUser aduser = clientContext.ADUser; string text = FaultInjection.TraceTest <string>((FaultInjection.LIDs) 2743479613U); if (!string.IsNullOrEmpty(text)) { SmtpAddress smtpAddress = SmtpAddress.Parse(text); IRecipientSession recipientSession = DirectorySessionFactory.Default.CreateTenantRecipientSession(true, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromTenantAcceptedDomain(smtpAddress.Domain), 68, "Create", "f:\\15.00.1497\\sources\\dev\\infoworker\\src\\common\\RequestDispatch\\OAuthCredentialsFactory.cs"); aduser = (recipientSession.FindByProxyAddress(ProxyAddress.Parse(text)) as ADUser); organizationId = aduser.OrganizationId; } OAuthCredentials oauthCredentialsForAppActAsToken = OAuthCredentials.GetOAuthCredentialsForAppActAsToken(organizationId, aduser, null); OAuthCredentialsFactory.SetCredentialsProperties(oauthCredentialsForAppActAsToken, clientContext, requestLogger); return(oauthCredentialsForAppActAsToken); }