[Rt-commit] r9164 - in rt/branches/3.7-RTIR-RELENG: . etc etc/upgrade/3.7.3 html/Callbacks html/Callbacks/OpenID html/Callbacks/OpenID/Elements html/Callbacks/OpenID/Elements/Login html/Callbacks/OpenID/autohandler

sartak at bestpractical.com sartak at bestpractical.com
Thu Sep 27 13:10:10 EDT 2007


Author: sartak
Date: Thu Sep 27 13:10:09 2007
New Revision: 9164

Added:
   rt/branches/3.7-RTIR-RELENG/html/Callbacks/
   rt/branches/3.7-RTIR-RELENG/html/Callbacks/OpenID/
   rt/branches/3.7-RTIR-RELENG/html/Callbacks/OpenID/Elements/
   rt/branches/3.7-RTIR-RELENG/html/Callbacks/OpenID/Elements/Login/
   rt/branches/3.7-RTIR-RELENG/html/Callbacks/OpenID/Elements/Login/Default
   rt/branches/3.7-RTIR-RELENG/html/Callbacks/OpenID/autohandler/
   rt/branches/3.7-RTIR-RELENG/html/Callbacks/OpenID/autohandler/Auth
Modified:
   rt/branches/3.7-RTIR-RELENG/   (props changed)
   rt/branches/3.7-RTIR-RELENG/etc/RT_Config.pm.in
   rt/branches/3.7-RTIR-RELENG/etc/upgrade/3.7.3/schema.Oracle
   rt/branches/3.7-RTIR-RELENG/releng.cnf
   rt/branches/3.7-RTIR-RELENG/sbin/rt-test-dependencies.in

Log:
 r43095 at onn (orig r9156):  jesse | 2007-09-26 12:07:06 -0400
  r61191 at pinglin:  jesse | 2007-07-25 00:54:08 -0400
  * First cut of in-core openid support
  
 
 r43096 at onn (orig r9157):  jesse | 2007-09-26 12:36:11 -0400
  r61193 at pinglin:  jesse | 2007-07-25 01:00:15 -0400
   3.7.15
 
 r43097 at onn (orig r9158):  jesse | 2007-09-26 12:37:27 -0400
 
 r43098 at onn (orig r9159):  jesse | 2007-09-26 12:38:16 -0400
  r67601 at pinglin:  jesse | 2007-09-26 12:04:47 -0400
  RT-Ticket: 8572
  RT-Status: resolved
  RT-Update: correspond
  
  * Oracle 3.7.3 upgrade fix from Joop
 


Modified: rt/branches/3.7-RTIR-RELENG/etc/RT_Config.pm.in
==============================================================================
--- rt/branches/3.7-RTIR-RELENG/etc/RT_Config.pm.in	(original)
+++ rt/branches/3.7-RTIR-RELENG/etc/RT_Config.pm.in	Thu Sep 27 13:10:09 2007
@@ -479,6 +479,15 @@
 
 Set($WebExternalAuth , undef);
 
+
+# If $WebOpenIdAuth is enabled, RT will allow OpenID logins. New users who present
+# OpenID Credentials will be created as unprivileged users with their OpenID as their Name.
+# To enable OpenID Support, you need to install LWPx::ParanoidAgent, Cache::FileCache
+# and Net::OpenID::Consumer.
+#
+Set($WebOpenIdAuth, undef);
+
+
 # If $WebFallbackToInternalAuth is undefined, the user is allowed a chance
 # of fallback to the login screen, even if REMOTE_USER failed.
 

Modified: rt/branches/3.7-RTIR-RELENG/etc/upgrade/3.7.3/schema.Oracle
==============================================================================
--- rt/branches/3.7-RTIR-RELENG/etc/upgrade/3.7.3/schema.Oracle	(original)
+++ rt/branches/3.7-RTIR-RELENG/etc/upgrade/3.7.3/schema.Oracle	Thu Sep 27 13:10:09 2007
@@ -1 +1,5 @@
-ALTER TABLE CustomFields MODIFY ( Pattern CLOB);
+alter table CustomFields add Pattern_TMP clob;
+update CustomFields set Pattern_TMP = Pattern;
+commit;
+alter table CustomFields drop column Pattern;
+alter table CustomFields rename column Pattern_TMP to Pattern;

Added: rt/branches/3.7-RTIR-RELENG/html/Callbacks/OpenID/Elements/Login/Default
==============================================================================
--- (empty file)
+++ rt/branches/3.7-RTIR-RELENG/html/Callbacks/OpenID/Elements/Login/Default	Thu Sep 27 13:10:09 2007
@@ -0,0 +1,13 @@
+<%init>
+return unless (RT->Config->Get( 'WebOpenIdAuth'));
+</%init>
+<div class="input-row">
+<h3><&|/l&>Login with OpenID</&></h3>
+</div>
+    <span class="label"><&|/l&>OpenID</&>:</span>
+    <span class="input"><input name="openid" /></span>
+</div>
+
+<div class="button-row">
+    <span class="input"><input type="submit" class="button" value="<&|/l&>Login with OpenID</&>" /></span>
+</div>

