/// <summary>
        /// Handles continuation of the process following a completed redirect, the request token url must be provided if it has been returned by the discovery process.
        /// Only the request and redirectedUrl are required, however if the redirect being handled is the result of calling the Authorization URL then the remaining parameters are required.
        /// </summary>
        /// <param name="request">Originating web request</param>
        /// <param name="redirectedUrl">Url redirected to by the completion of the previous step</param>
        /// <param name="sdkSession">SDKSession id used to fetch the discovery response with additional parameters that are required to request a token</param>
        /// <param name="expectedState">The state value returned from the StartAuthorization call should be passed here, it will be used to validate the authenticity of the authorization process</param>
        /// <param name="expectedNonce">The nonce value returned from the StartAuthorization call should be passed here, it will be used to ensure the token was not requested using a replay attack</param>
        /// <param name="options">Optional parameters</param>
        /// <returns>MobileConnectStatus object with required information for continuing the mobileconnect process</returns>
        public async Task <MobileConnectStatus> HandleUrlRedirectAsync(
            HttpRequestMessage request,
            Uri redirectedUrl,
            string sdkSession    = null,
            string expectedState = null,
            string expectedNonce = null,
            MobileConnectRequestOptions options = null, string version = null)
        {
            var discoveryResponse = await GetSessionFromCache(sdkSession);

            if (discoveryResponse == null && (expectedNonce != null || expectedState != null || sdkSession != null))
            {
                return(GetCacheError());
            }

            return(await CacheIfRequired(
                       await MobileConnectInterfaceHelper.HandleUrlRedirect(
                           _discovery,
                           _authentication,
                           _jwks,
                           redirectedUrl,
                           discoveryResponse,
                           expectedState,
                           expectedNonce,
                           _config,
                           options, version)));
        }
예제 #2
0
 /// <summary>
 /// Synchronous wrapper for <see cref="MobileConnectInterface.HandleUrlRedirectAsync(Uri, DiscoveryResponse, string, string, MobileConnectRequestOptions)"/>
 /// </summary>
 /// <param name="redirectedUrl">Url redirected to by the completion of the previous step</param>
 /// <param name="discoveryResponse">The response returned by the discovery process</param>
 /// <param name="expectedState">The state value returned from the StartAuthorization call should be passed here, it will be used to validate the authenticity of the authorization process</param>
 /// <param name="expectedNonce">The nonce value returned from the StartAuthorization call should be passed here, it will be used to ensure the token was not requested using a replay attack</param>
 /// <param name="options">Optional parameters</param>
 /// <returns>MobileConnectStatus object with required information for continuing the mobileconnect process</returns>
 public MobileConnectStatus HandleUrlRedirect(
     Uri redirectedUrl,
     DiscoveryResponse discoveryResponse = null,
     string expectedState = null,
     string expectedNonce = null,
     MobileConnectRequestOptions options = null, string version = null)
 {
     return(MobileConnectInterfaceHelper.HandleUrlRedirect(
                _discovery,
                _authentication,
                _jwks,
                redirectedUrl,
                discoveryResponse,
                expectedState,
                expectedNonce,
                _config,
                options, version).Result);
 }
 /// <summary>
 /// Handles continuation of the process following a completed redirect, the request token url must be provided if it has been returned by the discovery process.
 /// Only the request and redirectedUrl are required, however if the redirect being handled is the result of calling the Authorization URL then the remaining parameters are required.
 /// </summary>
 /// <param name="request">Originating web request</param>
 /// <param name="redirectedUrl">Url redirected to by the completion of the previous step</param>
 /// <param name="discoveryResponse">The response returned by the discovery process</param>
 /// <param name="expectedState">The state value returned from the StartAuthorization call should be passed here, it will be used to validate the authenticity of the authorization process</param>
 /// <param name="expectedNonce">The nonce value returned from the StartAuthorization call should be passed here, it will be used to ensure the token was not requested using a replay attack</param>
 /// <param name="options">Optional parameters</param>
 /// <returns>MobileConnectStatus object with required information for continuing the mobileconnect process</returns>
 public async Task <MobileConnectStatus> HandleUrlRedirectAsync(
     HttpRequestMessage request,
     Uri redirectedUrl,
     DiscoveryResponse
     discoveryResponse    = null,
     string expectedState = null,
     string expectedNonce = null,
     MobileConnectRequestOptions options = null, string version = null)
 {
     return(await CacheIfRequired(
                await MobileConnectInterfaceHelper.HandleUrlRedirect(
                    _discovery,
                    _authentication,
                    _jwks,
                    redirectedUrl,
                    discoveryResponse,
                    expectedState,
                    expectedNonce,
                    _config,
                    options, version)));
 }
예제 #4
0
 /// <summary>
 /// Synchronous wrapper for <see cref="MobileConnectInterface.HandleUrlRedirectAsync(Uri, DiscoveryResponse, string, string)"/>
 /// </summary>
 /// <param name="redirectedUrl">Url redirected to by the completion of the previous step</param>
 /// <param name="discoveryResponse">The response returned by the discovery process</param>
 /// <param name="expectedState">The state value returned from the StartAuthorization call should be passed here, it will be used to validate the authenticity of the authorization process</param>
 /// <param name="expectedNonce">The nonce value returned from the StartAuthorization call should be passed here, it will be used to ensure the token was not requested using a replay attack</param>
 /// <param name="requestTokenUrl">Url for token request, this is returned by the discovery process. An error status will be returned if the redirected url triggers a token request and this parameter has not been provided.</param>
 /// <returns>MobileConnectStatus object with required information for continuing the mobileconnect process</returns>
 public MobileConnectStatus HandleUrlRedirect(Uri redirectedUrl, DiscoveryResponse discoveryResponse = null, string expectedState = null, string expectedNonce = null, string requestTokenUrl = null)
 {
     return(MobileConnectInterfaceHelper.HandleUrlRedirect(_discovery, _authentication, redirectedUrl, discoveryResponse, expectedState, expectedNonce, _config).Result);
 }
예제 #5
0
 /// <summary>
 /// Handles continuation of the process following a completed redirect.
 /// Only the redirectedUrl is required, however if the redirect being handled is the result of calling the Authorization URL then the remaining parameters are required.
 /// </summary>
 /// <param name="redirectedUrl">Url redirected to by the completion of the previous step</param>
 /// <param name="discoveryResponse">The response returned by the discovery process</param>
 /// <param name="expectedState">The state value returned from the StartAuthorization call should be passed here, it will be used to validate the authenticity of the authorization process</param>
 /// <param name="expectedNonce">The nonce value returned from the StartAuthorization call should be passed here, it will be used to ensure the token was not requested using a replay attack</param>
 /// <returns>MobileConnectStatus object with required information for continuing the mobileconnect process</returns>
 public async Task <MobileConnectStatus> HandleUrlRedirectAsync(Uri redirectedUrl, DiscoveryResponse discoveryResponse = null, string expectedState = null, string expectedNonce = null)
 {
     return(await MobileConnectInterfaceHelper.HandleUrlRedirect(_discovery, _authentication, redirectedUrl, discoveryResponse, expectedState, expectedNonce, _config));
 }