public void CheckStoreAndLoadRA() { SimiasAccessLogger accessLog = new SimiasAccessLogger("Service", "Loading RA's"); Store store = Store.GetStore(); //Load the RSA for the domain - need to see how this can be migrated --FIXME if (store.DefaultDomain != null) { //Store the DEFAULT certificate(RSA information) for users using the "Server Default" option in client // need to find a better way of representing DEFAULT Simias.Security.RSAStore.CheckAndStoreRSA(store.DefaultRSARA.ToXmlString(true), "DEFAULT", true); } X509Certificate raCert = null; try { Simias.Configuration config = Store.Config; string raPath = config.Get("Server", "RAPath"); if (raPath != null && raPath != String.Empty && raPath != "") { string[] racertFiles = Directory.GetFiles(raPath, "*.?er"); Simias.Security.CertificateStore.CleanCertsFromStore(); foreach (string file in racertFiles) { try { raCert = X509Certificate.CreateFromCertFile(file); } catch (CryptographicException ce) { log.Debug("Exception {0}, File: {1}", ce.ToString(), file); continue; } //Simias.Security.CertificateStore.StoreRACertificate (raCert.GetRawCertData(), raCert.GetName().ToLower(), true); Simias.Security.CertificateStore.StoreRACertificate(raCert.GetRawCertData(), Path.GetFileNameWithoutExtension(file).ToLower(), true); accessLog.LogAccess("CheckStoreAndLoadRA", "Loading RecoveryAgent", "-", raCert.GetName()); } } } catch (Exception e) { log.Error(e.ToString()); accessLog.LogAccess("CheckStoreAndLoadRA", "Failed Loading RecoveryAgent", "-", "-"); } Simias.Security.CertificateStore.LoadRACertsFromStore(); //this loads all Certs including RA - but client will not have RA if (store.DefaultDomain != null) //load the RSA data from store - only on server { Simias.Security.RSAStore.LoadRSAFromStore(); } }
/// <summary> /// Constructor /// </summary> /// <param name="ifolderID">The ID of the iFolder.</param> /// <param name="entryID">The ID of the Entry.</param> /// <param name="accessID">The Access ID.</param> public iFolderFile(string ifolderID, string entryID, string accessID) { Store store = Store.GetStore(); collection = store.GetCollectionByID(ifolderID); if (collection == null) { throw new iFolderDoesNotExistException(ifolderID); } // impersonate this.accessID = accessID; iFolder.Impersonate(collection, accessID); // member member = collection.GetMemberByID(accessID); // does member exist? if (member == null) { throw new MemberDoesNotExistException(accessID); } // node Node n = collection.GetNodeByID(entryID); // does the node exist? if (n == null) { throw new EntryDoesNotExistException(entryID); } // is the node a file if (!n.IsBaseType(NodeTypes.FileNodeType)) { throw new FileDoesNotExistException(entryID); } // log log = new SimiasAccessLogger(member.Name, collection.ID); // node node = (FileNode)n; id = String.Format("{0}:{1}", collection.ID, n.ID); path = node.GetFullPath(collection); updating = false; }
/// <summary> /// Initialize the Request /// </summary> /// <param name="context">The HttpContext object.</param> protected void Initialize(HttpContext context) { // query ifolderID = context.Request.QueryString["iFolder"]; entryID = context.Request.QueryString["Entry"]; entryPath = context.Request.QueryString["Path"]; string ppath = entryPath; string [] ConversionTable = { "&", "amp@:quot" }; if (ppath != null) { for (int index = 0; index < ConversionTable.Length; index += 2) { ppath = ppath.Replace(ConversionTable[index + 1], ConversionTable[index]); } } entryPath = ppath; // authentication accessID = context.User.Identity.Name; if ((accessID == null) || (accessID.Length == 0)) { throw new AuthenticationException(); } // store store = Store.GetStore(); // collection collection = store.GetCollectionByID(ifolderID); if (collection == null) { throw new iFolderDoesNotExistException(ifolderID); } // member member = collection.GetMemberByID(accessID); // does member exist? if (member == null && Simias.Service.Manager.LdapServiceEnabled == true) { Domain domain = store.GetDomain(store.DefaultDomain); string[] IDs = domain.GetMemberFamilyList(accessID); foreach (string id in IDs) { member = collection.GetMemberByID(id); if (member != null) { break; } } } if (member == null) { throw new MemberDoesNotExistException(accessID); } // impersonate iFolder.Impersonate(collection, accessID); // log log = new SimiasAccessLogger(member.Name, collection.ID); // node Node n = null; // use the path if ((entryPath != null) && (entryPath.Length != 0)) { n = iFolderEntry.GetEntryByPath(collection, entryPath); } // use the id if ((entryID != null) && (entryID.Length != 0)) { n = collection.GetNodeByID(entryID); } // check node if (n != null) { // is the node a file if (!n.IsBaseType(NodeTypes.FileNodeType)) { throw new FileDoesNotExistException(entryID); } // file node = (FileNode)n; filename = node.GetFileName(); filePath = node.GetFullPath(collection); } }