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

Commit 0bfe3c1

Browse files
committed
Port AuthProperties.AllowRefresh from Katana.
1 parent 547d777 commit 0bfe3c1

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/Microsoft.AspNet.Http/Security/AuthenticationProperties.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class AuthenticationProperties
1717
internal const string ExpiresUtcKey = ".expires";
1818
internal const string IsPersistentKey = ".persistent";
1919
internal const string RedirectUriKey = ".redirect";
20+
internal const string RefreshKey = ".refresh";
2021
internal const string UtcDateTimeFormat = "r";
2122

2223
/// <summary>
@@ -160,5 +161,39 @@ public DateTimeOffset? ExpiresUtc
160161
}
161162
}
162163
}
164+
165+
/// <summary>
166+
/// Gets or sets if refreshing the authentication session should be allowed.
167+
/// </summary>
168+
public bool? AllowRefresh
169+
{
170+
get
171+
{
172+
string value;
173+
if (Dictionary.TryGetValue(RefreshKey, out value))
174+
{
175+
bool refresh;
176+
if (bool.TryParse(value, out refresh))
177+
{
178+
return refresh;
179+
}
180+
}
181+
return null;
182+
}
183+
set
184+
{
185+
if (value.HasValue)
186+
{
187+
Dictionary[RefreshKey] = value.Value.ToString();
188+
}
189+
else
190+
{
191+
if (Dictionary.ContainsKey(RefreshKey))
192+
{
193+
Dictionary.Remove(RefreshKey);
194+
}
195+
}
196+
}
197+
}
163198
}
164199
}

0 commit comments

Comments
 (0)