6 Commits
v1.0 ... 1.2

Author SHA1 Message Date
Kasper Rynning-Tønnesen
b570a9e332 Updated some minor settings 2016-07-19 16:43:26 +02:00
Kasper Rynning-Tønnesen
5865b0799e stability 2016-07-19 16:09:21 +02:00
Kasper Rynning-Tønnesen
3393af9ff5 Removed type 2016-07-19 16:01:36 +02:00
Kasper Rynning-Tønnesen
0b1683a69d Added namespace 2016-07-19 15:58:46 +02:00
Kasper Rynning-Tønnesen
5049bf4c07 reverting.. 2016-07-19 15:56:51 +02:00
Kasper Rynning-Tønnesen
047b843d82 Updated composer.json 2016-07-19 15:56:21 +02:00
2 changed files with 10 additions and 6 deletions

View File

@@ -1,5 +1,7 @@
<?php
namespace Kasperrt;
class OAuth2 {
private $client_id;
@@ -33,9 +35,13 @@ class OAuth2 {
$this->response_type = isset($params["response_type"]) ? $params["response_type"] : "code";
}
public function get_access_token(
$state = mysql_real_escape_string($_GET['state']),
$code = mysql_real_escape_string($_GET['code'])) {
public function get_access_token($state = false, $code = false) {
if(!$state) {
$state = htmlspecialchars($_GET['state']);
}
if(!$code) {
$state = htmlspecialchars($_GET['code']);
}
if($this->session && $state) {
if($_SESSION['state'] != $state) {
die('States does not match');
@@ -66,7 +72,7 @@ class OAuth2 {
}
public function get_identity($access_token, $identity_url) {
if(!$access_token || !$identity_url) throw new Exception("Missing either \$access_token or \$identity_url in get_identity function.");
if(!$access_token || !$identity_url) throw new \Exception("Missing either \$access_token or \$identity_url in get_identity function.");
$params = array(
'access_token' => $access_token,
);

View File

@@ -3,9 +3,7 @@
"description": "OAuth2 Client with Bearer tokens",
"license": "MIT",
"keywords": ["authentication"],
"type": "simplesamlphp-module",
"homepage": "https://github.com/kasperrt/oauth2-client",
"minimum-stability": "dev",
"authors": [
{
"name": "Kasper Rynning-Tønnesen",