Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

OpenID and SREG

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


trevor.phillips at gmail

Jul 3, 2009, 9:13 PM

Post #1 of 6 (1438 views)
Permalink
OpenID and SREG

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 [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


apv at sedition

Jul 3, 2009, 11:02 PM

Post #2 of 6 (1334 views)
Permalink
Re: OpenID and SREG [In reply to]

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 [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


trevor.phillips at gmail

Jul 4, 2009, 2:43 AM

Post #3 of 6 (1323 views)
Permalink
Re: OpenID and SREG [In reply to]

On Sat, Jul 4, 2009 at 2:02 PM, Ashley<apv [at] sedition> 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 [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


apv at sedition

Jul 4, 2009, 8:48 AM

Post #4 of 6 (1323 views)
Permalink
Re: OpenID and SREG [In reply to]

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 [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


trevor.phillips at gmail

Jul 5, 2009, 10:52 PM

Post #5 of 6 (1290 views)
Permalink
Re: OpenID and SREG [In reply to]

On Sat, Jul 4, 2009 at 5:43 PM, Trevor
Phillips<trevor.phillips [at] gmail> 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 [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


edmund.vonderburg at gmail

Jan 8, 2010, 5:15 PM

Post #6 of 6 (811 views)
Permalink
Re: OpenID and SREG [In reply to]

2009/7/6 Trevor Phillips <trevor.phillips [at] gmail>:
> 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.

Indeed - Google are super picky :)

You'll need the 'mode' parameter too:

'http://openid.net/srv/ax/1.0' => {
required => 'email',
mode => 'fetch_request',
'type.email' => 'http://schema.openid.net/contact/email',
},

Cheers,
Edmund.

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

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.