summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOyvind Sean Kinsey <oyvind@kinsey.no>2011-09-22 19:59:40 +0200
committerOyvind Sean Kinsey <oyvind@kinsey.no>2011-09-22 19:59:40 +0200
commit1e36184240227b505d35e1ea9c04bf0ddb9e2800 (patch)
treeb48d6df55d0f633faf4adbf3ec3eed0583f8d318 /src
parent717075b74215e320be4aa2f9432eef77af31a696 (diff)
downloadDotNetOpenAuth-1e36184240227b505d35e1ea9c04bf0ddb9e2800.zip
DotNetOpenAuth-1e36184240227b505d35e1ea9c04bf0ddb9e2800.tar.gz
DotNetOpenAuth-1e36184240227b505d35e1ea9c04bf0ddb9e2800.tar.bz2
Added a method that creates a GenericPrincipal based on the current instance of OAuthPrincipal.
Diffstat (limited to 'src')
-rw-r--r--src/DotNetOpenAuth/OAuth/ChannelElements/OAuthPrincipal.cs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthPrincipal.cs b/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthPrincipal.cs
index 3fda483..442cf30 100644
--- a/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthPrincipal.cs
+++ b/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthPrincipal.cs
@@ -70,6 +70,15 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
get { return new ReadOnlyCollection<string> (roles.ToList()); }
}
+ /// <summary>
+ /// Creates a new instance of GenericPrincipal based on this OAuthPrincipal.
+ /// </summary>
+ /// <returns>A new instance of GenericPrincipal with a GenericIdentity, having the same username and roles as this OAuthPrincipal and OAuthIdentity</returns>
+ public GenericPrincipal CreateGenericPrincipal()
+ {
+ return new GenericPrincipal( new GenericIdentity(this.Identity.Name), roles.ToArray());
+ }
+
#region IPrincipal Members
/// <summary>