WebGUI
      Click here to register.
      
irc://irc.freenode.net#webgui

iPhoneGuy: WebGUI is a pile of crap.
rizen: If WebGUI is such a pile of crap, why do you use it?
iPhoneGuy: Because it's the best pile of crap out there.

If this is what people who hate us are saying, imagine what people who love us will say. Come join us on IRC.

OpenId Auth Module

User: dannymk
Date: 8/12/2007 5:22 pm
Views: 1259
Rating: 12    Rate [
|
]

I am currently working on a WebGUI Auth module that supports OpenId.  

The module works well and I am currently testing it on some of my systems.

The module requires the use of the following packages:

LWPx::ParanoidAgent;
Net::OpenID::Consumer;

Do not install unless you have installed the above modules. 

To install:

cp AuthOpenId.zip /data 

cd /data

unzip  AuthOpenId.zip 

Add the proper parameters to your webgui.conf files... 

Place the Macro ^OpenId(); within an article somewhere on your testing website.

You may use the Accept and Deny lists under the Admin settings/Authentication/Open Id section.  The lists of hosts/patterns should be separated by commas. 

Ex:  .bad.com,.whatever.com,.ask.com 

It is important to mention that the pattern "fair.com" will match "myhost.unfair.com|myhost.fair.com|mygreatproviderfair.com" instead of just "myhost.fair.com".

The Allow and Deny lists are totally inclusive.  If you place a pattern on the accept list only OpenId users using the provider that matches that pattern will be allowed. 

If you place  a pattern in the deny list, ALL users will be allowed except the ones matched by the pattern on the list.

If there are no entries on either list ALL valid OpenId users are allowed. 

Please report any bugs to me directly.

Thank you. 



Replies

Re: OpenId Auth Module
User: dannymk
Date: 8/23/2007 7:53 pm
Rating: 2    Rate [
|
]
Status: Approved

You can use this module with your existing WebGUI accounts, just make sure you set the authentication method to OpenId and the "OpenId Identity" under the edit user settings option.

If you would like users to automatically register and login using the OpenId auth module you must enable "Anonymous Registration" under the site settings. 


Re: OpenId Auth Module
User: cap10morgan
Date: 9/23/2007 12:41 pm
Rating: 1    Rate [
|
]
Status: Approved

Great module, dannymk!

I've written a patch for WebGUI::Auth::OpenId.pm that makes entry and verification of the OpenID URI's more forgiving. Mainly, it allows you to forget the "http://" on front and the trailing slash on the end at any point and everything still works (hopefully). I've pasted it below (it's not too complex).

I'll definitely be using this on my server. Now off to find (or create) an RFE to get this put into the core. :)

------------------------------------------------

--- WebGUI/Auth/OpenId.pm-orig  2007-09-23 11:34:15.000000000 -0600
+++ WebGUI/Auth/OpenId.pm       2007-09-23 11:33:22.000000000 -0600
@@ -132,16 +132,23 @@
 
 =cut
 
-sub _getUserName{
+sub _getUserName {
    my $self = shift;
    my $openIdUri = shift;
-       my $sql = "SELECT username FROM users
+   my($openIdUriRegExp,$regExpEnd);
+   if ($openIdUri =~ /\/$/) {
+     $regExpEnd = "?\$";
+   } else {
+     $regExpEnd = "/?\$";
+   }
+   $openIdUriRegExp = "^$openIdUri" . $regExpEnd;
+   my $sql = "SELECT username FROM users
       inner join authentication on users.userId=authentication.userId
       and fieldName = 'openIdUri'     
-      and fieldData = ?";
+      and fieldData RLIKE ?";
   
    if ( $openIdUri ){
-      my $userInfo = $self->session->db->buildHashRef($sql,[ $openIdUri ]);
+      my $userInfo = $self->session->db->buildHashRef($sql,[ $openIdUriRegExp ]);
       my @userKeys = keys(%$userInfo);
       return $userInfo->{$userKeys[0]};
    }else{
@@ -203,7 +210,7 @@
       #my $verified_url = $vident->url;
       $error = ""; #You are $verified_url !";
       $self->session->stow->set('foundValidOpenIdUri',1);
-      $self->session->stow->set('openIdUri',$cacheRef->{'_uri'});     
+      $self->session->stow->set('openIdUri',$vident->url);     
       $cache->delete();
    } else {
       $error = $self->_i18n->get('error default') . $csr->err;
@@ -371,8 +378,12 @@
 
 sub editUserFormSave {
    my $self = shift;
+   my $openIdUri = $self->session->form->process('authOpenId_openIdUri');
+   if ($openIdUri !~ /^http:\/\//) {
+     $openIdUri = "http://$openIdUri";
+   }
    my $properties = {};
-   $properties->{openIdUri} = $self->session->form->process('authOpenId_openIdUri');
+   $properties->{openIdUri} = $openIdUri;
    $self->SUPER::editUserFormSave($properties);
 }


Re: OpenId Auth Module
User: dannymk
Date: 12/21/2007 10:57 am
Rating: 3    Rate [
|
]
Status: Approved

Hi Cap10,
   sorry I have not been on  a while.  I got a new job and have been working long hours.

Anyway, can you tell me how the conference went?  Did they talk about the OpenId module at all?

I will probably patch my source with the patch you sent and will let you know how it works.

Dan. 


Re: OpenId Auth Module
User: dannymk
Date: 12/23/2007 8:10 pm
Rating: 3    Rate [
|
]
Status: Approved

Hi, the patch shows a value: $vident->url

however, that value is not defined in the patch.

Where did you get that from?  Where did you set it?


Re: OpenId Auth Module
User: dannymk
Date: 1/18/2008 11:21 am
Rating: 0    Rate [
|
]
Status: Approved

Hmmm... seems like Yahoo will be supporting OpenId 2.0 http://www.infoworld.com/article/08/01/17/Yahoo-to-support-OpenID-single-sign-on_1.html

Guesss I have to get this module updated! 


Re: OpenId Auth Module
User: cap10morgan
Date: 1/18/2008 12:21 pm
Rating: 4    Rate [
|
]
Status: Approved
Sorry I've been MIA on this. I'm still hoping to revisit this at some point soon. dannymk, can we meet in IRC at some point to discuss the status of this module and get it ready for inclusion in core?

Re: OpenId Auth Module
User: dannymk
Date: 2/2/2008 7:27 am
Rating: 4    Rate [
|
]
Status: Approved

I have made some changes to the module to get ready for the upgraded release of http://search.cpan.org/~bradfitz/Net-OpenID-Consumer-0.14/lib/Net/OpenID/Consumer.pm which will support OpenId version 2.0 (http://brad.livejournal.com/).  It seems to be the only functioning/available Perl library.   The one at this website: http://code.sxip.com/openid4perl/ still seems to be under development and cannot be used in production.  I sent an email to Brad and he told me his team was working on an upgrade.  Lets hope Brad Fitzpatrick releases his modules soon.   If anyone else knows of a functioning OpenId perl implementation please let me know. 


PreviousBackNext