Added: rt/branches/3.7-RTIR-RELENG/html/Callbacks/OpenID/autohandler/Auth
==============================================================================
--- (empty file)
+++ rt/branches/3.7-RTIR-RELENG/html/Callbacks/OpenID/autohandler/Auth	Thu Sep 27 13:10:09 2007
@@ -0,0 +1,91 @@
+<%INIT>
+return unless (RT->Config->Get( 'WebOpenIdAuth'));
+use Net::OpenID::Consumer;
+use LWPx::ParanoidAgent;
+use Cache::FileCache;
+
+my $openid_url = ref( $ARGS{openid} ) ? $ARGS{openid}->[0] : $ARGS{openid};
+my $user;
+my $check_url;
+
+# Livejournal misencodes responses...
+if ($ARGS{'openid.sig'}) {
+my $sig = $m->cgi_object->param('openid.sig') ||'';
+$sig =~ s/ /+/g;
+$m->cgi_object->param( 'openid.sig' => $sig );
+}
+
+
+my $root_user = RT::User->new($RT::SystemUser);
+my $csr = Net::OpenID::Consumer->new(
+    ua              => LWPx::ParanoidAgent->new,
+    args            => \%ARGS,
+    cache           => Cache::FileCache->new,
+    consumer_secret => $RT::DatabasePassword,
+    required_root => $RT::WebURL,
+);
+
+
+if ($openid_url) {
+    my $claimed_identity = $csr->claimed_identity("$openid_url");
+    $check_url = $claimed_identity->check_url(
+        return_to      => $RT::WebURL,
+        delayed_return => 1,
+        trust_root     => $RT::WebURL,
+    );
+    RT::Interface::Web::Redirect($check_url);
+}
+if ( $ARGS{"openid.mode"} ) {
+    if ( my $setup_url = $csr->user_setup_url ) {
+
+        # redirect/link/popup user to $setup_url
+        RT::Interface::Web::Redirect($setup_url);
+    } elsif ( $csr->user_cancel ) {
+    } elsif ( my $vident = $csr->verified_identity ) {
+        $user = $vident->url;
+    } else {
+        die ( "Error validating identity: " . $csr->err );
+    }
+}
+
+# if the user isn't logged in and we got credentials from OpenID, load them
+if ( ( !$session{'CurrentUser'} ) && ($user) ) {
+
+    # set a global user so we know elsewhere we're using OpenID for auth
+    $session{'OpenID'} = $user;
+
+    # OpenID has verified that the user has control of this e-mail address,
+    # so it's okay to use it to get a valid RT user
+
+    # we've got a valid user, so try to load
+    $session{'CurrentUser'} = RT::CurrentUser->new();
+    $session{'CurrentUser'}->LoadByCols( Name => $user );
+    
+    if ( $session{'CurrentUser'}->id ) {
+        $RT::Logger->info($session{'CurrentUser'}->Name ." logged in with openid"); 
+    } else {
+        my $UserObj = RT::User->new($RT::SystemUser);
+        my ( $id, $msg ) = $UserObj->Create(
+            Name => $user,
+
+            #RealName => $user->{'name'},
+            #EmailAddress => $user->{'email'},
+            Privileged => 0,
+        );
+        $RT::Logger->info($user ." attempted an account creation with OpenID: $msg");
+        if ( $UserObj->id ) {
+
+            # created the user, now load them as the current user
+            $session{'CurrentUser'}->Load( $UserObj->id );
+            $session{'i'}++;
+            # redirect the user to their preference page to add more info
+            RT::Interface::Web::Redirect( $RT::WebURL . '/User/Prefs.html' );
+        } else {
+
+            # we couldn't create the user.  abort abort abort!
+            delete $session{'CurrentUser'};
+            die( loc( "Cannot create user: [_1]", $msg ) );
+        }
+    }
+}
+</%INIT>

Modified: rt/branches/3.7-RTIR-RELENG/releng.cnf
==============================================================================
--- rt/branches/3.7-RTIR-RELENG/releng.cnf	(original)
+++ rt/branches/3.7-RTIR-RELENG/releng.cnf	Thu Sep 27 13:10:09 2007
@@ -1,5 +1,5 @@
 PRODUCT			        = rt
-TAG			            = 3.7.16
+TAG			            = 3.7.15
 CANONICAL_REPO		    = svn+ssh://svn.bestpractical.com/svn/bps-public/rt/
 TAGS		            = tags/
 TRUNK	                = branches/3.7-EXPERIMENTAL

Modified: rt/branches/3.7-RTIR-RELENG/sbin/rt-test-dependencies.in
==============================================================================
--- rt/branches/3.7-RTIR-RELENG/sbin/rt-test-dependencies.in	(original)
+++ rt/branches/3.7-RTIR-RELENG/sbin/rt-test-dependencies.in	Thu Sep 27 13:10:09 2007
@@ -64,6 +64,7 @@
     'with-SPEEDYCGI',                     'with-MODPERL1',
     'with-MODPERL2',                      'with-DEV',
     'with-STANDALONE',
+    'with-OPENID',
     'download=s',
     'repository=s'
 );
@@ -77,6 +78,7 @@
     'with-MASON' => 1,
     'with-CORE' => 1,
     'with-CLI' => 1,
+    'with-OPENID' => 0,
     'with-MAILGATE' => 1, 
     'with-DEV' => @RT_DEVEL_MODE@, 
     'with-STANDALONE' => @RT_STANDALONE@,
@@ -156,7 +158,8 @@
 	--with-modperl1		Libraries needed to support the modperl 1 handler
 	--with-modperl2		Libraries needed to support the modperl 2 handler
 
-	--with-dev		Tools needed for RT development
+	--with-dev		    Tools needed for RT development
+    --with-openid       Libraries needed to support OpenID logins
 
 You can also specify -v or --verbose to list the status of all dependencies,
 rather than just the missing ones.
@@ -304,10 +307,16 @@
 $deps{'SQLITE'} = [ text_to_hash( << '.') ];
 DBD::SQLite 1.00
 .
+$deps{'OPENID'} = [text_to_hash(<< '.')];
+Net::OpenID::Consumer
+LWPx::ParanoidAgent
+Cache::FileCache
+.
+
 
 if ($args{'download'}) {
 
-    download_mods();
+    dowoload_mods();
 }
 
 


More information about the Rt-commit mailing list