Ejemplo n.º 1
0
        public ShellApplication(object password, UserSessionService userSessionService, EventWaitHandle loadedEvent, string securityTokenXml)
        {
            if (password != null)
            {
                _password = SecureStringHelper.GetSecureString(Marshal.PtrToStringBSTR((IntPtr)password));
                SecureStringHelper.FreeString((IntPtr)password);
            }

            _userSessionService = userSessionService;
            _loadedEvent        = loadedEvent;

            if (securityTokenXml != null)
            {
                _tokenCache = Imi.Framework.UX.Identity.SecurityTokenCache.Deserialize(securityTokenXml);
            }
            else
            {
                _tokenCache = new Imi.Framework.UX.Identity.SecurityTokenCache();
            }

            _settingsLoadedEvent = new EventWaitHandle(false, EventResetMode.AutoReset);

            Thread.CurrentThread.CurrentUICulture = userSessionService.UICulture;

            Run();
        }
Ejemplo n.º 2
0
        public static string Serialize(SecurityTokenCache tokenCache)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(SecurityTokenCache));

            using (StringWriter sw = new StringWriter())
            {
                serializer.Serialize(sw, tokenCache);
                return(sw.ToString());
            }
        }
 public CachedClientCredentials(CachedClientCredentials clientCredentials) : base(clientCredentials)
 {
     this.TokenCache = clientCredentials.TokenCache;
 }
 public CachedClientCredentials(SecurityTokenCache tokenCache, ClientCredentials clientCredentials)
     : base(clientCredentials)
 {
     this.TokenCache = tokenCache;
 }