public static AsymmetricKeyCredentials ConvertExtToInt(this AuthenticationCredentialsExt credentials)
        {
            AsymmetricKeyCredentialsExt asymmetricKeyCredentials = credentials as AsymmetricKeyCredentialsExt;
            AsymmetricKeyCredentials    convert = new AsymmetricKeyCredentials
            {
                Username   = credentials.Username,
                PrivateKey = asymmetricKeyCredentials.PrivateKey,
                PublicKey  = asymmetricKeyCredentials.PublicKey
            };

            return(convert);
        }
Esempio n. 2
0
        public void EndFileTransfer(long submittedJobInfoId, FileTransferMethod transferMethod, AdaptorUser loggedUser)
        {
            log.Info("Removing file transfer method for submitted job info ID " + submittedJobInfoId + " with user " + loggedUser.GetLogIdentification());
            SubmittedJobInfo         jobInfo = LogicFactory.GetLogicFactory().CreateJobManagementLogic(unitOfWork).GetSubmittedJobInfoById(submittedJobInfoId, loggedUser);
            AsymmetricKeyCredentials asymmetricKeyCredentials = transferMethod.Credentials as AsymmetricKeyCredentials;

            if (asymmetricKeyCredentials != null)
            {
                SchedulerFactory.GetInstance(jobInfo.Specification.Cluster.SchedulerType).CreateScheduler(jobInfo.Specification.Cluster).
                RemoveDirectFileTransferAccessForUserToJob(asymmetricKeyCredentials.PublicKey, jobInfo);
            }
            else
            {
                log.Error("Credentials of class " + transferMethod.Credentials.GetType().Name +
                          " are not supported. Change the HaaSMiddleware.BusinessLogicTier.FileTransfer.FileTransferLogic.EndFileTransfer() method to add support for additional credential types.");
                throw new ArgumentException("Credentials of class " + transferMethod.Credentials.GetType().Name +
                                            " are not supported. Change the HaaSMiddleware.BusinessLogicTier.FileTransfer.FileTransferLogic.EndFileTransfer() method to add support for additional credential types.");
            }
        }