Index: openid_provider.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openid_provider/openid_provider.inc,v
retrieving revision 1.3.2.5
diff -u -p -r1.3.2.5 openid_provider.inc
--- openid_provider.inc	7 Mar 2009 18:44:58 -0000	1.3.2.5
+++ openid_provider.inc	9 Mar 2009 20:05:48 -0000
@@ -95,11 +95,11 @@ function openid_provider_authentication_
 
   // Check for a directed identity request.
   if ($request['openid.identity'] == 'http://specs.openid.net/auth/2.0/identifier_select') {
-    $identity = url('user/' . $user->uid, array('absolute' => TRUE));
+    $identity = url(openid_provider_user_url($user->uid), array('absolute' => TRUE));
   }
   else {
     $identity = $request['openid.identity'];
-    if ($identity != url('user/'. $user->uid, array('absolute' => TRUE))) {
+    if ($identity != url(openid_provider_user_url($user->uid), array('absolute' => TRUE))) {
       $response = openid_provider_authentication_error($request['openid.mode']);
       openid_redirect($request['openid.return_to'], $response);
     }
Index: openid_provider.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openid_provider/openid_provider.install,v
retrieving revision 1.2
diff -u -p -r1.2 openid_provider.install
--- openid_provider.install	1 Jun 2008 03:21:41 -0000	1.2
+++ openid_provider.install	9 Mar 2009 20:05:48 -0000
@@ -2,32 +2,6 @@
 // $Id: openid_provider.install,v 1.2 2008/06/01 03:21:41 walkah Exp $
 
 /**
- * Implementation of hook_requirements().
- */
-function openid_provider_requirements($phase) {
- $requirements = array();
-  // Ensure translations don't break at install time
-  $t = get_t();
-
-  if ($phase == 'runtime') {
-    if (user_access('access user profiles', drupal_anonymous_user())) {
-      $requirements['openid_provider'] = array(
-        'value' => $t('Enabled')
-      );
-    }
-    else {
-      $requirements['openid_provider'] = array(
-        'value' => $t('Disabled'),
-        'severity' => REQUIREMENT_ERROR,
-        'description' => $t('Openid Provider requires that anonymous users have <a href="@url">access user profile permission</a> to work properly.', array('@url' => url('admin/user/permissions/'. DRUPAL_ANONYMOUS_RID))),
-      );      
-    }
-    $requirements['openid_provider']['title'] = $t('Anon user profile access');
-  }
-  return $requirements;
-}
-
-/**
  * Implementation of hook_install().
  */
 function openid_provider_install() {
Index: openid_provider.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openid_provider/openid_provider.module,v
retrieving revision 1.3.2.2
diff -u -p -r1.3.2.2 openid_provider.module
--- openid_provider.module	9 Mar 2009 17:22:55 -0000	1.3.2.2
+++ openid_provider.module	9 Mar 2009 20:05:48 -0000
@@ -43,6 +43,16 @@ function openid_provider_menu() {
     'file' => 'openid_provider.pages.inc'
   );
   
+  $items[openid_provider_user_url('%user')] = array(
+    'title' => 'OpenID Page',
+    'page callback' => 'openid_provider_page',
+    'page arguments' => array(1),
+    'description' => 'Menu callback with full access so no forbiddens are given from server requests',
+    'access callback' => TRUE,
+    'type' => MENU_CALLBACK,
+    'file' => 'openid_provider.pages.inc'
+  );
+
   $items['user/%user/openid_sites'] = array(
     'title' => 'OpenID sites',
     'page callback' => 'openid_provider_sites',
@@ -72,6 +82,7 @@ function openid_provider_init() {
   // Not all OpenID clients may be smart enough to do XRDS.
   drupal_add_link(array('rel' => 'openid2.provider', 'href' => url('openid/provider', array('absolute' => TRUE))));
   drupal_add_link(array('rel' => 'openid.server', 'href' => url('openid/provider', array('absolute' => TRUE))));
+
 }
 
 /**
@@ -89,14 +100,38 @@ function openid_provider_user($op, &$edi
   global $user;
   
   switch ($op) {
+    case 'insert':
+    case 'update':
+      if (module_exists('pathauto')) {
+        _pathauto_include();
+        // Use the username to automatically create an alias
+        $pathauto_user = (object) array_merge((array) $account, $edit);
+        if ($account->name) {
+          $placeholders = pathauto_get_placeholders('user', $pathauto_user);
+          $src = openid_provider_user_url($account->uid);
+          $alias = pathauto_create_alias('openid_provider', $op, $placeholders, $src, $account->uid);
+        }
+      }
+      break;
+    case 'delete':
+      // If the user is deleted, remove the path aliases
+      if (module_exists('pathauto')) {
+        $account = (object) $account;
+      	path_set_alias(openid_provider_user_url($account->uid));
+      }
+      break;
     case 'view':
       if ($user->uid == $account->uid) {
         $account->content['openid'] = array(
           '#type' => 'user_profile_category',
           '#title' => t('OpenID'),
-          '#value' => t('You may login to other OpenID enabled sites using %url', array('%url' => url('user/'. $account->uid, array('absolute' => TRUE)))),
           '#class' => 'openid',
-          '#weight' => 10
+          '#weight' => 10,
+        );
+        $account->content['openid']['identity'] = array(
+          '#type' => 'user_profile_item',
+          '#title' => t('Identity'),
+          '#value' => t('You may login to other OpenID enabled sites using %url', array('%url' => url(openid_provider_user_url($account->uid), array('absolute' => TRUE)))),
         );
       }
       break;
@@ -104,6 +139,16 @@ function openid_provider_user($op, &$edi
 }
 
 /**
+ * Return the canonical OpenID URL for this user id
+ */
+function openid_provider_user_url($uid) {
+  if (is_object($uid)) {
+    $uid = $uid->uid;
+  }
+  return sprintf('user/%s/identity', $uid);
+}
+
+/**
  * Settings form.
  */
 function openid_provider_admin_settings() {
@@ -136,7 +181,7 @@ function openid_provider_xrds($account =
     'URI' => array(url('openid/provider', array('absolute'=> TRUE))),
   );
   if ($account->uid) {
-    $data['LocalID'] = array(url('user/'. $account->uid, array('absolute' => TRUE)));
+    $data['LocalID'] = array(url(openid_provider_user_url($account->uid), array('absolute' => TRUE)));
   }
   
   $xrds['openid_provider'] = array(
@@ -230,3 +275,54 @@ function openid_provider_form_submit_can
   $response = openid_provider_cancel_authentication_response($form_state['openid.mode']);
   openid_redirect($return_to, $response);
 }
+
+/**
+ * Implementation of hook_pathauto() for OpenID Provider aliases.
+ */
+function openid_provider_pathauto($op) {
+  switch ($op) {
+    case 'settings':
+      $settings = array();
+      $settings['module'] = 'openid_provider';
+      $settings['token_type'] = 'user';
+      $settings['groupheader'] = t('OpenID Provider settings');
+      $settings['patterndescr'] = t('Pattern for OpenID provider identity paths');
+      $settings['patterndefault'] = t('users/[user-raw]/openid');
+      $patterns = token_get_list('user');
+      foreach ($patterns as $type => $pattern_set) {
+        if ($type != 'global') {
+          foreach ($pattern_set as $pattern => $description) {
+            $settings['placeholders']['['. $pattern .']'] = $description;
+          }
+        }
+      }
+
+      $settings['bulkname'] = t('Bulk generate aliases for identity paths that are not aliased');
+      $settings['bulkdescr'] = t('Generate aliases for all existing identity paths which do not already have aliases.');
+      return (object) $settings;
+    default:
+      break;
+  }
+}
+
+/**
+ * Bulk generate aliases for all Open ID identity paths without aliases.
+ */
+function openid_provider_pathauto_bulkupdate() {
+  $query = "SELECT uid, name, src, dst FROM {users} LEFT JOIN {url_alias} ON CONCAT('user/', CAST(uid AS CHAR) ,'/openid') = src WHERE uid > 0 AND src IS NULL";
+  $result = db_query_range($query, 0, variable_get('pathauto_max_bulk_update', 50));
+
+  $count = 0;
+  $placeholders = array();
+  while ($user = db_fetch_object($result)) {
+    $placeholders = pathauto_get_placeholders('user', $user);
+    $src = openid_provider_user_url($user->uid);
+    if ($alias = pathauto_create_alias('openid_provider', 'bulkupdate', $placeholders, $src, $user->uid)) {
+      $count++;
+    }
+  }
+
+  drupal_set_message(format_plural($count,
+    'Bulk generation of OpenID Provider paths completed, one alias generated.',
+    'Bulk generation of OpenID Provider paths completed, @count aliases generated.'));
+}
\ No newline at end of file
Index: openid_provider.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openid_provider/openid_provider.pages.inc,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 openid_provider.pages.inc
--- openid_provider.pages.inc	7 Mar 2009 16:52:42 -0000	1.1.2.2
+++ openid_provider.pages.inc	9 Mar 2009 20:05:48 -0000
@@ -35,6 +35,14 @@ function openid_provider_endpoint($reque
 }
 
 /**
+ * Callback page for OpenID Identifier. This page is primarily used for
+ * discovery when someone is logging in from a Relying Party.
+ */
+function openid_provider_page($account) {
+  return t('This is the OpenID page for %user.', array('%user' => $account->name));
+}
+
+/**
  * Menu callback to continue authentication process after user login. This
  * callback is encountered when a user tries to login to an RP but does not yet
  * have a valid local session
