public static string GetTarget_InputFetchName(InformationInput informationInput) { // TODO: timestamped, incremental and other options supported, now just bulk string localContentName = informationInput.LocalContentName; if (string.IsNullOrEmpty(localContentName)) return "bulkdump.all"; return informationInput.LocalContentName; }
public static AuthenticatedAsActiveDevice GetTarget_AuthenticatedAsActiveDevice(InformationInput informationInput) { var authenticationID = informationInput.AuthenticatedDeviceID; if (string.IsNullOrEmpty(authenticationID)) return null; VirtualOwner owner = VirtualOwner.FigureOwner(informationInput); return AuthenticatedAsActiveDevice.RetrieveFromOwnerContent(owner, authenticationID); }
public static TBEmailValidation GetTarget_EmailValidation(TBAccount owningAccount, TBCollaboratingGroup owningGroup, InformationInput informationInput, string[] ownerEmailAddresses) { TBEmailValidation emailValidation = new TBEmailValidation(); emailValidation.InformationInputConfirmation = new TBInformationInputConfirmation(); if (owningAccount != null && owningGroup != null) throw new InvalidDataException("Both owning account and owning group cannot be defined"); if (owningAccount == null && owningGroup == null) throw new InvalidDataException("Both owning account and owning group must not be null"); if (owningAccount != null) emailValidation.InformationInputConfirmation.AccountID = owningAccount.ID; if (owningGroup != null) emailValidation.InformationInputConfirmation.GroupID = owningGroup.ID; emailValidation.InformationInputConfirmation.InformationInputID = informationInput.ID; emailValidation.ValidUntil = DateTime.UtcNow.AddMinutes(30); emailValidation.Email = ownerEmailAddresses.FirstOrDefault(); if (emailValidation.Email == null) throw new InvalidDataException("Owner must have at least one email address defined"); return emailValidation; }
public static void ExecuteMethod_FetchInputToStorage(IContainerOwner owner, string queryParameters, InformationInput informationInput, string inputFetchLocation, string inputFetchName, AuthenticatedAsActiveDevice authenticatedAsActiveDevice) { string url = string.IsNullOrEmpty(queryParameters) ? informationInput.LocationURL : informationInput.LocationURL + queryParameters; if (authenticatedAsActiveDevice == null) { WebRequest getRequest = WebRequest.Create(url); var response = getRequest.GetResponse(); var stream = response.GetResponseStream(); var targetBlob = StorageSupport.CurrActiveContainer.GetBlob(inputFetchLocation + "/" + inputFetchName, owner); targetBlob.UploadFromStream(stream); } else { HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url); request.Method = "GET"; request.Headers.Add("Authorization", "DeviceAES::" + authenticatedAsActiveDevice.EstablishedTrustID + ":"); HttpWebResponse response = (HttpWebResponse) request.GetResponse(); if (response.StatusCode != HttpStatusCode.OK) throw new InvalidOperationException("Authroized fetch failed with non-OK status code"); string ivStr = response.Headers["IV"]; string contentRoot = inputFetchLocation; string blobName = contentRoot + "/" + inputFetchName; var blob = StorageSupport.GetOwnerBlobReference(owner, blobName); if (blob.Name != blobName) throw new InvalidDataException("Invalid content name"); var respStream = response.GetResponseStream(); AesManaged aes = new AesManaged(); aes.KeySize = SymmetricSupport.AES_KEYSIZE; aes.BlockSize = SymmetricSupport.AES_BLOCKSIZE; aes.IV = Convert.FromBase64String(ivStr); aes.Key = authenticatedAsActiveDevice.ActiveSymmetricAESKey; aes.Padding = SymmetricSupport.PADDING_MODE; aes.Mode = SymmetricSupport.AES_MODE; aes.FeedbackSize = SymmetricSupport.AES_FEEDBACK_SIZE; var decryptor = aes.CreateDecryptor(aes.Key, aes.IV); CryptoStream cryptoStream = new CryptoStream(respStream, decryptor, CryptoStreamMode.Read); blob.UploadFromStream(cryptoStream); } }
public static void ExecuteMethod_SendEmailConfirmation(InformationInput informationInput, TBEmailValidation emailValidation, string[] ownerEmailAddresses) { EmailSupport.SendInputJoinEmail(emailValidation, informationInput, ownerEmailAddresses); }
public static void SendInputJoinEmail(TBEmailValidation emailValidation, InformationInput informationInput, string[] ownerEmailAddresses) { string urlLink = GetUrlLink(emailValidation.ID); bool isAccount = emailValidation.InformationInputConfirmation.AccountID != null; string ownerID = isAccount ? emailValidation.InformationInputConfirmation.AccountID : emailValidation.InformationInputConfirmation.GroupID; string emailMessageFormat = InstanceConfiguration.EmailInputJoinMessageFormat; string message = String.Format(emailMessageFormat, informationInput.InputDescription, isAccount ? "account" : "collaboration group", ownerID, urlLink); string subject = String.Format(InstanceConfiguration.EmailInputJoinSubjectFormat, ownerID); foreach (string emailAddress in ownerEmailAddresses) { SendEmail(FromAddress, emailAddress, subject, message); } }
private void CopyContentFrom(InformationInput sourceObject) { InputDescription = sourceObject.InputDescription; LocationURL = sourceObject.LocationURL; LocalContentName = sourceObject.LocalContentName; AuthenticatedDeviceID = sourceObject.AuthenticatedDeviceID; IsValidatedAndActive = sourceObject.IsValidatedAndActive; }
partial static void CreateCustomDemo(ref InformationInput customDemoObject);
public static InformationInput CreateDefault() { var result = new InformationInput(); return result; }
public static string GetTarget_InputFetchLocation(InformationInput informationInput) { return informationInput.RelativeLocation + "_Input"; }
public static void ExecuteMethod_VerifyValidInput(InformationInput informationInput) { if(informationInput.IsValidatedAndActive == false) throw new SecurityException("InformationInput is not active"); }
public static ProcessFetchedInputs.ProcessInputFromStorageReturnValue ExecuteMethod_ProcessInputFromStorage(string processingOperationName, InformationInput informationInput, string inputFetchLocation) { var result = new ProcessFetchedInputs.ProcessInputFromStorageReturnValue(); // TODO: Processing return result; }