summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2011-09-28 08:42:22 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2011-09-28 08:42:22 -0700
commit8f13641229e8ec14a37d9d060c5829002a89f386 (patch)
treec28ab1939e81a35cadd3e101656da042b675d02e /src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements
parentb280c7c61ab1d5dd24456ae5043c0eb4759989ef (diff)
parentf1a4155398635a4fd9f485eec817152627682704 (diff)
downloadDotNetOpenAuth-8f13641229e8ec14a37d9d060c5829002a89f386.zip
DotNetOpenAuth-8f13641229e8ec14a37d9d060c5829002a89f386.tar.gz
DotNetOpenAuth-8f13641229e8ec14a37d9d060c5829002a89f386.tar.bz2
Merge branch 'master' into splitDlls
Diffstat (limited to 'src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements')
-rw-r--r--src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/OAuthPrincipal.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/OAuthPrincipal.cs b/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/OAuthPrincipal.cs
index b274265..f4d167d 100644
--- a/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/OAuthPrincipal.cs
+++ b/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/OAuthPrincipal.cs
@@ -7,6 +7,7 @@
namespace DotNetOpenAuth.OAuth.ChannelElements {
using System;
using System.Collections.Generic;
+ using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using System.Linq;
@@ -61,6 +62,14 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
/// <value>A non-empty string.</value>
public string AccessToken { get; private set; }
+ /// <summary>
+ /// Gets the roles that this principal has as a ReadOnlyCollection.
+ /// </summary>
+ public ReadOnlyCollection<string> Roles
+ {
+ get { return new ReadOnlyCollection<string>(this.roles.ToList()); }
+ }
+
#region IPrincipal Members
/// <summary>
@@ -87,5 +96,14 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
}
#endregion
+
+ /// <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), this.roles.ToArray());
+ }
}
}