This fixes the bug where form authentication tickets do not expire until 50 years later.
I bumped into this bug after upgrading mono from 4.2.2 to 4.4.0
Firstly, the authentication ticket's expiry must always equal to the timeout attribute on the <forms/> element. It doesn't matter whether persistent or session cookies are used.
Secondly, if the cookie is persistent, then it's expiry should be set to the same as that of the authentication ticket.
Reference: https://blogs.msdn.microsoft.com/dansellers/2006/02/15/change-to-asp-net-2-0-forms-authentication-persistent-cookies/
* System.Web.Configuration_2.0/MachineKeyRegistryStorage.cs:
Remove key length check and generic key generation.
* System.Web.Configuration_2.0/MachineKeySection.cs: Add support for 4.0
ValidationAlgorithm and the use of custom algorithms (validation and
decryption). Allow the use of any, valid, key length (based on the
algorithm). Let each algorithm creates its own key (e.g. special needs,
default length...)
* System.Web.Configuration_2.0/MachineKeySectionUtils.cs: Remove key
generation (from random) code and 192bits key length hack (won't work
with custom algorithms). Add support for new (4.0) algorithms, including
custom ones. Provide uniform/shared code to Encrypt/Decrypt, Sign/Verify
and EncryptSign/VerifyDecrypt using MachineKeySection data.
* System.Web.Configuration_2.0/MachineKeyValidation.cs: Add new (4.0)
values.
* System.Web.Configuration_2.0/MachineKeyValidationConverter.cs: Add
support for new (4.0) algorithms.
* System.Web.Handlers/AssemblyResourceLoader.cs: Use the new common
cryptographic code and base64 the encrypted data.
* System.Web.Security/FormsAuthentication.cs: Use the new common
cryptographic code and base64 the signed and/or encrypted data.
* System.Web.Security/MembershipHelper.cs: Use the new common
cryptographic code - this should be 100% compatible with existing data.
* System.Web.Security/RolePrincipal.cs: Use the new common cryptographic
code.
* System.Web.Security/SqliteMembershipProvider.cs: Adapt code for
internal API change.
* System.Web.UI/LosFormatter.cs: Adapt code for internal API change.
Fix some small behaviro changes wrt NET_4_0
* System.Web.UI/ObjectStateFormatter.cs: Use the new common cryptographic
code.
* System.Web.UI/Page.cs: Remove code that is now unneeded (with the new
common cryptogrraphic code).
* System.Web.Configuration_2.0/MachineKeyCompatibilityMode.cs: New.
* Test/System.Web.Configuration/MachineKeyValidationConverterTest.cs:
Add more, mostly 4.0, test cases.
* Test/System.Web.Security/FormsAuthenticationTest.cs: Add test case to
ensure HashPasswordForStoringInConfigFile is not case sensitive.
* Test/System.Web.UI/LosFormatterTest.cs: Add some rountrip test cases
with the different ctors
* System.Web.Security/FormsAuthentication.cs: Fix typo (MD5->SHA1).
I suspect the later is not used very much by mono users
* Test/System.Web.Security/FormsAuthenticationTest.cs: Small change to
make sure the hash name is not case sensitive
- made sure invariant culture is used with String.ToLower, String.ToUpper and String.Compare
- replaced all calls to CultureInfo.InvariantCulture with a reference to a static field System.Web.Util.Helpers.InvariantCulture
svn path=/trunk/mcs/; revision=143587
* Page.cs, ObjectStateFormatter.cs: use the new
MachineKeySectionUtils class wherever necessary.
2007-11-01 Marek Habersack <[email protected]>
* System.Web.dll.sources: added MachineKeySectionUtils.cs
2007-11-01 Marek Habersack <[email protected]>
* RolePrincipal.cs, MembershipProvider.cs: use the new
MachineKeySectionUtils class wherever necessary.
* FormsAuthentication.cs: use the new MachineKeySectionUtils class
wherever necessary.
GetHexString is a private method again.
2007-11-01 Marek Habersack <[email protected]>
* MachineKeySection.cs: moved all the internal static methods and
properties to MachineKeySectionUtils.cs
* MachineKeySectionUtils.cs: added. This file is included in the
System.Web.Extensions compilation.
The old properties from MachineKeySection.cs became methods.
2007-11-01 Marek Habersack <[email protected]>
* AssemblyResourceLoader.cs: added GetHexString, copied from
FormsAuthentication.cs. Encryption/decryption routines use methods
from the new MachineKeySectionUtils class. This is needed for the
same code to work from both System.Web and System.Web.Extensions.
svn path=/trunk/mcs/; revision=88621
* FormsAuthentication.cs: made GetHexString an internal method -
it is used in the AssemblyResourceLoader.cs
2007-10-31 Marek Habersack <[email protected]>
* AssemblyResourceLoader.cs: implemented assembly+resource name
encryption in the URLs. This follows MS.NET behavior. Also the
code is not varying the cache on the 't' parameter. Fixes bug
#338051.
svn path=/trunk/mcs/; revision=88608
* HttpContext.cs (GetGlobalResourceObject): remove unused variable.
* StaticFileHandler.cs (ProcessRequest): remove unused variable.
* HttpApplication.cs (ProcessError): Remove unused variable.
2007-01-20 Miguel de Icaza <[email protected]>
* ClientBuildManager.cs: Remove unused variable (this could be a
real problem, we never use the appPhysicalTargetDir)
* AssemblyBuilder.cs: Remove unused field.
* AppResourceFilesCollection.cs: Remove unused field.
* TemplateControlCompiler.cs (GetExpressionFromString): Remove
unused variable.
* AppResourcesCompiler.cs: Remove unused variable.
* AppSettingsExpressionBuilder.cs (GetAppSetting): remove unused
parameter.
* PageCompiler.cs: Put InternalCreatePageProperty inside the
NET_2_0 block to eliminate warnings.
2007-01-20 Miguel de Icaza <[email protected]>
* HandlerFactoryConfiguration.cs (LoadType): remove unused
variable.
(ctor): do not assign parent, we do not use it, keep the code for
reference.
2007-01-20 Miguel de Icaza <[email protected]>
* ApplicationManager.cs: Remove unused variable.
(ShutdownAll) remove unused variables.
* ApplicationHost.cs: Protect create_dir lock
2007-01-20 Miguel de Icaza <[email protected]>
* SqlRoleProvider.cs: comment out unused code.
* SqlMembershipProvider.cs: Removed unused variables.
Remove unused variable.
* AnonymousIdentificationModule.cs (ClearAnonymousIdentifier):
remove unused variable. This might be a real bug.
2007-01-20 Miguel de Icaza <[email protected]>
* SessionStateModule.cs: Removed unused variables.
2007-01-20 Miguel de Icaza <[email protected]>
* SessionDictionary.cs: Removed unused variable (dirty).
2007-01-20 Miguel de Icaza <[email protected]>
* XhtmlTextWriter.cs: comment out unused code.
* ThemeProvider.cs: comment out unused code.
* DataSourceView.cs: Comment unused variable.
* ClientScriptManager.cs: Put the expandoAttributes inside the 2.0
code
* Control.cs: Put _templateControl inside the NET_2_0 ifdef
2007-01-20 Miguel de Icaza <[email protected]>
* HtmlHead.cs: comment out unused code, in particular metadata is
commented out because nothing could have triggered its creation.
* HtmlButton.cs: Move declaration of `csm' inside the 1.1 case.
2007-01-20 Miguel de Icaza <[email protected]>
* DataControlFieldCollection.cs (RemoveAt): remove unused
variable.
* RoleGroupCollection.cs (OnValidate): Flag as protected, as it
should not show up.
* RadioButton.cs (RaisePostDataChangedEvent): This method was not
used in 1.0, so put the whole method in 2.0
2007-01-20 Miguel de Icaza <[email protected]>
* WebPart.cs: Remove
* PersonalizableAttribute.cs: Remove extra API that was wrong as well.
2006-11-28 Miguel de Icaza <[email protected]>
* WebPart.cs:
2007-01-20 Miguel de Icaza <[email protected]>
* FileUtils.cs (CreateTemporaryFile): Remove unused variable.
svn path=/trunk/mcs/; revision=71399
* DefaultAuthenticationEventArgs.cs: Added LinkDemand for Minimal.
* DefaultAuthenticationModule.cs: Added LinkDemand for Minimal. Added
Demand for UnmanagedCode on constructor.
* FileAuthorizationModule.cs: Added LinkDemand for Minimal. Added
Demand for UnmanagedCode on constructor.
* FormsAuthentication.cs: Added LinkDemand for Minimal.
* FormsAuthenticationEventArgs.cs: Added LinkDemand for Minimal.
* FormsAuthenticationModule.cs: Added LinkDemand for Minimal. Added
Demand for UnmanagedCode on constructor.
* FormsAuthenticationTicket.cs: Added LinkDemand for Minimal.
* FormsIdentity.cs: Added LinkDemand for Minimal.
* PassportAuthenticationEventArgs.cs: Added LinkDemand for Minimal.
* PassportAuthenticationModule.cs: Added LinkDemand for Minimal. Added
Demand for UnmanagedCode on constructor.
* PassportIdentity.cs: Added LinkDemand for Minimal. Added Demand for
UnmanagedCode on constructor.
* UrlAuthorizationModule.cs: Added LinkDemand for Minimal. Added
Demand for UnmanagedCode on constructor.
* WindowsAuthenticationEventArgs.cs: Added LinkDemand for Minimal.
* WindowsAuthenticationModule.cs: Added LinkDemand for Minimal. Added
Demand for UnmanagedCode on constructor.
svn path=/trunk/mcs/; revision=49819
* FormsAuthentication.cs: the init_vector must be the same accross
restarts, otherwise the cookie does not work even when a decryption
key is provided. Initialize it to the bytes of the cookie name. Fixes
bug #75635.
svn path=/trunk/mcs/; revision=47700
* FormsAuthentication.cs: my previous patch missed a "small" detail: it
didn't include the verification key when computing/checking the
validation hash. Now this is really a MAC or HMAC or...
svn path=/trunk/mcs/; revision=47632
* FormsAuthentication.cs:
* FormsAuthenticationTicket.cs: added support for validation and
encryption of the auth. cookie and improved serialization of the ticket.
svn path=/trunk/mcs/; revision=47625
* FormsAuthentication.cs: Hash the UTF8 representation of the password
strings (to be compatible with Microsoft implementation).
svn path=/trunk/mcs/; revision=44878
* FormsAuthentication.cs: fixed typo when getting the hash for the
password in SHA1 and MD5. Thanks to Tadas Dailyda.
Lock on a static object instead of typeof(FormsAuthentication).
svn path=/trunk/mcs/; revision=40212
* list: added AuthorizationConfig and AuthorizationConfigHandler.
* System.Web/HttpRequest.cs: implemented the indexer.
* System.Web.Configuration/AuthorizationConfigHandler.cs: handler for
system.web/authorization section.
* System.Web.Configuration/AuthorizationConfig.cs: keeps record of
authorization configuration.
* System.Web.Security/FormsAuthentication.cs: implemented
RedirectFromLoginPage and GetRedirectUrl.
* System.Web.Security/FormsAuthenticationModule.cs: redirect to the
login page when a 401 error happens.
* System.Web.Security/UrlAuthorizationModule.cs: check for valid user
or render error page.
svn path=/trunk/mcs/; revision=11512