Question

I'm trying to implement openId for my site and am using Janrain's library with php. I want to check if openId user provided is already stored in database. I want to compare only normalized uri's to avoid situation when user sometimes doesn't type in "http://..." etc. Now, I'm having trouble finding out specific function that can normalize uri for me right after user enters openId, so as soon as it hits my server, before anything is being send to openId provider. btw as you can imagine slowly I am getting fed up with trying to get all this working, but still willing to give it a try so any help would be much appreciated.

Was it helpful?

Solution

(Assuming you mean Janrain's "OpenID Enabled" PHP5 library, v 2.2.2 or thereabouts.) There is Auth_OpenID::normalizeUrl($url) defined in OpenID.php, however it is marked as @access private. Initiating an authorization transaction will get you a normalized URL as a result of the process, but that's not really what you are looking for. You could ignore the private access, hack the library to make it public, and then just keep your patch implemented as you upgrade versions (if they ever release one). Alternatively, you could just look at what they're doing and copy it out to a function of your own, avoiding any library hacks and the associated version control issues.

OTHER TIPS

If you use something like:

$url = str_replace(array("http://", "https://", "www."), "", $url);

That should help you get the same URL each time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top