Ejemplo n.º 1
0
        public static PublishedApplication[] GetPublishedApplications(System.Security.Principal.WindowsIdentity user)
        {
            //Todo get published application from web service

            WebServiceAPI   service = new WebServiceAPI();
            WindowsIdentity usr     = service.GetUser(user);

// orig source
//            PublishedApplication[] apps = service.GetApplicationsByCredentials(usr, usr.UserName, "", new string[] { "defaults" }, new string[] { "all" }, new string[] { "all" });

            PublishedApplication[] apps = null;
            try
            {
                apps = service.GetApplicationsByCredentials(usr, usr.UserName, "", new string[] { "defaults" }, new string[] { "all" }, new string[] { "all" });
            }
            catch (Exception ex)
            {
                SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory("Extentrix", TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, ex.Message, ex.StackTrace);
                Logger.Default.Error("An error occured during getting published applications", ex);
            }

            /*XmlDocument xmlDoc = new XmlDocument();
             * xmlDoc.Load(SPContext.Current.Web.Url + "/_layouts/Images/ExtentrixWebIntrface/Applications.xml");
             * string xml = xmlDoc.InnerXml;
             * List<PublishedApplication> appsList = Util.GetPublishedApplications();
             * PublishedApplication[] apps = appsList.ToArray();*/

            return(apps);
        }
Ejemplo n.º 2
0
 public Credentials GetCredentials(SPUser user)
 {
     System.Security.Principal.WindowsIdentity winUser = System.Security.Principal.WindowsIdentity.GetCurrent();
     if (SPClaimProviderManager.IsClaimsUser())
     {
         Logger.Default.Error(LogLocation, string.Format("Can't get applications for {0}. You should use Secure Store option for web peb part.", winUser != null ? winUser.Name : null), new ApplicationException("Claim based authentication not supported"));
     }
     return(service.GetUser(winUser));
 }
Ejemplo n.º 3
0
 public void LaunchApplication(System.Security.Principal.WindowsIdentity user, string host, RedirectionApplication redirectApp)
 {
     try
     {
         ApplicationItem appInfo = _service.GetApplicationInfo(redirectApp.InternalName, _service.GetUser(user), host, "", null, null, null, redirectApp.FarmName);
         if (!string.IsNullOrEmpty(appInfo.ContentAddress))
         {
             String address = appInfo.ContentAddress;
             if (address != null)
             {
                 this.Page.Response.Redirect(address);
             }
         }
         else
         {
             string app = _service.LaunchApplication(redirectApp.InternalName, _service.GetUser(user), host, "", redirectApp.FarmName);
             this.Page.Response.Clear();
             this.Page.Response.ClearContent();
             this.Page.Response.ClearHeaders();
             this.Page.Response.ContentType = "application/x-ica";
             this.Page.Response.AddHeader("Content-Type", "application/x-ica");
             this.Page.Response.BinaryWrite(this.Page.Response.ContentEncoding.GetBytes(app));
             this.Page.Response.End();
         }
     }
     catch (ThreadAbortException)
     {
         //Do nothing
     }
     catch (Exception ex)
     {
         SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory("Extentrix", TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, ex.Message, ex.StackTrace);
         PageLogger.Error("An error occured during launch application", ex);
     }
 }