OpenID and SREG

View: New views
5 Messages — Rating Filter:   Alert me  

OpenID and SREG

by Trevor Phillips-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've only just started looking at OpenID, and would love to integrate
it with Catalyst apps. Using
Catalyst::Authentication::Credential::OpenID I've got the basics of
Authentication working, but I'm having problems with SREG.

The first problem is when using a .conf config, the docs say you can use:
     <extension_args>
            http://openid.net/extensions/sreg/1.1
            required    email
            optional    fullname,nickname,timezone
     </extension_args>

However, this fails, since this doesn't resolve into an Array, which
is what Net::OpenID::Consumer expects when
Catalyst::Authentication::Credential::OpenID calls set_extension_args.

Ok, so I can get around that by defining my Auth in my Perl module instead...

The next problem is I can't seem to get at the SREG hash. I'm trying
to get the hash using:

$sreg = $c->user->signed_extension_fields(
         'http://openid.net/extensions/sreg/1.1'
      );

...but this just assigns $sreg the string
'http://openid.net/extensions/sreg/1.1'.

Dumps of $c->user don't show anything useful either.

Am I missing something, or is OpenID Extensions for Catalyst currently broken?

--
Trevor Phillips  - http://dortamur.livejournal.com/
"On nights such as this, evil deeds are done. And good deeds, of
course. But mostly evil, on the whole."
      -- (Terry Pratchett, Wyrd Sisters)

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: OpenID and SREG

by Ashley Pond V :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Jul 3, 2009, at 9:13 PM, Trevor Phillips wrote:

> Catalyst::Authentication::Credential::OpenID I've got the basics of
> Authentication working, but I'm having problems with SREG.
>
> The first problem is when using a .conf config, the docs say you  
> can use:
>      <extension_args>
>             http://openid.net/extensions/sreg/1.1
>             required    email
>             optional    fullname,nickname,timezone
>      </extension_args>
>
> However, this fails, since this doesn't resolve into an Array, which
> is what Net::OpenID::Consumer expects when
> Catalyst::Authentication::Credential::OpenID calls set_extension_args.
>
> Ok, so I can get around that by defining my Auth in my Perl module  
> instead...
>
> The next problem is I can't seem to get at the SREG hash. I'm trying
> to get the hash using:
>
> $sreg = $c->user->signed_extension_fields(
>          'http://openid.net/extensions/sreg/1.1'
>       );
>
> ...but this just assigns $sreg the string
> 'http://openid.net/extensions/sreg/1.1'.
>
> Dumps of $c->user don't show anything useful either.
>
> Am I missing something, or is OpenID Extensions for Catalyst  
> currently broken?

The configuration examples are bad. Menno Blom provided the patch to  
support the stuff and I documented it incorrectly. I'm really sorry  
about this; it's been this way for a long time. I've been trying just  
this week to get a new release but I was also trying to run deeper  
tests to make sure I don't make another faux pas and I've been having  
problems getting them together and LWPx::ParanoidAgent is still  
broken and my excuse machine is on the fritz.

The snippet below (unedited, it's better to not use the config->{} =  
assignment idiom) is from a recent report from Orlando Vazquez who  
got it running in spite of the bad doc. There was also an issue with  
Config::General being a PITA regarding the data structure so you  
might want to start with a pure Perl config and if it runs, then put  
it into your favored config file format.

-Ashley

> __PACKAGE__->config->{Plugin::Authentication} = {
>     use_session => 1,
>     default_realm => 'openid',
>     realms => {
>         openid => {
>             credential => {
>                 class => 'OpenID',
>                 store => {
>                     class => 'OpenID'
>                 }
>              },
>              ### need this to get registration fields
>              extensions => {
>                 'http://openid.net/extensions/sreg/1.1' => 1
>              },
>              extension_args => [
>                  'http://openid.net/extensions/sreg/1.1',
>                  {
>                      required => 'email,timezone',
>                      optional => 'fullname,nickname,timezone'
>                  }
>              ]
>          }
>     }
> };



