Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

So with the current Drupal 7's OpenID module, one must click on the "OpenID" on the main page, which the user then enter the url of the OpenID provider to link up to. Assuming I know exactly what provider I want to use (my university's), there some way I can make it such that as soon as a user visits the homepage, or any part of my drupal site, the first thing it does is authenticates with that specific provider url before it even shows the page?

The reason being is I want people within the university network to be able to go to the site and automatically see who they are without having them perform that extra step of clicking on an "openid" button. Much like a single-sign-on solution.

share|improve this question

1 Answer 1

You must create a custom module to generate a page "/login" that start OpenID authenticate.

Create a module with this code :

/**
 * Implements hook_menu().
 */
function mymodule_menu() {

  $items['login'] = array(
    'title' => 'OpenID Login',
    'page callback' => 'openid_login',
    'access callback' => 'user_is_anonymous',
    'type' => MENU_CALLBACK,
  );

  return $items;
}

/*
 * Menu callback; start openid authenticate
 */
function mymodule_login() {

  $return_to = url('openid/authenticate', array('absolute' => TRUE, 'query' => array('destination' => 'user')));

  openid_begin("https://www.myopenid.com/", $return_to, array());
}

The example works with the myopenid.com provider. Go to "/login" on your website to log in.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.