Skip to content

Commit

Permalink
Merge pull request #166 from aacotroneo/one-login-3
Browse files Browse the repository at this point in the history
One login 3
  • Loading branch information
aacotroneo authored Nov 8, 2018
2 parents c6282cc + 49fe82b commit 5045701
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 24 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
language: php

php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2


before_script:
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"keywords": ["laravel","saml", "saml2", "onelogin"],
"homepage": "https://github.com/aacotroneo/laravel-saml2",
"license": "MIT",
"version": "0.11.1",
"version": "1.0.0",
"authors": [
{
"name": "aacotroneo",
Expand All @@ -15,7 +15,7 @@
"php": ">=5.4.0",
"ext-openssl": "*",
"illuminate/support": ">=5.0.0",
"onelogin/php-saml": "^2.10"
"onelogin/php-saml": "^3.0.0"
},
"require-dev": {
"mockery/mockery": "0.9.*"
Expand Down
6 changes: 3 additions & 3 deletions src/Aacotroneo/Saml2/Saml2Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Aacotroneo\Saml2;

use OneLogin_Saml2_Auth;
use OneLogin_Saml2_Error;
use OneLogin_Saml2_Utils;
use OneLogin\Saml2\Auth as OneLogin_Saml2_Auth;
use OneLogin\Saml2\Error as OneLogin_Saml2_Error;
use OneLogin\Saml2\Utils as OneLogin_Saml2_Utils;
use Aacotroneo\Saml2\Events\Saml2LogoutEvent;

use Log;
Expand Down
5 changes: 3 additions & 2 deletions src/Aacotroneo/Saml2/Saml2ServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php
namespace Aacotroneo\Saml2;

use OneLogin_Saml2_Auth;
use OneLogin\Saml2\Auth as OneLogin_Saml2_Auth;
use OneLogin\Saml2\Utils as OneLogin_Saml2_Utils;
use URL;
use Illuminate\Support\ServiceProvider;

Expand Down Expand Up @@ -31,7 +32,7 @@ public function boot()
]);

