diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2013-03-03 16:36:51 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2013-03-03 16:36:51 -0800 |
commit | a57b51806ceebaa64db730809d6d7fd07c5b42ce (patch) | |
tree | abbe0666f8ee621b72c339d341b45b86e1346cb5 /src | |
parent | 475b47ab8eaa23e064763b05539fa750accebfdc (diff) | |
download | DotNetOpenAuth-a57b51806ceebaa64db730809d6d7fd07c5b42ce.zip DotNetOpenAuth-a57b51806ceebaa64db730809d6d7fd07c5b42ce.tar.gz DotNetOpenAuth-a57b51806ceebaa64db730809d6d7fd07c5b42ce.tar.bz2 |
Adds OpenID RP to WebAPI sample so it's a real login.
Diffstat (limited to 'src')
3 files changed, 20 insertions, 4 deletions
diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServer.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServer.cs index 5b287cc..cd603eb 100644 --- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServer.cs +++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServer.cs @@ -110,6 +110,21 @@ namespace DotNetOpenAuth.OAuth2 { } /// <summary> + /// Reads in a client's request for the Authorization Server to obtain permission from + /// the user to authorize the Client's access of some protected resource(s). + /// </summary> + /// <param name="requestUri">The URL that carries the authorization request.</param> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns> + /// The incoming request, or null if no OAuth message was attached. + /// </returns> + /// <exception cref="ProtocolException">Thrown if an unexpected OAuth message is attached to the incoming request.</exception> + public Task<EndUserAuthorizationRequest> ReadAuthorizationRequestAsync(Uri requestUri, CancellationToken cancellationToken = default(CancellationToken)) { + var httpInfo = HttpRequestInfo.Create(HttpMethod.Get.Method, requestUri); + return this.ReadAuthorizationRequestAsync(httpInfo, cancellationToken); + } + + /// <summary> /// Handles an incoming request to the authorization server's token endpoint. /// </summary> /// <param name="request">The HTTP request.</param> diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/OpenIdRelyingParty.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/OpenIdRelyingParty.cs index 3a3b430..6a1ef83 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/OpenIdRelyingParty.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/OpenIdRelyingParty.cs @@ -93,7 +93,8 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { private Channel channel; /// <summary> - /// Initializes a new instance of the <see cref="OpenIdRelyingParty"/> class. + /// Initializes a new instance of the <see cref="OpenIdRelyingParty"/> class + /// such that it uses a memory store for things it must remember across logins. /// </summary> public OpenIdRelyingParty() : this(OpenIdElement.Configuration.RelyingParty.ApplicationStore.CreateInstance(GetHttpApplicationStore(), null)) { @@ -519,7 +520,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <remarks> /// Requires an <see cref="HttpContext.Current">HttpContext.Current</see> context. /// </remarks> - public Task<IAuthenticationResponse> GetResponseAsync(CancellationToken cancellationToken) { + public Task<IAuthenticationResponse> GetResponseAsync(CancellationToken cancellationToken = default(CancellationToken)) { RequiresEx.ValidState(HttpContext.Current != null && HttpContext.Current.Request != null, MessagingStrings.HttpContextRequired); return this.GetResponseAsync(this.Channel.GetRequestFromContext(), cancellationToken); } @@ -532,7 +533,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <returns> /// The processed authentication response if there is any; <c>null</c> otherwise. /// </returns> - public async Task<IAuthenticationResponse> GetResponseAsync(HttpRequestBase httpRequestInfo, CancellationToken cancellationToken) { + public async Task<IAuthenticationResponse> GetResponseAsync(HttpRequestBase httpRequestInfo, CancellationToken cancellationToken = default(CancellationToken)) { Requires.NotNull(httpRequestInfo, "httpRequestInfo"); try { var message = await this.Channel.ReadFromRequestAsync(httpRequestInfo, cancellationToken); diff --git a/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/IAuthenticationRequest.cs b/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/IAuthenticationRequest.cs index 10b0730..3e922d4 100644 --- a/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/IAuthenticationRequest.cs +++ b/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/IAuthenticationRequest.cs @@ -175,6 +175,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// </summary> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>The response message that will cause the client to redirect to the Provider.</returns> - Task<HttpResponseMessage> GetRedirectingResponseAsync(CancellationToken cancellationToken); + Task<HttpResponseMessage> GetRedirectingResponseAsync(CancellationToken cancellationToken = default(CancellationToken)); } } |