_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: OpenID and SREG

by Trevor Phillips-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Jul 4, 2009 at 2:02 PM, Ashley<apv@...> wrote:
>
> The configuration examples are bad. Menno Blom provided the patch to support
> the stuff and I documented it incorrectly. I'm really sorry about this; it's
> been this way for a long time. I've been trying just this week to get a new
> release but I was also trying to run deeper tests to make sure I don't make
> another faux pas and I've been having problems getting them together and
> LWPx::ParanoidAgent is still broken and my excuse machine is on the fritz.

Thanks. I'm surprised there isn't more interest in maturing the OpenID
support. I think it has a lot of potential for easing registration &
authentication for a lot of web apps.

Are you referring to LWPx::ParanoidAgent exploding when a bad Identity
URL is given? I tried using eval to get around it but that seems to
clash with the rest of the workings of your library.

> The snippet below (unedited, it's better to not use the config->{} =
> assignment idiom) is from a recent report from Orlando Vazquez who got it
> running in spite of the bad doc. There was also an issue with
> Config::General being a PITA regarding the data structure so you might want
> to start with a pure Perl config and if it runs, then put it into your
> favored config file format.
>
[snip]
>>             ### need this to get registration fields
>>             extensions => {
>>                'http://openid.net/extensions/sreg/1.1' => 1
>>             },

This was the missing link! I can now chuck this in my test app:
   $c->stash->{sreg} =
$c->user->extensions->{'http://openid.net/extensions/sreg/1.1'};
...and access sreg properties from the templates. Yay!

Disappointingly, it looks like many providers don't offer SREG details
- Google, Yahoo, LiveJournal didn't return anything. MyOpenID did
though.

Ideally, I'd like to store a local profile for a user, using OpenID
for Auth, and SREG for initial/default field population when
available. I'd rather use a ID and username created & tracked
internally, though, and just use the OpenID for auth.

--
Trevor Phillips  - http://dortamur.livejournal.com/
"On nights such as this, evil deeds are done. And good deeds, of
course. But mostly evil, on the whole."
      -- (Terry Pratchett, Wyrd Sisters)

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: OpenID and SREG

by Ashley Pond V :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Jul 4, 2009, at 2:43 AM, Trevor Phillips wrote:
> Are you referring to LWPx::ParanoidAgent exploding when a bad Identity
> URL is given? I tried using eval to get around it but that seems to
> clash with the rest of the workings of your library.

No, the LWP debug clash. It's not that important but it will cause
any installation to fail if it has a new LWP and I think ParanoidAgent
is really the only one to use in production. Brad did an update on it
last week but it didn't include removing the deprecated LWP hooks.

I have mixed feelings about the exception throwing behavior I put in.
All the authentication plugins fail silently except mine but OpenID
is a drag to debug so I felt like it was necessary. I've meant to
get with t0m and the list to discuss a better failure mechanism. I'll
probably just make it noisy in the log and stop the error throwing.

-Ashley

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: OpenID and SREG

by Trevor Phillips-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Jul 4, 2009 at 5:43 PM, Trevor
Phillips<trevor.phillips@...> wrote:
>
> Disappointingly, it looks like many providers don't offer SREG details
> - Google, Yahoo, LiveJournal didn't return anything. MyOpenID did
> though.

Doing a bit more reading, it looks like Google won't support SREG, but
are supporting AX, which seems to be the way places are going. Does
the current Catalyst OpenID Auth support AX?

Fudging the format for the SREG query, I tried:

               extensions => {
                  'http://openid.net/srv/ax/1.0' => 1
               },
               extension_args => [
                      'http://openid.net/srv/ax/1.0',
                      {
                       required => 'email',
                       'type.email' => 'http://schema.openid.net/contact/email'
                      }
                  ]

...but got nothing back from the providers I tried.

--
Trevor Phillips  - http://dortamur.livejournal.com/
"On nights such as this, evil deeds are done. And good deeds, of
course. But mostly evil, on the whole."
      -- (Terry Pratchett, Wyrd Sisters)

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/