if (config('saml2_settings.proxyVars', false)) {
\OneLogin_Saml2_Utils::setProxyVars(true);
OneLogin_Saml2_Utils::setProxyVars(true);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Aacotroneo/Saml2/Saml2User.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Aacotroneo\Saml2;

use OneLogin_Saml2_Auth;
use OneLogin\Saml2\Auth as OneLogin_Saml2_Auth;

/**
* A simple class that represents the user that 'came' inside the saml2 assertion
Expand Down
3 changes: 2 additions & 1 deletion tests/Saml2/Saml2AuthServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

use App;
use Mockery as m;
use PHPUnit\Framework\TestCase;

class Saml2AuthServiceProviderTest extends \PHPUnit_Framework_TestCase
class Saml2AuthServiceProviderTest extends TestCase
{


Expand Down
27 changes: 14 additions & 13 deletions tests/Saml2/Saml2AuthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

use App;
use Mockery as m;
use PHPUnit\Framework\TestCase;

class Saml2AuthTest extends \PHPUnit_Framework_TestCase
class Saml2AuthTest extends TestCase
{


Expand All @@ -18,7 +19,7 @@ public function tearDown()

public function testIsAuthenticated()
{
$auth = m::mock('OneLogin_Saml2_Auth');
$auth = m::mock('OneLogin\Saml2\Auth');
$saml2 = new Saml2Auth($auth);

$auth->shouldReceive('isAuthenticated')->andReturn('return');
Expand All @@ -29,7 +30,7 @@ public function testIsAuthenticated()

public function testLogin()
{
$auth = m::mock('OneLogin_Saml2_Auth');
$auth = m::mock('OneLogin\Saml2\Auth');
$saml2 = new Saml2Auth($auth);
$auth->shouldReceive('login')->once();
$saml2->login();
Expand All @@ -43,7 +44,7 @@ public function testLogout()
$expectedNameIdFormat = 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified';
$expectedStay = true;
$expectedNameIdNameQualifier = 'name_id_name_qualifier';
$auth = m::mock('OneLogin_Saml2_Auth');
$auth = m::mock('OneLogin\Saml2\Auth');
$saml2 = new Saml2Auth($auth);
$auth->shouldReceive('logout')
->with($expectedReturnTo, [], $expectedNameId, $expectedSessionIndex, $expectedStay, $expectedNameIdFormat, $expectedNameIdNameQualifier)
Expand All @@ -54,7 +55,7 @@ public function testLogout()

public function testAcsError()
{
$auth = m::mock('OneLogin_Saml2_Auth');
$auth = m::mock('OneLogin\Saml2\Auth');
$saml2 = new Saml2Auth($auth);
$auth->shouldReceive('processResponse')->once();
$auth->shouldReceive('getErrors')->once()->andReturn(array('errors'));
Expand All @@ -67,7 +68,7 @@ public function testAcsError()

public function testAcsNotAutenticated()
{
$auth = m::mock('OneLogin_Saml2_Auth');
$auth = m::mock('OneLogin\Saml2\Auth');
$saml2 = new Saml2Auth($auth);
$auth->shouldReceive('processResponse')->once();
$auth->shouldReceive('getErrors')->once()->andReturn(null);
Expand All @@ -80,7 +81,7 @@ public function testAcsNotAutenticated()

public function testAcsOK()
{
$auth = m::mock('OneLogin_Saml2_Auth');
$auth = m::mock('OneLogin\Saml2\Auth');
$saml2 = new Saml2Auth($auth);
$auth->shouldReceive('processResponse')->once();
$auth->shouldReceive('getErrors')->once()->andReturn(null);
Expand All @@ -93,7 +94,7 @@ public function testAcsOK()

public function testSlsError()
{
$auth = m::mock('OneLogin_Saml2_Auth');
$auth = m::mock('OneLogin\Saml2\Auth');
$saml2 = new Saml2Auth($auth);
$auth->shouldReceive('processSLO')->once();
$auth->shouldReceive('getErrors')->once()->andReturn('errors');
Expand All @@ -105,7 +106,7 @@ public function testSlsError()

public function testSlsOK()
{
$auth = m::mock('OneLogin_Saml2_Auth');
$auth = m::mock('OneLogin\Saml2\Auth');
$saml2 = new Saml2Auth($auth);
$auth->shouldReceive('processSLO')->once();
$auth->shouldReceive('getErrors')->once()->andReturn(null);
Expand All @@ -117,7 +118,7 @@ public function testSlsOK()

public function testCanGetLastError()
{
$auth = m::mock('OneLogin_Saml2_Auth');
$auth = m::mock('OneLogin\Saml2\Auth');
$saml2 = new Saml2Auth($auth);

$auth->shouldReceive('getLastErrorReason')->andReturn('lastError');
Expand All @@ -126,7 +127,7 @@ public function testCanGetLastError()
}

public function testGetUserAttribute() {
$auth = m::mock('OneLogin_Saml2_Auth');
$auth = m::mock('OneLogin\Saml2\Auth');
$saml2 = new Saml2Auth($auth);

$user = $saml2->getSaml2User();
Expand All @@ -139,7 +140,7 @@ public function testGetUserAttribute() {
}

public function testParseSingleUserAttribute() {
$auth = m::mock('OneLogin_Saml2_Auth');
$auth = m::mock('OneLogin\Saml2\Auth');
$saml2 = new Saml2Auth($auth);

$user = $saml2->getSaml2User();
Expand All @@ -154,7 +155,7 @@ public function testParseSingleUserAttribute() {
}

public function testParseMultipleUserAttributes() {
$auth = m::mock('OneLogin_Saml2_Auth');
$auth = m::mock('OneLogin\Saml2\Auth');
$saml2 = new Saml2Auth($auth);

$user = $saml2->getSaml2User();
Expand Down

0 comments on commit 5045701

Please sign in to comment.