diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2011-06-21 21:35:03 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2011-06-21 21:35:03 -0700 |
commit | 60a3e3306072160837caf4cb1e62668fbc852016 (patch) | |
tree | 7fce8b41f6e2f8b0b61932cc2d53a69f10eebbdb /src | |
parent | 9f4db8ff230e3e23fbd829a692a04037460f406a (diff) | |
download | DotNetOpenAuth-60a3e3306072160837caf4cb1e62668fbc852016.zip DotNetOpenAuth-60a3e3306072160837caf4cb1e62668fbc852016.tar.gz DotNetOpenAuth-60a3e3306072160837caf4cb1e62668fbc852016.tar.bz2 |
Removed a couple of parameters from auth code success authorization responses that only belonged in access token responses.
Diffstat (limited to 'src')
3 files changed, 27 insertions, 17 deletions
diff --git a/src/DotNetOpenAuth/OAuth2/AuthorizationServer.cs b/src/DotNetOpenAuth/OAuth2/AuthorizationServer.cs index 20c903b..7823ee2 100644 --- a/src/DotNetOpenAuth/OAuth2/AuthorizationServer.cs +++ b/src/DotNetOpenAuth/OAuth2/AuthorizationServer.cs @@ -185,7 +185,15 @@ namespace DotNetOpenAuth.OAuth2 { EndUserAuthorizationSuccessResponseBase response; switch (authorizationRequest.ResponseType) { case EndUserAuthorizationResponseType.AccessToken: - response = new EndUserAuthorizationSuccessAccessTokenResponse(callback, authorizationRequest); + var accessTokenResponse = new EndUserAuthorizationSuccessAccessTokenResponse(callback, authorizationRequest); + response = accessTokenResponse; + RSACryptoServiceProvider rsa; + TimeSpan lifetime; + this.AuthorizationServerServices.PrepareAccessToken(authorizationRequest, out rsa, out lifetime); + IDisposable disposableKey = rsa; + disposableKey.Dispose(); + accessTokenResponse.Lifetime = lifetime; + break; case EndUserAuthorizationResponseType.AuthorizationCode: response = new EndUserAuthorizationSuccessAuthCodeResponse(callback, authorizationRequest); @@ -201,13 +209,6 @@ namespace DotNetOpenAuth.OAuth2 { response.Scope.ResetContents(scopes); } - RSACryptoServiceProvider rsa; - TimeSpan lifetime; - this.AuthorizationServerServices.PrepareAccessToken(authorizationRequest, out rsa, out lifetime); - IDisposable disposableKey = rsa; - disposableKey.Dispose(); - response.Lifetime = lifetime; - return response; } diff --git a/src/DotNetOpenAuth/OAuth2/Messages/EndUserAuthorizationSuccessAccessTokenResponse.cs b/src/DotNetOpenAuth/OAuth2/Messages/EndUserAuthorizationSuccessAccessTokenResponse.cs index a752a04..093802a 100644 --- a/src/DotNetOpenAuth/OAuth2/Messages/EndUserAuthorizationSuccessAccessTokenResponse.cs +++ b/src/DotNetOpenAuth/OAuth2/Messages/EndUserAuthorizationSuccessAccessTokenResponse.cs @@ -100,5 +100,22 @@ namespace DotNetOpenAuth.OAuth2.Messages { /// <value>The access token.</value> [MessagePart(Protocol.access_token, IsRequired = true)] public string AccessToken { get; set; } + + /// <summary> + /// Gets the scope of the <see cref="AccessToken"/> if one is given; otherwise the scope of the authorization code. + /// </summary> + /// <value>The scope.</value> + [MessagePart(Protocol.scope, IsRequired = false, Encoder = typeof(ScopeEncoder))] + public new ICollection<string> Scope { + get { return base.Scope; } + protected set { base.Scope = value; } + } + + /// <summary> + /// Gets or sets the lifetime of the authorization. + /// </summary> + /// <value>The lifetime.</value> + [MessagePart(Protocol.expires_in, IsRequired = false, Encoder = typeof(TimespanSecondsEncoder))] + internal TimeSpan? Lifetime { get; set; } } } diff --git a/src/DotNetOpenAuth/OAuth2/Messages/EndUserAuthorizationSuccessResponseBase.cs b/src/DotNetOpenAuth/OAuth2/Messages/EndUserAuthorizationSuccessResponseBase.cs index c3d36fc..b975a09 100644 --- a/src/DotNetOpenAuth/OAuth2/Messages/EndUserAuthorizationSuccessResponseBase.cs +++ b/src/DotNetOpenAuth/OAuth2/Messages/EndUserAuthorizationSuccessResponseBase.cs @@ -59,15 +59,7 @@ namespace DotNetOpenAuth.OAuth2.Messages { /// Gets the scope of the <see cref="AccessToken"/> if one is given; otherwise the scope of the authorization code. /// </summary> /// <value>The scope.</value> - [MessagePart(Protocol.scope, IsRequired = false, Encoder = typeof(ScopeEncoder))] - public ICollection<string> Scope { get; private set; } - - /// <summary> - /// Gets or sets the lifetime of the authorization. - /// </summary> - /// <value>The lifetime.</value> - [MessagePart(Protocol.expires_in, IsRequired = false, Encoder = typeof(TimespanSecondsEncoder))] - internal TimeSpan? Lifetime { get; set; } + public ICollection<string> Scope { get; protected set; } /// <summary> /// Gets or sets the authorizing user's account name. |