diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-11-10 08:47:34 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-11-10 08:47:34 -0800 |
commit | cbc0964271849df85ba864944377d592d410de38 (patch) | |
tree | b526e119f2baf4441cba9629964b5434da7dd8cc /projecttemplates/WebFormsRelyingParty/Model.IssuedAccessToken.cs | |
parent | 8f53e90739e6b0511598c9cdde1820a96788b4ce (diff) | |
download | DotNetOpenAuth-cbc0964271849df85ba864944377d592d410de38.zip DotNetOpenAuth-cbc0964271849df85ba864944377d592d410de38.tar.gz DotNetOpenAuth-cbc0964271849df85ba864944377d592d410de38.tar.bz2 |
Split up issued tokens into request and access token types.
Diffstat (limited to 'projecttemplates/WebFormsRelyingParty/Model.IssuedAccessToken.cs')
-rw-r--r-- | projecttemplates/WebFormsRelyingParty/Model.IssuedAccessToken.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/projecttemplates/WebFormsRelyingParty/Model.IssuedAccessToken.cs b/projecttemplates/WebFormsRelyingParty/Model.IssuedAccessToken.cs new file mode 100644 index 0000000..ee254ac --- /dev/null +++ b/projecttemplates/WebFormsRelyingParty/Model.IssuedAccessToken.cs @@ -0,0 +1,33 @@ +namespace WebFormsRelyingParty { + using System; + using System.Collections.Generic; + using System.Linq; + using System.Web; + using DotNetOpenAuth.OAuth.ChannelElements; + + public partial class IssuedAccessToken : IServiceProviderAccessToken { + string[] IServiceProviderAccessToken.Roles { + get { + List<string> roles = new List<string>(); + + // Include the roles the user who authorized this OAuth token has. + // TODO: code here + + // Always add an extra role to indicate this is an OAuth-authorized request. + // This allows us to deny access to account management pages to OAuth requests. + roles.Add("OAuthToken"); + + return roles.ToArray(); + } + } + + string IServiceProviderAccessToken.Username { + get { + // We don't really have the concept of a single username, but we + // can use any of the authentication tokens instead since that + // is what the rest of the web site expects. + return this.User.AuthenticationTokens.First().ClaimedIdentifier; + } + } + } +} |