Blog Home  Home Feed your aggregator (RSS 2.0)  
What did you learn today? - 70-551, 70-552, 70-553 Section I, Part XI - Security.Permissions
Phil Denoncourt's Technology Rants
 
 Friday, February 10, 2006
Control permissions for resources by using the System.Security.Permission classes. (Refer System.Security.Permission namespace)
  • SecurityPermission class
  • PrincipalPermission class
  • FileIOPermission class
  • StrongNameIdentityPermission class
  • UIPermission class
  • UrlIdentityPermission class
  • PublisherIdentityPermission class
  • GacIdentityPermission class
  • FileDialogPermission class
  • DataProtectionPermission class
  • EnvironmentPermission class
  • IUnrestrictedPermission interface
  • RegistryPermission class
  • IsolatedStorageFilePermission class
  • KeyContainerPermission class
  • ReflectionPermission class
  • StorePermission class
  • SiteIdentityPermission class

I've really got to get going on these.  I'm scheduled to take 70-552 next Sat, and I'm haven't gotten to the WinForms stuff yet.

These next two parts are on Code Access Security.  Mike Downen (via Julie Lerman) has an intro article on CAS in 2.0.

Update via Zdenko - Michael Stiefel has some good articles on his site.

SecurityPermission class - This is the class that has a lot of base attributes: Execution, SkipVerification, UnmanagedCode, Assertion, BindingRedirects to name a few.  There don't appear to be any new values from 1.1.

PrincipalPermission class - This class allows you to control access by the current identity.  Note the important info in the documentation:

Prior to a demand for principal permission it is necessary to set the current application domain's principal policy to the enumeration value WindowsPrincipal. By default, the principal policy is set to UnauthenticatedPrincipal. If you do not set the principal policy to WindowsPrincipal, a demand for principal permission will fail. The following code should be executed before the principal permission is demanded:

AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal). 

Kaushal Sanghavi has a good article demonstrating the use of PrincipalPermission.

FileIOPermission class - Controls access to file IO.  There are 4 basic rights controlled : Read, Write, Append and Path Discovery.

StrongNameIdentityPermission class - Allows you to limit callers to a specific strongly named assembly.  More information can be found at Morgan Skinner.

UIPermission class - Allows you to specify the permissions for UI (Winforms).  Whether or not a window can be shown, whether or not more than one window can be shown, whether or not the application can access the clipboard, only a system specific clipboard, or no access whatsoever.

UrlIdentityPermission class - In the same spirit as StrongNameIdentityPermission, allows you to limit callers by a URL.

PublisherIdentityPermission class - Limits calls by a specific publisher (using Digital certificates)

GacIdentityPermission class - This is new in 2.0 - Allows you to limit access by whether or not an assembly is located in the GAC.

FileDialogPermission class - Controls whether or not the assembly can open a File dialog box.

DataProtectionPermission class - New to 2.0.  Controls whether or not the assembly can use the new data protection (DPAPI) features.  You can retrict the user to protect data, unprotect data, protect memory or unprotect memory.

EnviromentPermission class - Controls access to user and system environment variables.

IUnrestrictedPermission class - Allows a permission to expose an unrestricted state.  Peter Torr has a nugget of trivia about this interface buried in his post.

RegistryPermission class - Controls access to the registry.

IsolatedStorageFilePermission class - Controls access to isolated storage.  Can control the size (Quota) and the type of store (Application, Domain, or Assembly)

KeyContainerPermission class - New to 2.0.  Controls access to Key Containers.  You can control access by each CSP, or grant unrestricted rights.

ReflectionPermission class - Controls access to assembly metadata via reflection.  You can control whether or not access to members is allowed, access to types, and whether or not assemblies can be dynamically generated.

StorePermission class - New to 2.0 Controls access to X.509 Certificate stores.  Can control add/remove of certificates, opening of a store, enumeration of certificates, and the creation/deletion of stores.

SiteIdentityPermission class - Limit calls to a specific site (domain).

Next up -> Security.Policy

Friday, February 10, 2006 9:20:54 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Certifications  | 
Comments are closed.
Copyright © 2008 Phil Denoncourt III. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: