|
security
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Emulating the [PrincipalPermissionAttribute ...] attributeI use the Enterprise Library, and the custom rule provider. A rule is check with this piece of code: public void HireEmployee (....) { string rule = "Hire Employee"; // The next line fetch the rule definition in a config file, and checks it with the role the object "myPrincipal" belongs to. if (! this.ruleProvider.Authorize (this.myPrincipal, rule)) { MessageBox.Show ("Youe are not authorise to hire en employee"); return; } ... // plenty of interesting lines } ____________________________________________________________________________ ____ I would like to have this style of code: [PrincipalRuleAttribute Name="Hire Employee"] public void HireEmployee (....) { ... // plenty of interesting lines } In that case, if a call is made to "HireEmployee", a security exception is thrown... I know only the basics of the Attribute class, and I don't really see what to do... Oriane Hello Oriane,
you have to implement a custom permission to accomplish that - maybe this is a starting point http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/HTCustEncr.asp --------------------------------------- Dominick Baier - DevelopMentor http://www.leastprivilege.com Show quoteHide quote > Hi, > > I use the Enterprise Library, and the custom rule provider. A rule is > check with this piece of code: > > public void HireEmployee (....) { > string rule = "Hire Employee"; > // The next line fetch the rule definition in a config file, and > checks > it with the role the object "myPrincipal" belongs to. > if (! this.ruleProvider.Authorize (this.myPrincipal, rule)) { > MessageBox.Show ("Youe are not authorise to hire en > employee"); > return; > } > ... // plenty of interesting lines > } > ______________________________________________________________________ > ______ > ____ > I would like to have this style of code: > [PrincipalRuleAttribute Name="Hire Employee"] > public void HireEmployee (....) { > ... // plenty of interesting lines > } > In that case, if a call is made to "HireEmployee", a security > exception is thrown... > > I know only the basics of the Attribute class, and I don't really see > what to do... > > Oriane > OK.
Thank you. "Dominick Baier [DevelopMentor]" <dbaier@pleasepleasenospamdevelop.com> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/HTCustEncr.aspwrote in message news:288289632496929039837184@news.microsoft.com... > Hello Oriane, > > you have to implement a custom permission to accomplish that - > > maybe this is a starting point > Show quoteHide quote > > > --------------------------------------- > Dominick Baier - DevelopMentor > http://www.leastprivilege.com > > > Hi, > > > > I use the Enterprise Library, and the custom rule provider. A rule is > > check with this piece of code: > > > > public void HireEmployee (....) { > > string rule = "Hire Employee"; > > // The next line fetch the rule definition in a config file, and > > checks > > it with the role the object "myPrincipal" belongs to. > > if (! this.ruleProvider.Authorize (this.myPrincipal, rule)) { > > MessageBox.Show ("Youe are not authorise to hire en > > employee"); > > return; > > } > > ... // plenty of interesting lines > > } > > ______________________________________________________________________ > > ______ > > ____ > > I would like to have this style of code: > > [PrincipalRuleAttribute Name="Hire Employee"] > > public void HireEmployee (....) { > > ... // plenty of interesting lines > > } > > In that case, if a call is made to "HireEmployee", a security > > exception is thrown... > > > > I know only the basics of the Attribute class, and I don't really see > > what to do... > > > > Oriane > > > > >
Encrypt with RijndaelManaged and decrypt with OpenSSL
IsAuthenticated property on IIdentity interface UIPermission Clipboard Logon user from service running dll from a network share Windows security context How do I filter an Active Directory search to an OU (organizational unit)? code level / db security over network AzMan - ADAM store. Help needed with TSL problem. |
|||||||||||||||||||||||