diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2012-02-23 07:47:08 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2012-02-23 07:47:08 -0800 |
commit | 8679fd44bbe14b590353c128d47e9a73cf180160 (patch) | |
tree | 7b69e3a3170c6c825cb958863a924146c3e427ba /src | |
parent | d1ef15d419f5235cc7266c9128790e20b92c5e58 (diff) | |
download | DotNetOpenAuth-8679fd44bbe14b590353c128d47e9a73cf180160.zip DotNetOpenAuth-8679fd44bbe14b590353c128d47e9a73cf180160.tar.gz DotNetOpenAuth-8679fd44bbe14b590353c128d47e9a73cf180160.tar.bz2 |
Split out the authorization carrying messages into distinct interfaces.
This is to support additional grant types such as resource owner password credential and client credentials.
Diffstat (limited to 'src')
13 files changed, 160 insertions, 132 deletions
diff --git a/src/DotNetOpenAuth.OAuth2/DotNetOpenAuth.OAuth2.csproj b/src/DotNetOpenAuth.OAuth2/DotNetOpenAuth.OAuth2.csproj index a9235ba..0a2a8ff 100644 --- a/src/DotNetOpenAuth.OAuth2/DotNetOpenAuth.OAuth2.csproj +++ b/src/DotNetOpenAuth.OAuth2/DotNetOpenAuth.OAuth2.csproj @@ -26,7 +26,10 @@ <Compile Include="OAuth2\ChannelElements\AuthServerBindingElementBase.cs" /> <Compile Include="OAuth2\ChannelElements\GrantTypeEncoder.cs" /> <Compile Include="OAuth2\ChannelElements\EndUserAuthorizationResponseTypeEncoder.cs" /> + <Compile Include="OAuth2\ChannelElements\IAccessTokenCarryingRequest.cs" /> + <Compile Include="OAuth2\ChannelElements\IAuthorizationCodeCarryingRequest.cs" /> <Compile Include="OAuth2\ChannelElements\IOAuth2ChannelWithAuthorizationServer.cs" /> + <Compile Include="OAuth2\ChannelElements\IRefreshTokenCarryingRequest.cs" /> <Compile Include="OAuth2\ChannelElements\OAuth2ChannelBase.cs" /> <Compile Include="OAuth2\ChannelElements\OAuth2ClientChannel.cs" /> <Compile Include="OAuth2\ChannelElements\ScopeEncoder.cs" /> diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/AccessRequestBindingElement.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/AccessRequestBindingElement.cs index b1ead11..6132c98 100644 --- a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/AccessRequestBindingElement.cs +++ b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/AccessRequestBindingElement.cs @@ -55,26 +55,23 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements { /// <see cref="MessagePartAttribute.RequiredProtection"/> properties where applicable. /// </remarks> public override MessageProtections? ProcessOutgoingMessage(IProtocolMessage message) { - var response = message as IAuthorizationCarryingRequest; - if (response != null) { - switch (response.CodeOrTokenType) { - case CodeOrTokenType.AuthorizationCode: - var codeFormatter = AuthorizationCode.CreateFormatter(this.AuthorizationServer); - var code = (AuthorizationCode)response.AuthorizationDescription; - response.CodeOrToken = codeFormatter.Serialize(code); - break; - case CodeOrTokenType.AccessToken: - var responseWithOriginatingRequest = (IDirectResponseProtocolMessage)message; - var request = (IAccessTokenRequest)responseWithOriginatingRequest.OriginatingRequest; - - using (var resourceServerKey = this.AuthorizationServer.GetResourceServerEncryptionKey(request)) { - var tokenFormatter = AccessToken.CreateFormatter(this.AuthorizationServer.AccessTokenSigningKey, resourceServerKey); - var token = (AccessToken)response.AuthorizationDescription; - response.CodeOrToken = tokenFormatter.Serialize(token); - break; - } - default: - throw ErrorUtilities.ThrowInternal(string.Format(CultureInfo.CurrentCulture, "Unexpected outgoing code or token type: {0}", response.CodeOrTokenType)); + var authCodeCarrier = message as IAuthorizationCodeCarryingRequest; + if (authCodeCarrier != null) { + var codeFormatter = AuthorizationCode.CreateFormatter(this.AuthorizationServer); + var code = authCodeCarrier.AuthorizationDescription; + authCodeCarrier.Code = codeFormatter.Serialize(code); + return MessageProtections.None; + } + + var accessTokenCarrier = message as IAccessTokenCarryingRequest; + if (accessTokenCarrier != null) { + var responseWithOriginatingRequest = (IDirectResponseProtocolMessage)message; + var request = (IAccessTokenRequest)responseWithOriginatingRequest.OriginatingRequest; + + using (var resourceServerKey = this.AuthorizationServer.GetResourceServerEncryptionKey(request)) { + var tokenFormatter = AccessToken.CreateFormatter(this.AuthorizationServer.AccessTokenSigningKey, resourceServerKey); + var token = accessTokenCarrier.AuthorizationDescription; + accessTokenCarrier.AccessToken = tokenFormatter.Serialize(token); } return MessageProtections.None; @@ -115,19 +112,18 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements { var tokenRequest = message as IAuthorizationCarryingRequest; if (tokenRequest != null) { try { - switch (tokenRequest.CodeOrTokenType) { - case CodeOrTokenType.AuthorizationCode: - var verificationCodeFormatter = AuthorizationCode.CreateFormatter(this.AuthorizationServer); - var verificationCode = verificationCodeFormatter.Deserialize(message, tokenRequest.CodeOrToken); - tokenRequest.AuthorizationDescription = verificationCode; - break; - case CodeOrTokenType.RefreshToken: - var refreshTokenFormatter = RefreshToken.CreateFormatter(this.AuthorizationServer.CryptoKeyStore); - var refreshToken = refreshTokenFormatter.Deserialize(message, tokenRequest.CodeOrToken); - tokenRequest.AuthorizationDescription = refreshToken; - break; - default: - throw ErrorUtilities.ThrowInternal("Unexpected value for CodeOrTokenType: " + tokenRequest.CodeOrTokenType); + var authCodeCarrier = message as IAuthorizationCodeCarryingRequest; + var refreshTokenCarrier = message as IRefreshTokenCarryingRequest; + if (authCodeCarrier != null) { + var authorizationCodeFormatter = AuthorizationCode.CreateFormatter(this.AuthorizationServer); + var authorizationCode = authorizationCodeFormatter.Deserialize(message, authCodeCarrier.Code); + authCodeCarrier.AuthorizationDescription = authorizationCode; + } else if (refreshTokenCarrier != null) { + var refreshTokenFormatter = RefreshToken.CreateFormatter(this.AuthorizationServer.CryptoKeyStore); + var refreshToken = refreshTokenFormatter.Deserialize(message, refreshTokenCarrier.RefreshToken); + refreshTokenCarrier.AuthorizationDescription = refreshToken; + } else { + throw ErrorUtilities.ThrowInternal("Unexpected message type: " + tokenRequest.GetType()); } } catch (ExpiredMessageException ex) { throw ErrorUtilities.Wrap(ex, Protocol.authorization_expired); diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/AccessTokenBindingElement.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/AccessTokenBindingElement.cs index 6e0012a..4c63f29 100644 --- a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/AccessTokenBindingElement.cs +++ b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/AccessTokenBindingElement.cs @@ -48,7 +48,7 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements { var implicitGrantResponse = message as EndUserAuthorizationSuccessAccessTokenResponse; if (implicitGrantResponse != null) { - IAuthorizationCarryingRequest tokenCarryingResponse = implicitGrantResponse; + IAccessTokenCarryingRequest tokenCarryingResponse = implicitGrantResponse; tokenCarryingResponse.AuthorizationDescription = new AccessToken(request.ClientIdentifier, implicitGrantResponse.Scope, implicitGrantResponse.AuthorizingUsername, implicitGrantResponse.Lifetime); return MessageProtections.None; diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/AuthorizationCodeBindingElement.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/AuthorizationCodeBindingElement.cs index ea6d91f..d602cae 100644 --- a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/AuthorizationCodeBindingElement.cs +++ b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/AuthorizationCodeBindingElement.cs @@ -60,7 +60,7 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements { if (response != null) { var directResponse = (IDirectResponseProtocolMessage)response; var request = (EndUserAuthorizationRequest)directResponse.OriginatingRequest; - IAuthorizationCarryingRequest tokenCarryingResponse = response; + IAuthorizationCodeCarryingRequest tokenCarryingResponse = response; tokenCarryingResponse.AuthorizationDescription = new AuthorizationCode(request.ClientIdentifier, request.Callback, response.Scope, response.AuthorizingUsername); return MessageProtections.None; diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/IAccessTokenCarryingRequest.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/IAccessTokenCarryingRequest.cs new file mode 100644 index 0000000..3f5f0f2 --- /dev/null +++ b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/IAccessTokenCarryingRequest.cs @@ -0,0 +1,22 @@ +//----------------------------------------------------------------------- +// <copyright file="IAccessTokenCarryingRequest.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace DotNetOpenAuth.OAuth2.ChannelElements { + /// <summary> + /// A message that carries an access token between client and authorization server. + /// </summary> + internal interface IAccessTokenCarryingRequest : IAuthorizationCarryingRequest { + /// <summary> + /// Gets or sets the access token. + /// </summary> + string AccessToken { get; set; } + + /// <summary> + /// Gets or sets the authorization that the token describes. + /// </summary> + new AccessToken AuthorizationDescription { get; set; } + } +} diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/IAuthorizationCarryingRequest.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/IAuthorizationCarryingRequest.cs index f47bac1..13a1b24 100644 --- a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/IAuthorizationCarryingRequest.cs +++ b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/IAuthorizationCarryingRequest.cs @@ -10,45 +10,12 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements { using Messaging; /// <summary> - /// The various types of tokens created by the authorization server. - /// </summary> - internal enum CodeOrTokenType { - /// <summary> - /// The code issued to the client after the user has approved authorization. - /// </summary> - AuthorizationCode, - - /// <summary> - /// The long-lived token issued to the client that enables it to obtain - /// short-lived access tokens later. - /// </summary> - RefreshToken, - - /// <summary> - /// A (typically) short-lived token. - /// </summary> - AccessToken, - } - - /// <summary> /// A message that carries some kind of token from the client to the authorization or resource server. /// </summary> internal interface IAuthorizationCarryingRequest : IDirectedProtocolMessage { /// <summary> - /// Gets or sets the verification code or refresh/access token. - /// </summary> - /// <value>The code or token.</value> - string CodeOrToken { get; set; } - - /// <summary> - /// Gets the type of the code or token. - /// </summary> - /// <value>The type of the code or token.</value> - CodeOrTokenType CodeOrTokenType { get; } - - /// <summary> - /// Gets or sets the authorization that the token describes. + /// Gets the authorization that the code or token describes. /// </summary> - IAuthorizationDescription AuthorizationDescription { get; set; } + IAuthorizationDescription AuthorizationDescription { get; } } } diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/IAuthorizationCodeCarryingRequest.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/IAuthorizationCodeCarryingRequest.cs new file mode 100644 index 0000000..045cb80 --- /dev/null +++ b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/IAuthorizationCodeCarryingRequest.cs @@ -0,0 +1,22 @@ +//----------------------------------------------------------------------- +// <copyright file="IAuthorizationCodeCarryingRequest.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace DotNetOpenAuth.OAuth2.ChannelElements { + /// <summary> + /// A message that carries an authorization code between client and authorization server. + /// </summary> + internal interface IAuthorizationCodeCarryingRequest : IAuthorizationCarryingRequest { + /// <summary> + /// Gets or sets the authorization code. + /// </summary> + string Code { get; set; } + + /// <summary> + /// Gets or sets the authorization that the code describes. + /// </summary> + new AuthorizationCode AuthorizationDescription { get; set; } + } +} diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/IRefreshTokenCarryingRequest.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/IRefreshTokenCarryingRequest.cs new file mode 100644 index 0000000..ce27538 --- /dev/null +++ b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/IRefreshTokenCarryingRequest.cs @@ -0,0 +1,22 @@ +//----------------------------------------------------------------------- +// <copyright file="IRefreshTokenCarryingRequest.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace DotNetOpenAuth.OAuth2.ChannelElements { + /// <summary> + /// A message that carries a refresh token between client and authorization server. + /// </summary> + internal interface IRefreshTokenCarryingRequest : IAuthorizationCarryingRequest { + /// <summary> + /// Gets or sets the refresh token. + /// </summary> + string RefreshToken { get; set; } + + /// <summary> + /// Gets or sets the authorization that the token describes. + /// </summary> + new RefreshToken AuthorizationDescription { get; set; } + } +} diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/AccessProtectedResourceRequest.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/AccessProtectedResourceRequest.cs index c069d08..246a4ef 100644 --- a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/AccessProtectedResourceRequest.cs +++ b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/AccessProtectedResourceRequest.cs @@ -20,7 +20,7 @@ namespace DotNetOpenAuth.OAuth2.Messages { /// When support for additional access token types is added, this class should probably be refactored /// into derived types, where each derived type supports a particular access token type. /// </remarks> - internal class AccessProtectedResourceRequest : MessageBase, IAuthorizationCarryingRequest { + internal class AccessProtectedResourceRequest : MessageBase, IAccessTokenCarryingRequest { /// <summary> /// Initializes a new instance of the <see cref="AccessProtectedResourceRequest"/> class. /// </summary> @@ -30,19 +30,12 @@ namespace DotNetOpenAuth.OAuth2.Messages { : base(version, MessageTransport.Direct, recipient) { } - /// <summary> - /// Gets the type of the code or token. - /// </summary> - /// <value>The type of the code or token.</value> - CodeOrTokenType IAuthorizationCarryingRequest.CodeOrTokenType { - get { return CodeOrTokenType.AccessToken; } - } + #region IAccessTokenCarryingRequest Members /// <summary> - /// Gets or sets the verification code or refresh/access token. + /// Gets or sets the access token. /// </summary> - /// <value>The code or token.</value> - string IAuthorizationCarryingRequest.CodeOrToken { + string IAccessTokenCarryingRequest.AccessToken { get { return this.AccessToken; } set { this.AccessToken = value; } } @@ -50,7 +43,16 @@ namespace DotNetOpenAuth.OAuth2.Messages { /// <summary> /// Gets or sets the authorization that the token describes. /// </summary> - IAuthorizationDescription IAuthorizationCarryingRequest.AuthorizationDescription { get; set; } + AccessToken IAccessTokenCarryingRequest.AuthorizationDescription { get; set; } + + /// <summary> + /// Gets the authorization that the token describes. + /// </summary> + IAuthorizationDescription IAuthorizationCarryingRequest.AuthorizationDescription { + get { return ((IAccessTokenCarryingRequest)this).AuthorizationDescription; } + } + + #endregion /// <summary> /// Gets the type of the access token. diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/AccessTokenAuthorizationCodeRequest.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/AccessTokenAuthorizationCodeRequest.cs index 4931040..1f244f9 100644 --- a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/AccessTokenAuthorizationCodeRequest.cs +++ b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/AccessTokenAuthorizationCodeRequest.cs @@ -18,7 +18,7 @@ namespace DotNetOpenAuth.OAuth2.Messages { /// A request from a Client to an Authorization Server to exchange an authorization code for an access token, /// and (at the authorization server's option) a refresh token. /// </summary> - internal class AccessTokenAuthorizationCodeRequest : AccessTokenRequestBase, IAuthorizationCarryingRequest { + internal class AccessTokenAuthorizationCodeRequest : AccessTokenRequestBase, IAuthorizationCodeCarryingRequest { /// <summary> /// Initializes a new instance of the <see cref="AccessTokenAuthorizationCodeRequest"/> class. /// </summary> @@ -37,19 +37,13 @@ namespace DotNetOpenAuth.OAuth2.Messages { Requires.NotNull(authorizationServer, "authorizationServer"); } - /// <summary> - /// Gets the type of the code or token. - /// </summary> - /// <value>The type of the code or token.</value> - CodeOrTokenType IAuthorizationCarryingRequest.CodeOrTokenType { - get { return CodeOrTokenType.AuthorizationCode; } - } + #region IAuthorizationCodeCarryingRequest Members /// <summary> /// Gets or sets the verification code or refresh/access token. /// </summary> /// <value>The code or token.</value> - string IAuthorizationCarryingRequest.CodeOrToken { + string IAuthorizationCodeCarryingRequest.Code { get { return this.AuthorizationCode; } set { this.AuthorizationCode = value; } } @@ -57,7 +51,16 @@ namespace DotNetOpenAuth.OAuth2.Messages { /// <summary> /// Gets or sets the authorization that the token describes. /// </summary> - IAuthorizationDescription IAuthorizationCarryingRequest.AuthorizationDescription { get; set; } + AuthorizationCode IAuthorizationCodeCarryingRequest.AuthorizationDescription { get; set; } + + /// <summary> + /// Gets the authorization that the code describes. + /// </summary> + IAuthorizationDescription IAuthorizationCarryingRequest.AuthorizationDescription { + get { return ((IAuthorizationCodeCarryingRequest)this).AuthorizationDescription; } + } + + #endregion /// <summary> /// Gets the type of the grant. diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/AccessTokenRefreshRequest.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/AccessTokenRefreshRequest.cs index ca7abf0..2c3ab25 100644 --- a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/AccessTokenRefreshRequest.cs +++ b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/AccessTokenRefreshRequest.cs @@ -14,7 +14,7 @@ namespace DotNetOpenAuth.OAuth2.Messages { /// 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. /// </summary> - internal class AccessTokenRefreshRequest : ScopedAccessTokenRequest, IAuthorizationCarryingRequest { + internal class AccessTokenRefreshRequest : ScopedAccessTokenRequest, IRefreshTokenCarryingRequest { /// <summary> /// Initializes a new instance of the <see cref="AccessTokenRefreshRequest"/> class. /// </summary> @@ -32,19 +32,13 @@ namespace DotNetOpenAuth.OAuth2.Messages { : this(authorizationServer.TokenEndpoint, authorizationServer.Version) { } - /// <summary> - /// Gets the type of the code or token. - /// </summary> - /// <value>The type of the code or token.</value> - CodeOrTokenType IAuthorizationCarryingRequest.CodeOrTokenType { - get { return CodeOrTokenType.RefreshToken; } - } + #region IRefreshTokenCarryingRequest members /// <summary> /// Gets or sets the verification code or refresh/access token. /// </summary> /// <value>The code or token.</value> - string IAuthorizationCarryingRequest.CodeOrToken { + string IRefreshTokenCarryingRequest.RefreshToken { get { return this.RefreshToken; } set { this.RefreshToken = value; } } @@ -52,7 +46,16 @@ namespace DotNetOpenAuth.OAuth2.Messages { /// <summary> /// Gets or sets the authorization that the token describes. /// </summary> - IAuthorizationDescription IAuthorizationCarryingRequest.AuthorizationDescription { get; set; } + RefreshToken IRefreshTokenCarryingRequest.AuthorizationDescription { get; set; } + + /// <summary> + /// Gets the authorization that the token describes. + /// </summary> + IAuthorizationDescription IAuthorizationCarryingRequest.AuthorizationDescription { + get { return ((IRefreshTokenCarryingRequest)this).AuthorizationDescription; } + } + + #endregion /// <summary> /// Gets or sets the refresh token. diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/EndUserAuthorizationSuccessAccessTokenResponse.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/EndUserAuthorizationSuccessAccessTokenResponse.cs index 5456c97..5c03e7a 100644 --- a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/EndUserAuthorizationSuccessAccessTokenResponse.cs +++ b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/EndUserAuthorizationSuccessAccessTokenResponse.cs @@ -19,7 +19,7 @@ namespace DotNetOpenAuth.OAuth2.Messages { /// to indicate that user authorization was granted, carrying only an access token, /// and to return the user to the Client where they started their experience. /// </summary> - internal class EndUserAuthorizationSuccessAccessTokenResponse : EndUserAuthorizationSuccessResponseBase, IAuthorizationCarryingRequest, IHttpIndirectResponse { + internal class EndUserAuthorizationSuccessAccessTokenResponse : EndUserAuthorizationSuccessResponseBase, IAccessTokenCarryingRequest, IHttpIndirectResponse { /// <summary> /// Initializes a new instance of the <see cref="EndUserAuthorizationSuccessAccessTokenResponse"/> class. /// </summary> @@ -45,31 +45,21 @@ namespace DotNetOpenAuth.OAuth2.Messages { this.TokenType = Protocol.AccessTokenTypes.Bearer; } - #region IAuthorizationCarryingRequest Members + #region IAccessTokenCarryingRequest Members /// <summary> - /// Gets or sets the verification code or refresh/access token. + /// Gets or sets the authorization that the token describes. /// </summary> - /// <value>The code or token.</value> - string IAuthorizationCarryingRequest.CodeOrToken { - get { return this.AccessToken; } - set { this.AccessToken = value; } - } + /// <value></value> + AccessToken IAccessTokenCarryingRequest.AuthorizationDescription { get; set; } /// <summary> - /// Gets the type of the code or token. + /// Gets the authorization that the token describes. /// </summary> - /// <value>The type of the code or token.</value> - CodeOrTokenType IAuthorizationCarryingRequest.CodeOrTokenType { - get { return CodeOrTokenType.AccessToken; } + IAuthorizationDescription IAuthorizationCarryingRequest.AuthorizationDescription { + get { return ((IAccessTokenCarryingRequest)this).AuthorizationDescription; } } - /// <summary> - /// Gets or sets the authorization that the token describes. - /// </summary> - /// <value></value> - IAuthorizationDescription IAuthorizationCarryingRequest.AuthorizationDescription { get; set; } - #endregion #region IHttpIndirectResponse Members diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/EndUserAuthorizationSuccessAuthCodeResponse.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/EndUserAuthorizationSuccessAuthCodeResponse.cs index 179c342..dcacc14 100644 --- a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/EndUserAuthorizationSuccessAuthCodeResponse.cs +++ b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/EndUserAuthorizationSuccessAuthCodeResponse.cs @@ -16,7 +16,7 @@ namespace DotNetOpenAuth.OAuth2.Messages { /// to indicate that user authorization was granted, carrying an authorization code and possibly an access token, /// and to return the user to the Client where they started their experience. /// </summary> - internal class EndUserAuthorizationSuccessAuthCodeResponse : EndUserAuthorizationSuccessResponseBase, IAuthorizationCarryingRequest { + internal class EndUserAuthorizationSuccessAuthCodeResponse : EndUserAuthorizationSuccessResponseBase, IAuthorizationCodeCarryingRequest { /// <summary> /// Initializes a new instance of the <see cref="EndUserAuthorizationSuccessAuthCodeResponse"/> class. /// </summary> @@ -40,29 +40,27 @@ namespace DotNetOpenAuth.OAuth2.Messages { ((IMessageWithClientState)this).ClientState = request.ClientState; } - #region IAuthorizationCarryingRequest Members + #region IAuthorizationCodeCarryingRequest Members /// <summary> - /// Gets or sets the verification code or refresh/access token. + /// Gets or sets the authorization code. /// </summary> - /// <value>The code or token.</value> - string IAuthorizationCarryingRequest.CodeOrToken { + string IAuthorizationCodeCarryingRequest.Code { get { return this.AuthorizationCode; } set { this.AuthorizationCode = value; } } /// <summary> - /// Gets the type of the code or token. + /// Gets or sets the authorization that the token describes. /// </summary> - /// <value>The type of the code or token.</value> - CodeOrTokenType IAuthorizationCarryingRequest.CodeOrTokenType { - get { return CodeOrTokenType.AuthorizationCode; } - } + AuthorizationCode IAuthorizationCodeCarryingRequest.AuthorizationDescription { get; set; } /// <summary> - /// Gets or sets the authorization that the token describes. + /// Gets the authorization that the code describes. /// </summary> - IAuthorizationDescription IAuthorizationCarryingRequest.AuthorizationDescription { get; set; } + IAuthorizationDescription IAuthorizationCarryingRequest.AuthorizationDescription { + get { return ((IAuthorizationCodeCarryingRequest)this).AuthorizationDescription; } + } #endregion |