I have defined a custom IPrincipal and a custom IIdentity based on a website that defines both valid identifiers and their permissions. Both of these classes are intended for use in the assembly used in a Windows forms application.
The question is, when using the declarative attribute PrincipalPermission on top of my assembly classes, how to ensure that my custom IPrincipal and IIdentity classes are used, and not some other IPrincipal / IIdentity that can be authenticated.
[PrincipalPermission(SecurityAction.Demand, Authenticated = true, Role = "limited")] public class RequiresAuthentication { }
: (IP), IIdentity IPrincipal, (RP), .
IIdentity
IPrincipal
RP , IPrincipal, .
, , IP-. , , - IIdentity IPrincipal.
IP- , , IPrincipal .
EDIT:
, , , , "limited", IP- . , , , . , , URI . , , IPrincipal, , , - IP-.
"limited"
Windows Identity Foundation ( , ) , .
, , .
PrincipalPermission ( PrincipalPermissionAttribute) Thread.CurrentPrincipal, , IPrincipal .
, IPrincipal, CustomPrincipalPermission, PrincipalPermission.
/.
, CodeAccessSecurityAttribute, CreatePermission, ( IPermission IUnrestrictedPermission), . , . , , .
CodeAccessSecurityAttribute
CreatePermission
IPermission
IUnrestrictedPermission
[MyPrincipalPermission(SecurityAction.Demand, Roles = MyRoles.Limited)] public void Foo() { ... }
- , Intersect, Union .., , , , - 2-5 , , .
Intersect
Union
Source: https://habr.com/ru/post/1721986/More articles:Parallel Computing Tests MbUnit - c #Eye Detection in MATLAB - image-processingCode Completion in Vi - editorEye Recognition MATLAB - matlabJQuery - getting all multibyte list values - jquerysleep initialization - javaGetting strange characters in text in Drupal ... there may be problems with the encoding, but how to solve it - encodingHow to display everything except the first row of the table? - sqlSetting mouse tracking speed using applescript - applescriptAre there any Visual Studio macro distribution sites? - macrosAll Articles