Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Commit 184233a

Browse files
committed
#79: Remove cookie compression.
1 parent 0a71973 commit 184233a

File tree

4 files changed

+6
-33
lines changed

4 files changed

+6
-33
lines changed

src/Microsoft.AspNet.Security.Cookies/CookieAuthenticationMiddleware.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public CookieAuthenticationMiddleware(RequestDelegate next,
3636
if (Options.TicketDataFormat == null)
3737
{
3838
IDataProtector dataProtector = dataProtectionProvider.CreateDataProtector(
39-
typeof(CookieAuthenticationMiddleware).FullName, Options.AuthenticationType, "v1");
39+
typeof(CookieAuthenticationMiddleware).FullName, Options.AuthenticationType, "v2");
4040
Options.TicketDataFormat = new TicketDataFormat(dataProtector);
4141
}
4242
if (Options.CookieManager == null)

src/Microsoft.AspNet.Security.OAuth/project.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"System.Dynamic.Runtime": "4.0.0-beta-*",
2727
"System.Globalization": "4.0.10-beta-*",
2828
"System.IO": "4.0.10-beta-*",
29-
"System.IO.Compression": "4.0.0-beta-*",
3029
"System.Linq": "4.0.0-beta-*",
3130
"System.Net.Http.WinHttpHandler": "4.0.0-beta-*",
3231
"System.ObjectModel": "4.0.10-beta-*",

src/Microsoft.AspNet.Security/DataHandler/Serializer/TicketSerializer.cs

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,36 @@
11
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4-
54
using System;
6-
using System.Collections.Generic;
75
using System.IO;
8-
using System.IO.Compression;
96
using System.Linq;
107
using System.Security.Claims;
118

129
namespace Microsoft.AspNet.Security.DataHandler.Serializer
1310
{
1411
public class TicketSerializer : IDataSerializer<AuthenticationTicket>
1512
{
16-
private static readonly bool IsMono = Type.GetType("Mono.Runtime") != null;
1713
private const int FormatVersion = 2;
1814

19-
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times", Justification = "Dispose is idempotent")]
2015
public virtual byte[] Serialize(AuthenticationTicket model)
2116
{
2217
using (var memory = new MemoryStream())
2318
{
24-
GZipStream compression;
25-
if (IsMono)
26-
{
27-
// The other constructor is not currently supported on Mono.
28-
compression = new GZipStream(memory, CompressionMode.Compress);
29-
}
30-
else
31-
{
32-
compression = new GZipStream(memory, CompressionLevel.Optimal);
33-
}
34-
using (compression)
19+
using (var writer = new BinaryWriter(memory))
3520
{
36-
using (var writer = new BinaryWriter(compression))
37-
{
38-
Write(writer, model);
39-
}
21+
Write(writer, model);
4022
}
4123
return memory.ToArray();
4224
}
4325
}
4426

45-
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times", Justification = "Dispose is idempotent")]
4627
public virtual AuthenticationTicket Deserialize(byte[] data)
4728
{
4829
using (var memory = new MemoryStream(data))
4930
{
50-
using (var compression = new GZipStream(memory, CompressionMode.Decompress))
31+
using (var reader = new BinaryReader(memory))
5132
{
52-
using (var reader = new BinaryReader(compression))
53-
{
54-
return Read(reader);
55-
}
33+
return Read(reader);
5634
}
5735
}
5836
}

src/Microsoft.AspNet.Security/project.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
},
1111
"frameworks": {
1212
"aspnet50": { },
13-
"aspnetcore50": {
14-
"dependencies": {
15-
"System.IO.Compression": "4.0.0-beta-*"
16-
}
17-
}
13+
"aspnetcore50": { }
1814
}
1915
}

0 commit comments

Comments
 (0)