Skip to content

Commit

Permalink
Enable the new OpenId Strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
krtek4 committed Nov 13, 2011
1 parent 92ede7f commit 45b4a38
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
3 changes: 2 additions & 1 deletion bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
'NinjAuth\\Controller' => __DIR__.'/classes/controller.php',
'NinjAuth\\Exception' => __DIR__.'/classes/exception.php',
'NinjAuth\\Model_Authentication' => __DIR__.'/classes/model/authentication.php',

'NinjAuth\\Strategy' => __DIR__.'/classes/strategy.php',
'NinjAuth\\Strategy_OAuth' => __DIR__.'/classes/strategy/oauth.php',
'NinjAuth\\Strategy_OAuth2' => __DIR__.'/classes/strategy/oauth2.php',
'NinjAuth\\Strategy_OpenId' => __DIR__.'/classes/strategy/openid.php',
));

/* End of file bootstrap.php */
11 changes: 10 additions & 1 deletion classes/strategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ abstract class Strategy {
'linkedin' => 'OAuth',
'unmagnify' => 'OAuth2',
'youtube' => 'OAuth',
'openid' => 'OpenId',
);

public function __construct($provider)
Expand Down Expand Up @@ -67,6 +68,10 @@ public static function login_or_register($strategy)
case 'oauth2':
$user_hash = $strategy->provider->get_user_info($response->token);
break;

case 'openid':
$user_hash = $strategy->get_user_info($response);
break;
}

// Attach this account to the logged in user
Expand Down Expand Up @@ -113,7 +118,11 @@ public static function login_or_register($strategy)
case 'oauth2':
$user_hash = $strategy->provider->get_user_info($response->token);
break;


case 'openid':
$user_hash = $strategy->get_user_info($response);
break;

default:
exit('Ummm....');
}
Expand Down
8 changes: 7 additions & 1 deletion config/ninjauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@
'key' => '',
'scope' => 'http://gdata.youtube.com',
),


'openid' => array (
'identifier_form_name' => 'openid_identifier',
'ax_required' => array('contact/email', 'namePerson/first', 'namePerson/last'),
'ax_optional' => array('namePerson/friendly', 'birthDate', 'person/gender', 'contact/country/home'),
),

),

/**
Expand Down

0 comments on commit 45b4a38

Please sign in to comment.