public static LicenseIdentity GetLicenseIdentity(RmsClientManagerContext context, string recipientAddress) { ArgumentValidator.ThrowIfNull("context", context); ArgumentValidator.ThrowIfNullOrEmpty("recipientAddress", recipientAddress); ADRawEntry adrawEntry; try { adrawEntry = context.ResolveRecipient(recipientAddress); } catch (ADTransientException innerException) { throw new ExchangeConfigurationException(ServerStrings.FailedToReadUserConfig(recipientAddress), innerException); } catch (ADOperationException innerException2) { throw new RightsManagementException(RightsManagementFailureCode.ADUserNotFound, ServerStrings.FailedToReadUserConfig(recipientAddress), innerException2); } if (adrawEntry == null) { throw new RightsManagementException(RightsManagementFailureCode.ADUserNotFound, ServerStrings.FailedToReadUserConfig(recipientAddress)); } List <string> federatedEmailAddresses = RmsClientManagerUtils.GetFederatedEmailAddresses(context.OrgId, (ProxyAddressCollection)adrawEntry[ADRecipientSchema.EmailAddresses]); if (federatedEmailAddresses.Count == 0) { RmsClientManager.TraceFail(null, context.SystemProbeId, "GetLicenseIdentity: User {0} doesn't have any SMTP proxy address from a domain that is federated.", new object[] { recipientAddress }); throw new RightsManagementException(RightsManagementFailureCode.ADUserNotFederated, DirectoryStrings.UserHasNoSmtpProxyAddressWithFederatedDomain); } return(new LicenseIdentity(federatedEmailAddresses[0], federatedEmailAddresses.ToArray())); }
public static void LogAcquireRmsTemplateResult(RmsClientManagerContext context, Uri serverUrl, LinkedList <RmsTemplate> templates) { if (!RmsClientManagerLog.rmsLogEnabled) { return; } if (context == null) { throw new ArgumentNullException("context"); } StringBuilder stringBuilder = new StringBuilder(); bool flag = true; foreach (RmsTemplate rmsTemplate in templates) { if (!flag) { stringBuilder.AppendFormat("; {0}", rmsTemplate.Id.ToString()); } else { stringBuilder.Append(rmsTemplate.Id.ToString()); flag = false; } } RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.Template, RmsClientManagerLog.RmsClientManagerEvent.Success, serverUrl, context.OrgId, context.TransactionId, stringBuilder.ToString(), context.ContextStringForm); }
public static void LogAcquireServerInfoResult(RmsClientManagerContext context, ExternalRMSServerInfo serverInfo) { if (!RmsClientManagerLog.rmsLogEnabled) { return; } if (context == null) { throw new ArgumentNullException("context"); } if (serverInfo == null) { RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.ServerInfo, RmsClientManagerLog.RmsClientManagerEvent.Success, context.OrgId, context.TransactionId, RmsClientManagerLog.ServerInfoNotFound, context.ContextStringForm); return; } RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.ServerInfo, RmsClientManagerLog.RmsClientManagerEvent.Success, context.OrgId, context.TransactionId, string.Format(CultureInfo.InvariantCulture, "KeyUri: {0}; CertificationWSPipeline: {1}; CertificationWSTargetUri: {2}; ServerLicensingWSPipeline: {3}; ServerLicensingWSTargetUri: {4}; ExpiryTime: {5}", new object[] { (serverInfo.KeyUri == null) ? RmsClientManagerLog.ServerInfoUriNull : serverInfo.KeyUri.ToString(), (serverInfo.CertificationWSPipeline == null) ? RmsClientManagerLog.ServerInfoUriNull : serverInfo.CertificationWSPipeline.ToString(), (serverInfo.CertificationWSTargetUri == null) ? RmsClientManagerLog.ServerInfoUriNull : serverInfo.CertificationWSTargetUri.ToString(), (serverInfo.ServerLicensingWSPipeline == null) ? RmsClientManagerLog.ServerInfoUriNull : serverInfo.ServerLicensingWSPipeline.ToString(), (serverInfo.ServerLicensingWSTargetUri == null) ? RmsClientManagerLog.ServerInfoUriNull : serverInfo.ServerLicensingWSTargetUri.ToString(), serverInfo.ExpiryTime.Ticks.ToString() }), context.ContextStringForm); }
public static void LogAcquirePrelicenseResult(RmsClientManagerContext context, LicenseResponse[] responses) { if (!RmsClientManagerLog.rmsLogEnabled) { return; } if (context == null) { throw new ArgumentNullException("context"); } if (responses == null || responses.Length == 0) { RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.Prelicense, RmsClientManagerLog.RmsClientManagerEvent.Success, context.TransactionId, RmsClientManagerLog.PrelicenseNoResult, context.ContextStringForm); return; } foreach (LicenseResponse licenseResponse in responses) { if (licenseResponse.Exception != null) { RmsClientManagerLog.LogException(RmsClientManagerLog.RmsClientManagerFeature.Prelicense, context, licenseResponse.Exception); } else { RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.Prelicense, RmsClientManagerLog.RmsClientManagerEvent.Success, context.TransactionId, licenseResponse.UsageRights.ToString(), context.ContextStringForm); } } }
public UseLicenseAsyncResult(RmsClientManagerContext context, Uri licenseUri, XmlNode[] issuanceLicense, object callerState, AsyncCallback callerCallback) : base(context, callerState, callerCallback) { ArgumentValidator.ThrowIfNull("licenseUri", licenseUri); RmsClientManagerUtils.ThrowOnNullOrEmptyArrayArgument("issuanceLicense", issuanceLicense); this.licenseUri = licenseUri; this.issuanceLicense = issuanceLicense; }
internal RightsManagementAsyncResult(RmsClientManagerContext context, object callerState, AsyncCallback callerCallback) : base(null, callerState, RightsManagementAsyncResult.WrapCallbackWithUnhandledExceptionAndCrash(callerCallback)) { ArgumentValidator.ThrowIfNull("context", context); this.context = context; this.adSession = RmsClientManager.ADSession; this.saveContextCallback = RmsClientManager.SaveContextCallback; RmsClientManager.SaveContextCallback = null; }
public static void LogAcquireUseLicense(RmsClientManagerContext context, Uri serverUrl, string user) { if (!RmsClientManagerLog.rmsLogEnabled) { return; } if (context == null) { throw new ArgumentNullException("context"); } RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.UseLicense, RmsClientManagerLog.RmsClientManagerEvent.Acquire, serverUrl, context.OrgId, context.TransactionId, user, context.ContextStringForm); }
public static void LogAcquireUseLicenseResult(RmsClientManagerContext context, string useLicense) { if (!RmsClientManagerLog.rmsLogEnabled) { return; } if (context == null) { throw new ArgumentNullException("context"); } RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.UseLicense, RmsClientManagerLog.RmsClientManagerEvent.Success, context.TransactionId, string.IsNullOrEmpty(useLicense) ? RmsClientManagerLog.UseLicenseEmpty : RmsClientManagerLog.UseLicenseExists, context.ContextStringForm); }
public static void LogAcquireRacClc(RmsClientManagerContext context) { if (!RmsClientManagerLog.rmsLogEnabled) { return; } if (context == null) { throw new ArgumentNullException("context"); } RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.RacClc, RmsClientManagerLog.RmsClientManagerEvent.Acquire, context.OrgId, context.TransactionId, RmsClientManagerLog.AcquireServerRacClc, context.ContextStringForm); }
public static void LogAcquireRmsTemplateResult(RmsClientManagerContext context, RmsTemplate template) { if (!RmsClientManagerLog.rmsLogEnabled) { return; } if (context == null) { throw new ArgumentNullException("context"); } RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.Template, RmsClientManagerLog.RmsClientManagerEvent.Success, context.OrgId, context.TransactionId, template.Id.ToString(), context.ContextStringForm); }
public static void LogVerifySignatureResult(RmsClientManagerContext context, string userIdentity) { if (!RmsClientManagerLog.rmsLogEnabled) { return; } if (context == null) { throw new ArgumentNullException("context"); } RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.SignatureVerification, RmsClientManagerLog.RmsClientManagerEvent.Success, context.OrgId, context.TransactionId, userIdentity, context.ContextStringForm); }
public static void LogDrmInitialization(int machineCertIndex) { if (!RmsClientManagerLog.rmsLogEnabled) { return; } RmsClientManagerContext rmsClientManagerContext = new RmsClientManagerContext(OrganizationId.ForestWideOrgId, null); RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.DrmInitialization, RmsClientManagerLog.RmsClientManagerEvent.Success, default(Guid), string.Format(CultureInfo.InvariantCulture, "Selected machine certificate index: {0}", new object[] { machineCertIndex.ToString(NumberFormatInfo.InvariantInfo) }), rmsClientManagerContext.ContextStringForm); }
internal UseLicenseAndUsageRightsAsyncResult(RmsClientManagerContext context, Uri licensingUri, string publishLicense, XmlNode[] publishLicenseAsXmlNodes, string userIdentity, SecurityIdentifier userSid, bool isSuperUser, object callerState, AsyncCallback callerCallback) : base(context, callerState, callerCallback) { ArgumentValidator.ThrowIfNull("licensingUri", licensingUri); ArgumentValidator.ThrowIfNullOrEmpty("publishLicense", publishLicense); ArgumentValidator.ThrowIfNull("publishLicenseAsXmlNodes", publishLicenseAsXmlNodes); ArgumentValidator.ThrowIfNull("userIdentity", userIdentity); ArgumentValidator.ThrowIfNull("userSid", userSid); this.licensingUri = licensingUri; this.publishLicense = publishLicense; this.publishLicenseAsXmlNodes = publishLicenseAsXmlNodes; this.userIdentity = userIdentity; this.userSid = userSid; this.isSuperUser = isSuperUser; }
public static LicenseeIdentity[] ConvertToLicenseeIdentities(RmsClientManagerContext context, string[] identities) { ArgumentValidator.ThrowIfNull("context", context); RmsClientManagerUtils.ThrowOnNullOrEmptyArrayArgument("identities", identities); LicenseeIdentity[] array = new LicenseeIdentity[identities.Length]; for (int i = 0; i < identities.Length; i++) { if (!SmtpAddress.IsValidSmtpAddress(identities[i])) { throw new RightsManagementException(RightsManagementFailureCode.InvalidRecipient, ServerStrings.RecipientAddressInvalid(identities[i])); } ADRawEntry adrawEntry; try { adrawEntry = context.ResolveRecipient(identities[i]); } catch (ADTransientException innerException) { throw new ExchangeConfigurationException(ServerStrings.FailedToReadUserConfig(identities[i]), innerException); } catch (ADOperationException innerException2) { throw new RightsManagementException(RightsManagementFailureCode.ADUserNotFound, ServerStrings.FailedToReadUserConfig(identities[i]), innerException2); } IList <string> list = RmsClientManagerUtils.EmptyProxyList; string text = null; bool flag = false; if (adrawEntry != null) { ProxyAddressCollection proxyAddressCollection = (ProxyAddressCollection)adrawEntry[ADRecipientSchema.EmailAddresses]; if (proxyAddressCollection != null && proxyAddressCollection.Count != 0) { list = new List <string>(proxyAddressCollection.Count); foreach (ProxyAddress proxyAddress in proxyAddressCollection) { list.Add(proxyAddress.ValueString); } } SmtpAddress smtpAddress = (SmtpAddress)adrawEntry[ADRecipientSchema.PrimarySmtpAddress]; if (smtpAddress.IsValidAddress) { text = smtpAddress.ToString(); } flag = RmsClientManagerUtils.TreatRecipientAsRMSSuperuser(context.OrgId, (RecipientTypeDetails)adrawEntry[ADRecipientSchema.RecipientTypeDetails]); } array[i] = new LicenseeIdentity(string.IsNullOrEmpty(text) ? identities[i] : text, list, flag); } return(array); }
public static void LogAcquirePrelicense(RmsClientManagerContext context, Uri serverUrl, string[] identities) { if (!RmsClientManagerLog.rmsLogEnabled) { return; } if (context == null) { throw new ArgumentNullException("context"); } foreach (string data in identities) { RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.Prelicense, RmsClientManagerLog.RmsClientManagerEvent.Acquire, serverUrl, context.OrgId, context.TransactionId, data, context.ContextStringForm); } }
public static void LogDrmInitialization(Uri rmsServerUri) { if (!RmsClientManagerLog.rmsLogEnabled) { return; } if (rmsServerUri == null) { throw new ArgumentNullException("rmsServerUri"); } RmsClientManagerContext rmsClientManagerContext = new RmsClientManagerContext(OrganizationId.ForestWideOrgId, null); RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.DrmInitialization, RmsClientManagerLog.RmsClientManagerEvent.Success, default(Guid), string.Format(CultureInfo.InvariantCulture, "RMS Server queried for active crypto mode: {0}", new object[] { rmsServerUri.ToString() }), rmsClientManagerContext.ContextStringForm); }
public static void LogAcquireRacClcCacheResult(RmsClientManagerContext context, Uri serviceLocation, Uri publishingLocation, byte version) { if (!RmsClientManagerLog.rmsLogEnabled) { return; } if (context == null) { throw new ArgumentNullException("context"); } RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.RacClc, RmsClientManagerLog.RmsClientManagerEvent.Success, RmsClientManagerLog.DummyUriForRacClcCache, context.OrgId, context.TransactionId, string.Format(CultureInfo.InvariantCulture, "Service Location: {0}; Publishing Location: {1}; Version: {2}", new object[] { serviceLocation.ToString(), publishingLocation.ToString(), version.ToString(NumberFormatInfo.InvariantInfo) }), context.ContextStringForm); }
public static void LogAcquireRacClcResult(RmsClientManagerContext context, TenantLicensePair tenantLicensePair) { if (!RmsClientManagerLog.rmsLogEnabled) { return; } if (context == null) { throw new ArgumentNullException("context"); } RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.RacClc, RmsClientManagerLog.RmsClientManagerEvent.Success, context.OrgId, context.TransactionId, string.Format(CultureInfo.InvariantCulture, "CLC: {0}; RAC: {1}; Version: {2}", new object[] { (tenantLicensePair.BoundLicenseClc == null) ? RmsClientManagerLog.LicenseEmpty : RmsClientManagerLog.LicenseExists, (tenantLicensePair.Rac == null) ? RmsClientManagerLog.LicenseEmpty : RmsClientManagerLog.LicenseExists, tenantLicensePair.Version }).ToString(NumberFormatInfo.InvariantInfo), context.ContextStringForm); }
public static void LogDrmInitialization(DRMClientVersionInfo msdrmVersionInfo) { if (!RmsClientManagerLog.rmsLogEnabled) { return; } if (msdrmVersionInfo == null) { throw new ArgumentNullException("msdrmVersionInfo"); } RmsClientManagerContext rmsClientManagerContext = new RmsClientManagerContext(OrganizationId.ForestWideOrgId, null); RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.DrmInitialization, RmsClientManagerLog.RmsClientManagerEvent.Success, default(Guid), string.Format(CultureInfo.InvariantCulture, "MSDRM.DLL version: {0}.{1}.{2}.{3}", new object[] { msdrmVersionInfo.V1.ToString(), msdrmVersionInfo.V2.ToString(), msdrmVersionInfo.V3.ToString(), msdrmVersionInfo.V4.ToString() }), rmsClientManagerContext.ContextStringForm); }
public TenantLicenseAsyncResult(RmsClientManagerContext context, object callerState, AsyncCallback callerCallback) : base(context, callerState, callerCallback) { }
public FederationServerLicenseAsyncResult(RmsClientManagerContext context, Uri licenseUri, XmlNode[] issuanceLicense, LicenseIdentity[] identities, LicenseResponse[] responses, object callerState, AsyncCallback callerCallback) : base(context, licenseUri, issuanceLicense, callerState, callerCallback) { RmsClientManagerUtils.ThrowOnNullOrEmptyArrayArgument("identities", identities); this.identities = identities; this.responses = responses; }
public TemplateAsyncResult(RmsClientManagerContext context, Guid templateId, object callerState, AsyncCallback callerCallback) : base(context, callerState, callerCallback) { this.templateId = templateId; }
public AcquireServerInfoAsyncResult(RmsClientManagerContext context, Uri licenseUri, object callerState, AsyncCallback callerCallback) : base(context, callerState, callerCallback) { ArgumentValidator.ThrowIfNull("licenseUri", licenseUri); this.licenseUri = licenseUri; this.serverInfo = new ExternalRMSServerInfo(licenseUri); }
public UseLicenseAsyncResult(RmsClientManagerContext context, Uri licenseUri, object callerState, AsyncCallback callerCallback) : base(context, callerState, callerCallback) { this.licenseUri = licenseUri; }
public static void LogException(RmsClientManagerLog.RmsClientManagerFeature clientManagerFeature, RmsClientManagerContext context, Exception ex) { if (!RmsClientManagerLog.rmsLogEnabled) { return; } if (context == null) { throw new ArgumentNullException("context"); } StringBuilder stringBuilder = null; if (ex != null) { stringBuilder = new StringBuilder(ex.Message.Length + ex.GetType().Name.Length + 3); stringBuilder.AppendFormat("{0} [{1}]", ex.Message, ex.GetType().Name); if (ex.InnerException != null) { stringBuilder.AppendFormat("; Inner Exception: {0} [{1}]", ex.InnerException.Message, ex.InnerException.GetType().Name); } } LogRowFormatter logRowFormatter = new LogRowFormatter(RmsClientManagerLog.rmsLogSchema); logRowFormatter[1] = clientManagerFeature; logRowFormatter[2] = RmsClientManagerLog.RmsClientManagerEvent.Exception; Guid transactionId = context.TransactionId; logRowFormatter[7] = context.TransactionId.ToString(); logRowFormatter[6] = context.ContextStringForm; if (stringBuilder != null) { logRowFormatter[5] = stringBuilder.ToString(); } RmsClientManagerLog.Append(logRowFormatter); }
public static void LogUriEvent(RmsClientManagerLog.RmsClientManagerFeature clientManagerFeature, RmsClientManagerLog.RmsClientManagerEvent clientManagerEvent, RmsClientManagerContext context, Uri serverUrl) { if (!RmsClientManagerLog.rmsLogEnabled) { return; } if (context == null) { throw new ArgumentNullException("context"); } RmsClientManagerLog.LogEvent(clientManagerFeature, clientManagerEvent, serverUrl, context.OrgId, context.TransactionId, context.ContextStringForm); }
public SuperUserUseLicenseAsyncResult(RmsClientManagerContext context, Uri licenseUri, XmlNode[] issuanceLicense, object callerState, AsyncCallback callerCallback) : base(context, licenseUri, issuanceLicense, callerState, callerCallback) { }
public PreLicenseAsyncResult(RmsClientManagerContext context, PreLicenseWSManager preLicenseManager, object callerState, AsyncCallback callerCallback) : base(context, callerState, callerCallback) { this.preLicenseManager = preLicenseManager; }
public static IAsyncResult BeginAcquireServerInfo(RmsClientManagerContext context, Uri licenseUri, object state, AsyncCallback callback) { RmsServerInfoManager.ThrowIfNotInitialized(); ArgumentValidator.ThrowIfNull("licenseUri", licenseUri); AcquireServerInfoAsyncResult acquireServerInfoAsyncResult = new AcquireServerInfoAsyncResult(context, licenseUri, state, callback); acquireServerInfoAsyncResult.AddBreadCrumb(Constants.State.BeginAcquireServerInfo); ExternalRMSServerInfo externalRMSServerInfo; if (RmsServerInfoManager.serverInfoMap.TryGet(licenseUri, out externalRMSServerInfo)) { acquireServerInfoAsyncResult.InvokeCallback(); return(acquireServerInfoAsyncResult); } RmsClientManagerLog.LogUriEvent(RmsClientManagerLog.RmsClientManagerFeature.ServerInfo, RmsClientManagerLog.RmsClientManagerEvent.Acquire, context, licenseUri); WebProxy localServerProxy; try { localServerProxy = RmsClientManagerUtils.GetLocalServerProxy(true); } catch (ExchangeConfigurationException value) { acquireServerInfoAsyncResult.InvokeCallback(value); return(acquireServerInfoAsyncResult); } bool flag = RmsServerInfoManager.outstandingFindServiceLocationCalls.EnqueueResult(licenseUri, acquireServerInfoAsyncResult); if (flag) { acquireServerInfoAsyncResult.ServerWSManager = new ServerWSManager(licenseUri, RmsServerInfoManager.perfCounters, acquireServerInfoAsyncResult.LatencyTracker, localServerProxy, RmsClientManager.AppSettings.RmsSoapQueriesTimeout); ServiceType[] serviceTypes = new ServiceType[] { ServiceType.CertificationWSService, ServiceType.ServerLicensingWSService, ServiceType.CertificationMexService, ServiceType.ServerLicensingMexService }; RmsClientManager.TracePass(null, context.SystemProbeId, "Querying the RMS server {0} for server info", new object[] { licenseUri }); acquireServerInfoAsyncResult.AddBreadCrumb(Constants.State.BeginFindServiceLocationsFirstRequest); try { acquireServerInfoAsyncResult.ServerWSManager.BeginFindServiceLocations(serviceTypes, RmsClientManagerUtils.WrapCallbackWithUnhandledExceptionHandlerAndUpdatePoisonContext(new AsyncCallback(RmsServerInfoManager.AcquireServiceLocationCallback)), acquireServerInfoAsyncResult); return(acquireServerInfoAsyncResult); } catch (InvalidOperationException ex) { RmsClientManager.TraceFail(null, context.SystemProbeId, "Hit an exception during BeginFindServiceLocations {0}", new object[] { ex }); acquireServerInfoAsyncResult.InvokeCallback(new RightsManagementException(RightsManagementFailureCode.FindServiceLocationFailed, ServerStrings.FailedToFindServerInfo(licenseUri), ex)); return(acquireServerInfoAsyncResult); } } RmsClientManager.TracePass(null, context.SystemProbeId, "A request for server info for the license uri {0} is already pending. Enqueuing the result", new object[] { licenseUri }); acquireServerInfoAsyncResult.AddBreadCrumb(Constants.State.BeginFindServiceLocationsPendingRequest); return(acquireServerInfoAsyncResult); }