Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #4 from appharbor/add-cookie-reference-to-identity

Refactored CookieIdentity to take a reference to the AuthenticationCookie object for further use.
  • Loading branch information...
commit 0256255864683a176ad1b4b7d2a663015f9189df 2 parents 106f2d8 + 44caf25
@mehrdada mehrdada authored
View
2  AppHarbor.Web.Security/AuthenticationCookie.cs
@@ -57,7 +57,7 @@ public AuthenticationCookie(short cookieType, Guid id, bool persistent, string n
public IPrincipal GetPrincipal()
{
- var identity = new CookieIdentity(_name, _tag);
+ var identity = new CookieIdentity(this);
return new GenericPrincipal(identity, _roles);
}
View
24 AppHarbor.Web.Security/CookieIdentity.cs
@@ -9,10 +9,16 @@ namespace AppHarbor.Web.Security
[Serializable]
public class CookieIdentity : MarshalByRefObject, IIdentity
{
- public CookieIdentity(string name, byte[] tag = null)
+ private readonly AuthenticationCookie _cookie;
+
+ public CookieIdentity(AuthenticationCookie cookie)
{
- Name = name;
- Tag = tag;
+ if (cookie == null)
+ {
+ throw new ArgumentNullException("cookie");
+ }
+
+ _cookie = cookie;
}
public bool IsAuthenticated
@@ -33,14 +39,10 @@ public string AuthenticationType
public string Name
{
- get;
- private set;
- }
-
- public byte[] Tag
- {
- get;
- private set;
+ get
+ {
+ return _cookie.Name;
+ }
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.