ShibbolethTest
extends TestCase
in package
Uses
LiveDatabaseTrait, LiveDetectionTrait
Shibboleth authentication test class.
Class must be final due to use of "new static()" by LiveDatabaseTrait.
Tags
Table of Contents
- $hasLiveDatabaseTrait : bool
- Flag to allow other traits to test for the presence of this one (to enforce dependencies).
- $hasLiveDetectionTrait : bool
- Flag to allow other traits to test for the presence of this one (to enforce dependencies).
- $liveDatabaseContainer : MockContainer|null
- Container connected to live database.
- $proxyUser : mixed
- $user1 : mixed
- $user2 : mixed
- $user3 : mixed
- continuousIntegrationRunning() : bool
- Is this test running in a continuous integration context?
- getAuthConfig() : Config
- Get a working configuration for the Shibboleth object
- getAuthObject() : Shibboleth
- Get an authentication object.
- getDbService() : DbServiceInterface
- Get a database service.
- getFavoritesService() : FavoritesService
- Get the favorites service.
- getLiveDatabaseContainer() : MockContainer
- Get a real, working table manager.
- getLiveDbServiceManager() : PluginManager
- Get a real, working database service manager.
- getLiveTableManager() : PluginManager
- Get a real, working table manager.
- getShibbolethConfig() : Config
- Get a working configuration for the Shibboleth object
- getTable() : Gateway
- Get a table object.
- setUp() : void
- Standard setup method.
- setUpBeforeClass() : void
- Standard setup method.
- tearDownAfterClass() : void
- Standard teardown method.
- testCreateIsDisallowed() : void
- Test account creation is disallowed.
- testFailedLogin() : void
- Test failed login.
- testLogin() : void
- Test successful login.
- testLogin1() : void
- Test successful login.
- testLogin2() : void
- Test successful login.
- testLoginWithBlankPassword() : void
- Test login with blank username.
- testLoginWithBlankUsername() : void
- Test login with blank username.
- testProxyLogin() : void
- Test login using attributes passed in headers.
- testSessionInitiator() : void
- Test session initiator
- testWithMissingAttributeValue() : void
- Test a configuration with a missing attribute value.
- testWithoutLoginSetting() : void
- Test a configuration with missing login setting.
- testWithoutUsername() : void
- Test a configuration with missing username.
- failIfDataExists() : void
- Static setup support function to fail if there is already data in the database. We want to ensure a clean state for each test!
- getLoginRequest() : Request
- Support method -- get parameters to log into an account (but allow override of individual parameters so we can test different scenarios).
- removeUsers() : void
- Static teardown support function to destroy user accounts. Accounts are expected to exist, and the method will fail if they are missing.
Properties
$hasLiveDatabaseTrait
Flag to allow other traits to test for the presence of this one (to enforce dependencies).
public
bool
$hasLiveDatabaseTrait
= true
$hasLiveDetectionTrait
Flag to allow other traits to test for the presence of this one (to enforce dependencies).
public
bool
$hasLiveDetectionTrait
= true
$liveDatabaseContainer
Container connected to live database.
protected
MockContainer|null
$liveDatabaseContainer
= null
$proxyUser
protected
mixed
$proxyUser
= ['Shib-Identity-Provider' => 'https://idp1.example.org/', 'username' => 'testuser3', 'userLibraryId' => 'testuser3', 'mail' => 'testuser3@example.org']
$user1
protected
mixed
$user1
= ['Shib-Identity-Provider' => 'https://idp1.example.org/', 'username' => 'testuser1', 'userLibraryId' => 'testuser1', 'mail' => 'testuser1@example.org']
$user2
protected
mixed
$user2
= ['Shib-Identity-Provider' => 'https://idp2.example.org/', 'eppn' => 'testuser2', 'alephId' => '12345', 'mail' => 'testuser2@example.org', 'eduPersonScopedAffiliation' => 'member@example.org']
$user3
protected
mixed
$user3
= ['Shib-Identity-Provider' => 'https://idp2.example.org/', 'eppn' => 'testuser3', 'alephId' => 'testuser3', 'mail' => 'testuser3@example.org']
Methods
continuousIntegrationRunning()
Is this test running in a continuous integration context?
public
continuousIntegrationRunning() : bool
Return values
bool —getAuthConfig()
Get a working configuration for the Shibboleth object
public
getAuthConfig([bool $useHeaders = false ][, bool $requiredAttributes = true ]) : Config
Parameters
- $useHeaders : bool = false
-
Value for use_headers config setting
- $requiredAttributes : bool = true
-
Should we include a required attribute in config?
Return values
Config —getAuthObject()
Get an authentication object.
public
getAuthObject([Config $config = null ][, Config $shibConfig = null ][, bool $useHeaders = false ][, bool $requiredAttributes = true ]) : Shibboleth
Parameters
- $config : Config = null
-
Configuration to use (null for default)
- $shibConfig : Config = null
-
Configuration with IdP
- $useHeaders : bool = false
-
use HTTP headers instead of environment variables
- $requiredAttributes : bool = true
-
required attributes
Return values
Shibboleth —getDbService()
Get a database service.
public
getDbService(string $service) : DbServiceInterface
Parameters
- $service : string
-
Name of service to load
Return values
DbServiceInterface —getFavoritesService()
Get the favorites service.
public
getFavoritesService() : FavoritesService
Return values
FavoritesService —getLiveDatabaseContainer()
Get a real, working table manager.
public
getLiveDatabaseContainer() : MockContainer
Return values
MockContainer —getLiveDbServiceManager()
Get a real, working database service manager.
public
getLiveDbServiceManager() : PluginManager
Return values
PluginManager —getLiveTableManager()
Get a real, working table manager.
public
getLiveTableManager() : PluginManager
Return values
PluginManager —getShibbolethConfig()
Get a working configuration for the Shibboleth object
public
getShibbolethConfig() : Config
Return values
Config —getTable()
Get a table object.
public
getTable(string $table) : Gateway
Parameters
- $table : string
-
Name of table to load
Return values
Gateway —setUp()
Standard setup method.
public
setUp() : void
Return values
void —setUpBeforeClass()
Standard setup method.
public
static setUpBeforeClass() : void
Return values
void —tearDownAfterClass()
Standard teardown method.
public
static tearDownAfterClass() : void
Return values
void —testCreateIsDisallowed()
Test account creation is disallowed.
public
testCreateIsDisallowed() : void
Return values
void —testFailedLogin()
Test failed login.
public
testFailedLogin() : void
Return values
void —testLogin()
Test successful login.
public
testLogin() : void
Return values
void —testLogin1()
Test successful login.
public
testLogin1() : void
Return values
void —testLogin2()
Test successful login.
public
testLogin2() : void
Return values
void —testLoginWithBlankPassword()
Test login with blank username.
public
testLoginWithBlankPassword() : void
Return values
void —testLoginWithBlankUsername()
Test login with blank username.
public
testLoginWithBlankUsername() : void
Return values
void —testProxyLogin()
Test login using attributes passed in headers.
public
testProxyLogin() : void
Return values
void —testSessionInitiator()
Test session initiator
public
testSessionInitiator() : void
Return values
void —testWithMissingAttributeValue()
Test a configuration with a missing attribute value.
public
testWithMissingAttributeValue() : void
Return values
void —testWithoutLoginSetting()
Test a configuration with missing login setting.
public
testWithoutLoginSetting() : void
Return values
void —testWithoutUsername()
Test a configuration with missing username.
public
testWithoutUsername() : void
Return values
void —failIfDataExists()
Static setup support function to fail if there is already data in the database. We want to ensure a clean state for each test!
protected
static failIfDataExists([string|null $failMessage = null ]) : void
Parameters
- $failMessage : string|null = null
-
Failure message to display if data exists (null for default).
Return values
void —getLoginRequest()
Support method -- get parameters to log into an account (but allow override of individual parameters so we can test different scenarios).
protected
getLoginRequest([array<string|int, mixed> $overrides = [] ][, bool $useHeaders = false ]) : Request
Parameters
- $overrides : array<string|int, mixed> = []
-
Associative array of parameters to override.
- $useHeaders : bool = false
-
Use headers instead of environment variables
Return values
Request —removeUsers()
Static teardown support function to destroy user accounts. Accounts are expected to exist, and the method will fail if they are missing.
protected
static removeUsers(array<string|int, string>|string $users) : void
Parameters
- $users : array<string|int, string>|string
-
User(s) to delete