Commit Graph
49 Commits
Author SHA1 Message Date
Marek Safar 336382e2b1 [corlib] corcompare update 2014-08-25 13:12:42 +02:00
Marek Safar 0661867309 [corlib] Improve System.Security.Claims. Fixes #22282 2014-08-22 22:09:11 +02:00
Marek Safar c1028cf912 [corlib] Fix public api 2014-05-20 19:35:25 +02:00
Miguel de Icaza d5c37b6a12 [System.Security.Claims] Add ClaimsPrincipal 2014-05-15 12:54:16 -04:00
Sebastien Pouliot f7882be852 Relax name check when deserializing a WindowsIdentity instance as the name can be empty (e.g. iOS7 simulator will hide the user name) [#12789] 2013-09-30 20:39:14 -04:00
Marek Safar 6e9243f1ed Add accidentally removed string conversion 2013-01-21 09:18:05 +01:00
James Bellinger 9322e0d16b ACLs now work on Windows. Tests all the way up to DirectorySecurityTest and FileSecurityTest.
NativeObjectSecurity is implemented.
I've done it in such a way that, for OSes that do not have a unified API for all ACLs,
overrides can be done in subclasses such as FileSystemSecurity without trouble.

ObjectSecurity, CommonObjectSecurity, and DirectoryObjectSecurity all implemented.
MutexSecurity, PipeSecurity, etc. all just add type specialization and nothing else. Implemented all of these as well.

Access and Audit rules now correctly use NTAccount in their string overloads (see unit tests).
The constructors all provide correct AccessMasks now. In other words, these classes are all now un-broken/no longer stubs.

More unit tests for CommonSecurityDescriptor and fixes to pass them.
A few had checks that were redundant (implemented by (Authorization|Audit|Access)Rule) as well. These have been removed.
The Allow Everyone Full Access default for null DiscretionaryAcls in CommonSecurityDescriptor is, I think,
properly implemented. This required some changes to GenericSecurityDescriptor as well, but now Mono matches
MS.NET on GetSddl/GetBinaryForm for null DiscretionaryAcl including roundtrip.

What's still missing:
(1) CommonAcl's RemoveAccess/RemoveAudit. RemoveAll and RemoveSpecific work so it's not a big issue.
(2) CommonAcl merging will not yet try to merge a CommonAce together with an ObjectAce.
(3) The various *Security constructors. Get/SetAccessControl work on files and directories.
However, you still have to create and then set. I am not too familiar with Mono runtime internal
calls, but to someone who is: If the SECURITY_ATTRIBUTES parameter to Create*'s lpSecurityDescriptor
pointed to the output of GenericSecurityDescriptor's GetBinaryForm, that would be a complete
implementation.
2012-07-07 18:45:06 -04:00
James Bellinger 2d415e7a8f Implemented all of DiscretionaryAcl except for RemoveAccess. Unit tests are included.
Also fixed:
CommonAcl's merging now filters out AceFlags.InheritedFlags when !IsContainer.
For matching AccessMask, CommonAcl will now correctly merge ContainerInherit and ObjectInherit.
GenericAcl's SyncRoot is now virtual as per spec.
SecurityIdentifier.CompareTo throws ArgumentNullException, not NullReferenceException, on null parameter.

Miscellaneous unit tests:
Verify that RawAcl throws for negative capacity.
2012-07-03 13:56:55 -04:00
James Bellinger 6cfe403fda CommonAcl is now essentially fully functional. Its descendants DiscretionaryAcl
and SystemAcl need work, but CommonAcl can be manipulated using RawAcls nicely
now and will test canonicity, merge ACEs, remove meaningless ACEs, sort explicit
deny/allow ACEs by SecurityIdentifier... all the nice things CommonAcl is supposed
to do.

Anyway, this patch... Off the top of my head...
Fixed CommonAce and ObjectAce deserialization/roundtripping with opaque data.
Fixed ObjectAce having the wrong BinaryLength depending on ObjectAceFlags.
GenericAce had two protected static SDDL methods which should be internal.

Added some unit tests for the above. One of the tests compares the binary
output with a blob I produced using the *same unit test* on MS.NET (with a
File.WriteAllText creating the byte array to paste in, naturally), and
happily, it produces identical binary output. Very nice.
2012-07-02 23:19:27 -04:00
James Bellinger 95db8e694e SecurityIdentifier's CompareTo now works like MS.Net. CommonAcl is supposed to sort groupings of canonical ACEs using SecurityIdentifier's CompareTo, so this was important to do.
I determined the behavior of CompareTo by first writing unit tests for
CommonAcl (instantiated as DiscretionaryAcl but using RawAcl instead of
DiscretionaryAcl methods to do the manipulation to keep DiscretionaryAcl
out of the loop). I developed and ran these unit tests on MS.NET using
MonoDevelop...

Anyway, CompareTo appears to compare authority, then the *number* of
subauthorities, and lastly the subauthorities. I'd be curious if there
is more detail, but so far this seems to cover it. It's definitely
*not* just a comparison of the string.

This patch also modifies CommonAcl to take advantage of this new sorting,
so now it should sort groups of explicit ACEs (access deny, access allow)
in canonical ACLs correctly.

With that down, I've got two unit tests that still fail on Mono.
2012-07-02 23:18:25 -04:00
Marek Safar 5b82f0e08c Clean up some NET_2_0 2012-06-14 15:44:35 +01:00
Gonzalo Paniagua Javier df5d05c37f Attempt 1 2011-02-09 12:04:56 -05:00
Kenneth Bell c47765e4a2 Implement SecurityIdentifier and improve NTAccount.
* Only translates between SecurityIdentifier and NTAccount for
    well-known accounts.

  * NTAccount changed to not upper-case values to match behaviour
    observed in Microsoft's .NET (see also unit tests)

  * Add unit tests for both classes
2011-01-26 17:59:52 -05:00
Miguel de Icaza 0072468499 Reduce code duplication
svn path=/trunk/mcs/; revision=146701
2009-11-23 03:45:41 +00:00
Miguel de Icaza 3c39ac4586 Jumbo patch for NET_2_0, mscorlib is now clean
svn path=/trunk/mcs/; revision=145621
2009-11-06 22:23:59 +00:00
Miguel de Icaza 8e07acf772 Multiple files:
Deals with the extension to Environment.OSVersion.Platform that might return a new
value MacOSX (6) on .NET
 

svn path=/trunk/mcs/; revision=121711
2008-12-17 17:56:25 +00:00
Sebastien Pouliot 96d9643e1d 2008-05-30 Sebastien Pouliot <[email protected]>
* IdentityReferenceCollection.cs: Remove MonoTODO and throw NIE.


svn path=/trunk/mcs/; revision=104580
2008-05-31 02:01:32 +00:00
Miguel de Icaza e12b3020bc A few more changes from Jesse Jones, use SupressFinalize on
Dispose(true) cases


svn path=/trunk/mcs/; revision=82916
2007-07-28 16:10:50 +00:00
Miguel de Icaza 4728609ef2 2007-07-28 Miguel de Icaza <[email protected]>
* IdentityReference.cs, SecurityIdentifier.cs, NTAccount.cs: Do
	not recurse infinitely as reported by Jesse Jones, the problem was
	the comparison to null.


svn path=/trunk/mcs/; revision=82912
2007-07-28 15:44:29 +00:00
Sebastien Pouliot 077a651775 2006-12-22 Sebastien Pouliot <[email protected]>
* NTAccount.cs: Implement == and != operators (MoMA reports).
	* SecurityIdentifier.cs: Implement == and != operators (MoMA reports).


svn path=/trunk/mcs/; revision=69945
2006-12-22 16:02:49 +00:00
Miguel de Icaza dd76858fb6 Revert this patch, I do not remember why I had it in the first place, and went into SVN accidentally
svn path=/trunk/mcs/; revision=68434
2006-11-24 16:44:26 +00:00
Miguel de Icaza 1ded59163d Improved the MonoTODO messages, as these will be developer visible
2006-11-16  Miguel de Icaza  <[email protected]>

	* Hashtable.cs: Serialize EqualityComparer.


svn path=/trunk/mcs/; revision=67996
2006-11-16 13:33:32 +00:00
Sebastien Pouliot 2cb1154175 2006-08-08 Sebastien Pouliot <[email protected]>
* GenericIdentity.cs: Rename fields to match MS for serialization
	(indirecly required to fix GenericPrincipal serialization). Also 
	renamed ctor parameters to match fx.
	* GenericPrincipal.cs: Rename fields to match MS for serialization.
	Fix bug #79030.


svn path=/trunk/mcs/; revision=63476
2006-08-08 12:24:50 +00:00
Paolo Molaro f234bea9e2 Wed Nov 30 19:09:50 CET 2005 Paolo Molaro <[email protected]>
* WindowsIdentity.cs: remove check for an invalid user token on Posix
	systems and check for PlatformID.Unix, too.


svn path=/trunk/mcs/; revision=53701
2005-11-30 18:26:58 +00:00
Sebastien Pouliot 546036de2c 2005-10-28 Sebastien Pouliot <[email protected]>
* IdentityReferenceCollection.cs: Removed virtual from Count and 
	IsReadOnly properties.
	* WindowsIdentity.cs: AuthenticationType property isn't virtual in 2.0


svn path=/trunk/mcs/; revision=52352
2005-10-28 19:16:51 +00:00
Sebastien Pouliot fdb221c895 2005-09-25 Sebastien Pouliot <[email protected]>
* SecurityIdentifier.cs: Stubbed ctor(IntPtr) introduced in 2.0 RC.


svn path=/trunk/mcs/; revision=50742
2005-09-26 03:02:58 +00:00
Sebastien Pouliot bfe55f0dfa 2005-08-22 Sebastien Pouliot <[email protected]>
* GenericPrincipal.cs: Roles are case-insensitive.


svn path=/trunk/mcs/; revision=48660
2005-08-22 15:12:45 +00:00
Sebastien Pouliot 2bbc1e2dab 2005-06-18 Sebastien Pouliot <[email protected]>
* IdentityReference.cs: Constructor is internal (which means it the
	class cannot be inherited outside corlib).


svn path=/trunk/mcs/; revision=46188
2005-06-18 15:07:09 +00:00
Sebastien Pouliot f6116a5acb Small fixes to please the status pages
svn path=/trunk/mcs/; revision=46165
2005-06-17 18:47:28 +00:00
Sebastien Pouliot b7d13b3892 2005-06-17 Sebastien Pouliot <[email protected]>
* IdentityNotMappedException.cs: New (2.0). Identity exception.
	* IdentityReference.cs: New (2.0). Abstract base class to collect /
	translate identities.
	* IdentityReferenceCollection.cs: New. (2.0) Collection of 
	IdentityReference (e.g. groups).
	* NTAccount.cs: New (2.0). Domain/User (string based) 
	IdentityReference.
	* SecurityIdentifier.cs: New (2.0). SID (binary based) 
	IdentityReference.
	* TokenAccessLevels.cs: New (2.0). Type of identity token.
	* TokenImpersonationLevel.cs: Fixed name in header.
	* WellKnownSidType.cs: New (2.0). Enum of all well known SID.
	* WindowsIdentity.cs: Implement IDisposable for 2.0. Add Identity
	Reference support for User, Owner and a collection for groups.
	* WindowsImpersonationContext.cs: Implement IDisposable for 2.0.
	* WindowsPrincipal.cs: Added IsInRole(SecurityIdentifier) for 2.0.


svn path=/trunk/mcs/; revision=46132
2005-06-17 11:21:28 +00:00
Raja R Harinath e0cfa4925e Set svn:eol-style=native, delete svn:executable.
Fix line endings of System/Decimal.cs (only actual "change" in text, to force recompile of mscorlib to reflect changes in decimal constant handling in the compiler)


svn path=/trunk/mcs/; revision=44558
2005-05-16 12:23:26 +00:00
Sebastien Pouliot 96e28d3104 2005-04-22 Sebastien Pouliot <[email protected]>
* GenericIdentity.cs: Added [ComVisible(true)] for NET_2_0.
	* GenericPrincipal.cs: Added [ComVisible(true)] for NET_2_0.
	* IIdentity.cs: Added [ComVisible(true)] for NET_2_0.
	* IPrincipal.cs: Added [ComVisible(true)] for NET_2_0.
	* PrincipalPolicy.cs: Added [ComVisible(true)] for NET_2_0.
	* TokenImpersonationLevel.cs: Added [ComVisible(true)] for NET_2_0.
	* WindowsAccountType.cs: Added [ComVisible(true)] for NET_2_0.
	* WindowsBuiltInRole.cs: Added [ComVisible(true)] for NET_2_0.


svn path=/trunk/mcs/; revision=43469
2005-04-23 03:12:49 +00:00
Sebastien Pouliot 17ff16f1f3 2005-01-24 Sebastien Pouliot <[email protected]>
* WindowsIdentity.cs: Added security permissions for ControlPrincipal
	when creating new instances of WindowsIdentity.


svn path=/trunk/mcs/; revision=39460
2005-01-25 02:36:37 +00:00
Tim Coleman 6705996433 2004-09-12 Tim Coleman <[email protected]>
* TokenImpersonationLevel.cs: New enum for Fx 2.0

svn path=/trunk/mcs/; revision=33840
2004-09-14 00:28:33 +00:00
Duncan Mak 13d1764537 Add license and copyright to all source files in corlib
svn path=/trunk/mcs/; revision=29249
2004-06-11 02:09:36 +00:00
Andreas N 185b7d68b0 2004-04-25 Andreas Nahr <[email protected]>
* WindowsPrincipal.cs: Call invariant ToUpper

svn path=/trunk/mcs/; revision=25949
2004-04-25 11:40:16 +00:00
Sebastien Pouliot fec3b3f87a 2004-04-14 Sebastien Pouliot <[email protected]>
* WindowsIdentity.cs: Implemented IDeserializationCallback and
	ISerializable interfaces.

svn path=/trunk/mcs/; revision=25466
2004-04-14 12:44:38 +00:00
Sebastien Pouliot ffec19d89e 2004-04-13 Sebastien Pouliot <[email protected]>
* WindowsIdentity.cs: Implemented for both Windows and Linux. Fix bug
	#52532. Class is only missing serialization bits.
	* WindowsImpersonationContext.cs: Implemented for both Windows and
	Linux. Fix bug #52532.
	* WindowsPrincipal.cs: Implemented for both Windows and Linux.  Fix
	bug #52532.

svn path=/trunk/mcs/; revision=25395
2004-04-13 11:35:42 +00:00
Sebastien Pouliot 1bf4b6130c 2003-12-29 Sebastien Pouliot <[email protected]>
* WindowsPrincipal.cs: Return false for a null role.

svn path=/trunk/mcs/; revision=21547
2003-12-30 04:20:08 +00:00
Sebastien Pouliot a11b4b2722 2003-12-29 Sebastien Pouliot <[email protected]>
* PrincipalPolicy.cs: Added missing [Serializable] to enum.
	* WindowsAccountType.cs: Added missing [Serializable] to enum.
	* WindowsBuiltInRole.cs: Added missing [Serializable] to enum.
	* WindowsIdentity.cs: Updated to match the unit tests.
	* WindowsPrincipal.cs: Return false for a null role.

svn path=/trunk/mcs/; revision=21544
2003-12-30 04:13:59 +00:00
Sebastien Pouliot cc02bb2de3 2003-12-25 Sebastien Pouliot <[email protected]>
* WindowsIdentity.cs: Added ISerializable (for 1.1+) and default
	implementation for constructors/properties.
	* WindowsImpersonationContext.cs: Added MonoTODO on class and
	NotImplementedException in constructor.
	* WindowsPrincipal.cs: New. Basic implementation (mostly a stub).

svn path=/trunk/mcs/; revision=21498
2003-12-26 04:25:41 +00:00
Sebastien Pouliot bd24cb9b9a 2003-07-01 Sebastien Pouliot <[email protected]>
* ChangeLog: Sorry it seems that I couldn't find the right combinaison
	just to commit the change to changelog (probably due to convertion to
	windows).
	* GenericPrincipal.cs: Fixed issues found during unit testing.

svn path=/trunk/mcs/; revision=15836
2003-07-01 23:01:50 +00:00
Gonzalo Paniagua Javier a880449fbc 2002-12-17 Gonzalo Paniagua Javier <[email protected]>
* GenericIdentity.cs: check arguments and fixed IsAuthenticated.

svn path=/trunk/mcs/; revision=9714
2002-12-17 04:15:26 +00:00
Gonzalo Paniagua Javier c87c2fda2b 2002-08-26 Gonzalo Paniagua Javier <[email protected]>
* unix.args: added a couple of new files in System.Security.Principal.
	* System.Security.Principal/WindowsIdentity.cs:
	* System.Security.Principal/WindowsImpersonationContext.cs: stubbed.

svn path=/trunk/mcs/; revision=7072
2002-08-27 01:40:49 +00:00
Nick Drochak 1d331d1b3c 2002/07/10 Nick Drochak <[email protected]>
* WindowsAccountType.cs:
	* WindowsBuiltInRole.cs:
		Make these enums public instead of internal.

svn path=/trunk/mcs/; revision=5682
2002-07-10 12:17:57 +00:00
Piers Haken cc63806f23 minor CLS conformance tweaks (visibility, virtual, abstract, sealed, etc...)
svn path=/trunk/mcs/; revision=3568
2002-04-03 06:28:53 +00:00
Piers Haken 610d7923ac added missing [Serializable] attribute
svn path=/trunk/mcs/; revision=3540
2002-04-01 20:22:40 +00:00
Nick Drochak a88542478f 2002-01-07 Nick Drochak <[email protected]>
* PrincipalPolicy.cs: made enum public like it should be to get _AppDomain to compile.

svn path=/trunk/mcs/; revision=1878
2002-01-06 18:50:38 +00:00
Miguel de Icaza 8edceaee21 Add a bunch of new classes to reduce warnings from Mint
svn path=/trunk/mcs/; revision=1202
2001-10-25 19:34:35 +00:00