Code Monkey home page Code Monkey logo

Comments (3)

NN--- avatar NN--- commented on August 19, 2024

It is very easy to do.

Method in UriUtil.cs:

        /// <summary>
        /// Uses absolute or relative uri.
        /// </summary>
        /// <param name="uri"></param>
        /// <returns>String representing the uri</returns>
        internal static string GetAbsoluteOrRelativeUri(this Uri uri)
        {
            if (uri.IsAbsoluteUri) return uri.AbsoluteUri;
            else                   return uri.ToString();
        }

DotNetOpenAuth\Messaging\Reflection\MessagePart.cs

pubilc  MessagePart()
{
  ...
  Map<Uri>(uri => uri.GetAbsoluteOrRelativeUri(), uri => uri.OriginalString, safeUri);
}

DotNetOpenAuth\OAuth2\Messages\EndUserAuthorizationRequest.cs

Remove check for absolute Uri.

protected override void EnsureValidMessage() {
  ...
 // ErrorUtilities.VerifyProtocol(this.Callback == null || this.Callback.IsAbsoluteUri, this, OAuthStrings.AbsoluteUriRequired, Protocol.redirect_uri);
}   

Same in other places.

from dotnetopenauth.

AArnott avatar AArnott commented on August 19, 2024

This requirement for absolute URIs is By Design. For several reasons, including security, absolute URLs are required by the OAuth spec.
Also, Uri.AbsoluteUri is not equivalent to Uri.ToString() (see http://blog.nerdbank.net/2008/04/uriabsoluteuri-and-uritostring-are-not.html) so it is not OK to just use the other one when a relative URL is detected.
You should simply create absolute URLs out of your relative ones before passing them to the library.

from dotnetopenauth.

NN--- avatar NN--- commented on August 19, 2024

I see.
Ok, I'll try to find workaround using absolute URI.

from dotnetopenauth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.