protected void Page_Load(object sender, EventArgs e)
        {
            this.Label1.Text = WindowsIdentity.GetCurrent().Name;
            NetSqlAzManAuthorizationContext ctx = new NetSqlAzManAuthorizationContext(
                "data source=(local);Initial Catalog=NetSqlAzManStorage;User id=sa;password="******"Eidos",
                "DB Persone",
                this.Request.LogonUserIdentity,
                false);

            ctx.CheckSecurity(this);
        }
Exemple #2
0
        private void Form2_Load(object sender, EventArgs e)
        {
            NetSqlAzManAuthorizationContext ctx = new NetSqlAzManAuthorizationContext(
                "data source=(local);Initial Catalog=NetSqlAzManStorage;User id=sa;password="******"Eidos",
                "DB Persone",
                WindowsIdentity.GetCurrent(),
                true);

            var auth = ctx.StorageCache.CheckAccess("Eidos", "DB Persone", "Gestore", ctx.Storage.GetDBUser("John").CustomSid.StringValue, DateTime.Now, false);

            MessageBox.Show(auth.ToString());
            //Optionally you can intercept events before and after the Access Check
            //ctx.BeforeCheckAccess += new BeforeCheckAccessHandler(NetSqlAzManAuthorizationContext_BeforeCheckAccess);
            //ctx.AfterCheckAccess += new AfterCheckAccessHandler(NetSqlAzManAuthorizationContext_AfterCheckAccess);

            //If using the Storage Cache … you can also invalidate the cache
            //ctx.InvalidateCache();

            ctx.CheckSecurity(this);
            auth = ctx.Storage.CheckAccess("Eidos", "DB Persone", "Gestore", WindowsIdentity.GetCurrent(), DateTime.Now, false);
            MessageBox.Show(auth.ToString());
        }