From f3e7bd018753887ce0f6d40a49400662a4899b95 Mon Sep 17 00:00:00 2001 From: Ilya Kharmatsky Date: Thu, 15 Mar 2007 16:08:19 +0000 Subject: [PATCH] bug fixes svn path=/trunk/mcs/; revision=74392 --- .../Mainsoft.Web.Security/ChangeLog | 136 +++++++++--------- .../WPMembershipProvider.cs | 25 ++-- 2 files changed, 87 insertions(+), 74 deletions(-) diff --git a/mcs/class/Mainsoft.Web/Mainsoft.Web.J2EE.WAS/Mainsoft.Web.Security/ChangeLog b/mcs/class/Mainsoft.Web/Mainsoft.Web.J2EE.WAS/Mainsoft.Web.Security/ChangeLog index a3338aa47f3..998094786b0 100755 --- a/mcs/class/Mainsoft.Web/Mainsoft.Web.J2EE.WAS/Mainsoft.Web.Security/ChangeLog +++ b/mcs/class/Mainsoft.Web/Mainsoft.Web.J2EE.WAS/Mainsoft.Web.Security/ChangeLog @@ -1,66 +1,70 @@ -03-23-2007 Ilya Kharmatsky - * WPAuthenticationModule.cs: fixed in WPPrincipal class method - - IsInRole - we are leaving this for RoleBasedPrincipal class to handle - this method. - -03-12-2007 Ilya Kharmatsky - - * WPAuthenticationModule.cs: added to project. Portal specific - authentication module (uses PUMA services) - * IPumaServicesProvider.cs, PumaServicesProvider.cs, - WPGroupsRoleProvider.cs: added 'CurrentUserName' property and - internal helpers methods. - -03-01-2007 Ilya Kharmatsky - - * PumaServicesProvider.cs: fixed PumaController property (proper - handling process action phace) - -02-26-2007 Ilya Kharmatsky - - * WPGroupsRoleProvider.cs: fixed RoleExists method - in case when - wildcard used in roleName parameter. - -02-26-2007 Ilya Kharmatsky - - * Added comments, NET_2_0 derective to all classes under this - directory. - -02-26-2007 Ilya Kharmatsky - - * WPS*.cs : renamed to WP*.cs files and respective classes. - * WPGroupsRoleProvider.cs: small fixes in implemented read-only - features - * PumaServicesProvider.cs: changed implementation of obtaining - configuration properties - use JNDI repository and cache it in - portlet/servlet session. - -03-12-2007 Ilya Kharmatsky - - * PumaServicesProvider.cs: fixed TD BUG: 7489 (the application - should not throw an exeption even if no WPGroupsRoleNamespace is not - defined in web.xml) - -02-25-2007 Ilya Kharmatsky - - * WPSGroupsRoleProvider.cs: added - * WPSMembershipProvider.cs, WPSMembershipUser.cs: added NET_2_0 - directives. - -02-21-2007 Ilya Kharmatsky - - * WPSMembershipProvider.cs: fixed 'null' case in GetUser methods - - should return 'current user' - -02-20-2007 Ilya Kharmatsky - - * WPSMembershipProvider.cs : fixed paging of resources. - -02-19-2007 Ilya Kharmatsky - - * IPumaServicesProvider.cs, PumaServicesProvider.cs, - PumaServicesProviderFactory.cs, WPSMembershipProvider.cs, - WPSMembershipUser.cs : Added to the project - implementation of - Web Sphere Portal MembershipProvider and Web Sphere Portal - MembershipUser - based on PUMA API. - +03-23-2007 Ilya Kharmatsky + + * WPMembershipProvider.cs: bug fixes + +03-23-2007 Ilya Kharmatsky + * WPAuthenticationModule.cs: fixed in WPPrincipal class method - + IsInRole - we are leaving this for RoleBasedPrincipal class to handle + this method. + +03-12-2007 Ilya Kharmatsky + + * WPAuthenticationModule.cs: added to project. Portal specific + authentication module (uses PUMA services) + * IPumaServicesProvider.cs, PumaServicesProvider.cs, + WPGroupsRoleProvider.cs: added 'CurrentUserName' property and + internal helpers methods. + +03-01-2007 Ilya Kharmatsky + + * PumaServicesProvider.cs: fixed PumaController property (proper + handling process action phace) + +02-26-2007 Ilya Kharmatsky + + * WPGroupsRoleProvider.cs: fixed RoleExists method - in case when + wildcard used in roleName parameter. + +02-26-2007 Ilya Kharmatsky + + * Added comments, NET_2_0 derective to all classes under this + directory. + +02-26-2007 Ilya Kharmatsky + + * WPS*.cs : renamed to WP*.cs files and respective classes. + * WPGroupsRoleProvider.cs: small fixes in implemented read-only + features + * PumaServicesProvider.cs: changed implementation of obtaining + configuration properties - use JNDI repository and cache it in + portlet/servlet session. + +03-12-2007 Ilya Kharmatsky + + * PumaServicesProvider.cs: fixed TD BUG: 7489 (the application + should not throw an exeption even if no WPGroupsRoleNamespace is not + defined in web.xml) + +02-25-2007 Ilya Kharmatsky + + * WPSGroupsRoleProvider.cs: added + * WPSMembershipProvider.cs, WPSMembershipUser.cs: added NET_2_0 + directives. + +02-21-2007 Ilya Kharmatsky + + * WPSMembershipProvider.cs: fixed 'null' case in GetUser methods - + should return 'current user' + +02-20-2007 Ilya Kharmatsky + + * WPSMembershipProvider.cs : fixed paging of resources. + +02-19-2007 Ilya Kharmatsky + + * IPumaServicesProvider.cs, PumaServicesProvider.cs, + PumaServicesProviderFactory.cs, WPSMembershipProvider.cs, + WPSMembershipUser.cs : Added to the project - implementation of + Web Sphere Portal MembershipProvider and Web Sphere Portal + MembershipUser - based on PUMA API. + diff --git a/mcs/class/Mainsoft.Web/Mainsoft.Web.J2EE.WAS/Mainsoft.Web.Security/WPMembershipProvider.cs b/mcs/class/Mainsoft.Web/Mainsoft.Web.J2EE.WAS/Mainsoft.Web.Security/WPMembershipProvider.cs index df01e16c3f4..14c9b1b39ac 100644 --- a/mcs/class/Mainsoft.Web/Mainsoft.Web.J2EE.WAS/Mainsoft.Web.Security/WPMembershipProvider.cs +++ b/mcs/class/Mainsoft.Web/Mainsoft.Web.J2EE.WAS/Mainsoft.Web.Security/WPMembershipProvider.cs @@ -145,8 +145,14 @@ namespace Mainsoft.Web.Security #region Implemented Methods public override MembershipUserCollection FindUsersByEmail(string emailToMatch, int pageIndex, int pageSize, out int totalRecords) { - if (emailToMatch == null || emailToMatch.Length > 256) // TODO check if the string could be null, if yes replace it with "*" for any email - throw new ArgumentException("Argument emailToMatch either null or length > 256", "emailToMatch"); + if (emailToMatch == null) + { + totalRecords = 0; + return new MembershipUserCollection(); + } + + if (emailToMatch.Length > 256) + throw new ArgumentException("Argument emailToMatch has length > 256", "emailToMatch"); if (pageIndex < 0) throw new ArgumentException("Argument pageIndex could not be negative", "pageIndex"); if (pageSize < 1) @@ -178,8 +184,10 @@ namespace Mainsoft.Web.Security public override MembershipUserCollection FindUsersByName(string usernameToMatch, int pageIndex, int pageSize, out int totalRecords) { - if (usernameToMatch == null || usernameToMatch.Trim().Length == 0 || usernameToMatch.Trim().Length > 256) - throw new ArgumentException("Wrong username given as a parameter - could not be null or empty string and could not have more than 255 characters", usernameToMatch); + if (usernameToMatch == null) + throw new ArgumentNullException("username"); + if (usernameToMatch.Trim().Length == 0 || usernameToMatch.Trim().Length > 256) + throw new ArgumentException("Wrong username given as a parameter - could not have more than 255 characters", usernameToMatch); if (pageIndex < 0) throw new ArgumentException("Argument pageIndex could not be negative", "pageIndex"); if (pageSize < 1) @@ -235,13 +243,14 @@ namespace Mainsoft.Web.Security //the userIsOnline ignored public override MembershipUser GetUser(string username, bool userIsOnline) { + if (username == null) + throw new ArgumentNullException("username"); if (username.Length > 256) throw new ArgumentException("The username is too long", username); - IPumaServicesProvider provider = PumaServicesProviderFactory.CreateProvider(); - - if (username == null || username == String.Empty) - return new WPMembershipUser(provider.CurrentUser); + if (username.IndexOf(',') != -1) + throw new ArgumentException("Comma symbol is not allowed in username"); + IPumaServicesProvider provider = PumaServicesProviderFactory.CreateProvider(); java.util.List principles = provider.PumaLocator.findUsersByAttribute("uid", username); MembershipUser result = null; if (principles.size() > 0) -- 2.25.1