//-----------------------------------------------------------------------
//
// Copyright (c) Outercurve Foundation. All rights reserved.
//
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.OAuth2.Messages {
using System;
using System.Collections.Generic;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OAuth2.ChannelElements;
///
/// A request from the client to the token endpoint for a new access token
/// in exchange for a refresh token that the client has previously obtained.
///
internal class AccessTokenRefreshRequest : ScopedAccessTokenRequest, IRefreshTokenCarryingRequest {
///
/// Initializes a new instance of the class.
///
/// The token endpoint.
/// The version.
internal AccessTokenRefreshRequest(Uri tokenEndpoint, Version version)
: base(tokenEndpoint, version) {
}
///
/// Initializes a new instance of the class.
///
/// The authorization server.
internal AccessTokenRefreshRequest(AuthorizationServerDescription authorizationServer)
: this(authorizationServer.TokenEndpoint, authorizationServer.Version) {
}
#region IRefreshTokenCarryingRequest members
///
/// Gets or sets the verification code or refresh/access token.
///
/// The code or token.
string IRefreshTokenCarryingRequest.RefreshToken {
get { return this.RefreshToken; }
set { this.RefreshToken = value; }
}
///
/// Gets or sets the authorization that the token describes.
///
RefreshToken IRefreshTokenCarryingRequest.AuthorizationDescription { get; set; }
///
/// Gets the authorization that the token describes.
///
IAuthorizationDescription IAuthorizationCarryingRequest.AuthorizationDescription {
get { return ((IRefreshTokenCarryingRequest)this).AuthorizationDescription; }
}
#endregion
///
/// Gets or sets the refresh token.
///
/// The refresh token.
///
/// REQUIRED. The refresh token associated with the access token to be refreshed.
///
[MessagePart(Protocol.refresh_token, IsRequired = true)]
internal string RefreshToken { get; set; }
///
/// Gets the type of the grant.
///
/// The type of the grant.
internal override GrantType GrantType {
get { return Messages.GrantType.RefreshToken; }
}
}
}