Verifying a FAS instance via JSON?

Sijis Aviles sijis at fedoraproject.org
Mon Jul 12 23:55:43 UTC 2010


On Sun, Jul 11, 2010 at 2:03 PM, Toshio Kuratomi <a.badger at gmail.com> wrote:

> A few other differences between the python-fedora implementation and this:
>
> * I think that giving "username=XXX" as a param will yield an error.
> * I think you need to have FOLLOWLOCATION=True so you follow redirects.
>
> Here's what I *think* is php to implement that:
>
> -     curl_setopt($ch, CURLOPT_USERAGENT, "Drupal AuthFAS 0.1");
> -     curl_setopt($ch, CURLOPT_POSTFIELDS, "username=".urlencode($username)."&user_name=".urlencode($username).  "&password=".urlencode($password)."&login=Login");
> +     curl_setopt($ch, CURLOPT_HEADERS, "user-agent: Drupal AuthFAS 0.1; Accept: application/json;");
> +     curl_setopt($ch, CURLOPT_POSTFIELDS, "user_name=".urlencode($username).  "&password=".urlencode($password)."&login=Login");
> +     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1)
> +     curl_setopt($ch, CURLOPT_MAXREDIRS, 5)
>
> I could be off in the bushes with this, though.  If so, here's the
> python-fedora code that connects to FAS.  Checking for differences in what
> you're giving curl and what it's giving curl is pretty straightforward:
>
> http://bzr.fedorahosted.org/bzr/python-fedora/python-fedora-devel/annotate/head%3A/fedora/client/proxyclient.py#L146
>
> -Toshio

For blogs.fp.o, we used php and json to get the authentication working.

Here's a link to the code that does this:
http://git.fedorahosted.org/git/?p=fedora-infrastructure.git;a=blob;f=plugins/wordpress-mu-plugin-fasauth/fasauth.php;h=f5eee36f9f2b4187a8de91794fad933a869ba023;hb=HEAD

Hopefully this is of help.

Sijis


More information about the infrastructure mailing list