示例#1
0
        /// <summary>
        /// Gets a local or global key provider associated with the specified name.
        /// If there is no local key provider associated with the specified name, this method returns the corresponding Key Provider
        /// from the global Security Session Key Providers collection.
        /// </summary>
        /// <param name="name">The name of key provider.</param>
        /// <returns>Created key provider.</returns>
        public IKeyProvider GetKey(string name)
        {
            IKeyProvider keyProvider = this._keys[name] as IKeyProvider;

            if (keyProvider == null)
            {
                keyProvider = SecuritySessionServices.GetGlobalKey(name);
            }

            return(keyProvider);
        }
示例#2
0
 /// <summary>
 /// Restores security context.
 /// </summary>
 public void Dispose()
 {
     SecuritySessionServices.SetCurrentSecurityContext(this._previousSecuritySessionParameters);
 }
示例#3
0
 /// <summary>
 /// Forces the specified security context to be used in all calls in
 /// the current thread until Dispose method is called.
 /// </summary>
 /// <param name="securitySessionParameters">Security Session parameters.</param>
 public SecurityContextKeeper(SecuritySessionParameters securitySessionParameters)
 {
     this._previousSecuritySessionParameters = SecuritySessionServices.SetCurrentSecurityContext(securitySessionParameters);
 }