コード例 #1
0
        public bool IsAuthorizedForOperation(WindowsIdentity clientIdentity)
        {
            bool isAccessAllowed = false;

            if (clientIdentity == null)
            {
                throw Fx.AssertAndThrow("NULL Identity");
            }
            if (IntPtr.Zero == clientIdentity.Token)
            {
                throw Fx.AssertAndThrow("Token handle cannot be zero");
            }
            lock (this)
            {
                if (this.securityDescriptor == null)
                {
                    this.BuildSecurityDescriptor();
                }
            }
            System.ServiceModel.ComIntegration.LUID modifiedIDLUID = System.ServiceModel.ComIntegration.SecurityUtils.GetModifiedIDLUID(new SafeCloseHandle(clientIdentity.Token, false));
            if (!this.IsAccessCached(modifiedIDLUID, out isAccessAllowed))
            {
                this.CheckAccess(clientIdentity, out isAccessAllowed);
                this.CacheAccessCheck(modifiedIDLUID, isAccessAllowed);
            }
            return(isAccessAllowed);
        }
コード例 #2
0
 private void CacheAccessCheck(System.ServiceModel.ComIntegration.LUID luidModifiedID, bool isAccessAllowed)
 {
     if (this.accessCheckCache == null)
     {
         throw Fx.AssertAndThrowFatal("AcessCheckCache must not be NULL");
     }
     lock (this)
     {
         this.accessCheckCache[luidModifiedID] = isAccessAllowed;
     }
 }
コード例 #3
0
 private bool IsAccessCached(System.ServiceModel.ComIntegration.LUID luidModifiedID, out bool isAccessAllowed)
 {
     if (this.accessCheckCache == null)
     {
         throw Fx.AssertAndThrowFatal("AcessCheckCache must not be NULL");
     }
     lock (this)
     {
         return(this.accessCheckCache.TryGetValue(luidModifiedID, out isAccessAllowed));
     }
 }