コード例 #1
0
 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;
 }
コード例 #2
0
 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;
 }
コード例 #4
0
 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);
 }
コード例 #6
0
ファイル: EmailSupport.cs プロジェクト: kallex/Caloom
 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);
     }
 }
コード例 #7
0
ファイル: TheBallCore.designer.cs プロジェクト: kallex/Caloom
 private void CopyContentFrom(InformationInput sourceObject)
 {
     InputDescription = sourceObject.InputDescription;
             LocationURL = sourceObject.LocationURL;
             LocalContentName = sourceObject.LocalContentName;
             AuthenticatedDeviceID = sourceObject.AuthenticatedDeviceID;
             IsValidatedAndActive = sourceObject.IsValidatedAndActive;
 }
コード例 #8
0
ファイル: TheBallCore.designer.cs プロジェクト: kallex/Caloom
partial         static void CreateCustomDemo(ref InformationInput customDemoObject);
コード例 #9
0
ファイル: TheBallCore.designer.cs プロジェクト: kallex/Caloom
 public static InformationInput CreateDefault()
 {
     var result = new InformationInput();
             return result;
 }
コード例 #10
0
 public static string GetTarget_InputFetchLocation(InformationInput informationInput)
 {
     return informationInput.RelativeLocation + "_Input";
 }
コード例 #11
0
 public static void ExecuteMethod_VerifyValidInput(InformationInput informationInput)
 {
     if(informationInput.IsValidatedAndActive == false)
         throw new SecurityException("InformationInput is not active");
 }
コード例 #12
0
 public static ProcessFetchedInputs.ProcessInputFromStorageReturnValue ExecuteMethod_ProcessInputFromStorage(string processingOperationName, InformationInput informationInput, string inputFetchLocation)
 {
     var result = new ProcessFetchedInputs.ProcessInputFromStorageReturnValue();
     // TODO: Processing
     return result;
 }