summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/AccessTokenResourceOwnerPasswordCredentialsRequest.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2012-02-24 09:02:58 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2012-02-24 09:02:58 -0800
commit98f555915c230a8af154984fb7d29f58a5027acc (patch)
treed6303fe488eb02f2fe5d4eb5d0a4db7f8b4ec148 /src/DotNetOpenAuth.OAuth2/OAuth2/Messages/AccessTokenResourceOwnerPasswordCredentialsRequest.cs
parentb06334b3cd7fa616c5a53ced828b890c1380744a (diff)
downloadDotNetOpenAuth-98f555915c230a8af154984fb7d29f58a5027acc.zip
DotNetOpenAuth-98f555915c230a8af154984fb7d29f58a5027acc.tar.gz
DotNetOpenAuth-98f555915c230a8af154984fb7d29f58a5027acc.tar.bz2
Adds support for the resource owner password credential grant.
Fixes #72
Diffstat (limited to 'src/DotNetOpenAuth.OAuth2/OAuth2/Messages/AccessTokenResourceOwnerPasswordCredentialsRequest.cs')
-rw-r--r--src/DotNetOpenAuth.OAuth2/OAuth2/Messages/AccessTokenResourceOwnerPasswordCredentialsRequest.cs45
1 files changed, 44 insertions, 1 deletions
diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/AccessTokenResourceOwnerPasswordCredentialsRequest.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/AccessTokenResourceOwnerPasswordCredentialsRequest.cs
index a5deb4a..52e65be 100644
--- a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/AccessTokenResourceOwnerPasswordCredentialsRequest.cs
+++ b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/AccessTokenResourceOwnerPasswordCredentialsRequest.cs
@@ -11,11 +11,12 @@ namespace DotNetOpenAuth.OAuth2.Messages {
using System.Text;
using DotNetOpenAuth.Messaging;
+ using DotNetOpenAuth.OAuth2.ChannelElements;
/// <summary>
/// A request from a Client to an Authorization Server to exchange the user's username and password for an access token.
/// </summary>
- internal class AccessTokenResourceOwnerPasswordCredentialsRequest : ScopedAccessTokenRequest {
+ internal class AccessTokenResourceOwnerPasswordCredentialsRequest : ScopedAccessTokenRequest, IAuthorizationCarryingRequest, IAuthorizationDescription {
/// <summary>
/// Initializes a new instance of the <see cref="AccessTokenResourceOwnerPasswordCredentialsRequest"/> class.
/// </summary>
@@ -25,6 +26,43 @@ namespace DotNetOpenAuth.OAuth2.Messages {
: base(accessTokenEndpoint, version) {
}
+ #region IAuthorizationCarryingRequest members
+
+ /// <summary>
+ /// Gets the authorization that the code or token describes.
+ /// </summary>
+ IAuthorizationDescription IAuthorizationCarryingRequest.AuthorizationDescription {
+ get { return this.CredentialsValidated ? this : null; }
+ }
+
+ #endregion
+
+ #region IAuthorizationDescription Members
+
+ /// <summary>
+ /// Gets the date this authorization was established or the token was issued.
+ /// </summary>
+ /// <value>A date/time expressed in UTC.</value>
+ DateTime IAuthorizationDescription.UtcIssued {
+ get { return DateTime.UtcNow; }
+ }
+
+ /// <summary>
+ /// Gets the name on the account whose data on the resource server is accessible using this authorization.
+ /// </summary>
+ string IAuthorizationDescription.User {
+ get { return this.UserName; }
+ }
+
+ /// <summary>
+ /// Gets the scope of operations the client is allowed to invoke.
+ /// </summary>
+ HashSet<string> IAuthorizationDescription.Scope {
+ get { return this.Scope; }
+ }
+
+ #endregion
+
/// <summary>
/// Gets the type of the grant.
/// </summary>
@@ -46,5 +84,10 @@ namespace DotNetOpenAuth.OAuth2.Messages {
/// <value>The password.</value>
[MessagePart(Protocol.password, IsRequired = true)]
internal string Password { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the resource owner's credentials have been validated at the authorization server.
+ /// </summary>
+ internal bool CredentialsValidated { get; set; }
}
}