\devices\msWindowsCommon

This class defines common functions needed by all Windows installers

A device is a fairly abstract notion. In most cases it represents a particular operating system or a set of operationg systems like MS Windows Vista and newer.

The purpose of this class is to preapare a setup for the device configurator, collect all necessary information from the database, taking into account limitations, that a given device may present (like a set of supported EAP methods).

All that is required from the device module is to produce a conigurator file and pass its name back to the API.

Summary

Methods
Properties
Constants
__construct()
setup()
calculatePreferredEapType()
writeDeviceInfo()
getAttibute()
writeInstaller()
__destruct()
getAttributeValue()
createTemporaryDirectory()
rrmdir()
uuid()
randomString()
copyBasicFiles()
copyPwdFiles()
copyGeantLinkFiles()
echo_nsi()
sprint_nsi()
$FPATH
$specialities
$supportedEapMethods
$nomenclature_fed
$nomenclature_inst
$attributes
$module_path
$selectedEap
$selectedEapObject
$sign
$signer
$device_id
$options
$support_email_substitute
$support_url_substitute
$installerBasename
$deviceUUID
$LANGS
$codePage
$lang
$useGeantLink
L_OK
L_REMARK
L_WARN
L_ERROR
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

L_OK

L_OK = 0

L_REMARK

L_REMARK = 4

L_WARN

L_WARN = 32

L_ERROR

L_ERROR = 256

Properties

$FPATH

$FPATH : 

stores the path to the temporary working directory for a module instance

Type

$specialities

$specialities : mixed|string|int

array of specialities - will be displayed on the admin download as "footnote"

Type

mixed|string|int — specialities

$supportedEapMethods

$supportedEapMethods : mixed|string|int

list of supported EAP methods

Type

mixed|string|int — EAP methods

$nomenclature_fed

$nomenclature_fed : 

the custom displayable variant of the term 'federation'

Type

$nomenclature_inst

$nomenclature_inst : 

the custom displayable variant of the term 'institution'

Type

$attributes

$attributes : mixed|string|int

Array passing all options to the device module.

$attrbutes array contains option values defined for the institution and a particular profile (possibly overriding one another) ready for the device module to consume.

For each of the options the value is another array of vales (even if only one value is present). Some attributes may be missing if they have not been configured for a viven institution or profile.

The following attributes are meant to be used by device modules:

  • general:geo_coordinates - geographical coordinates of the institution or a campus
  • support:info_file - consent file displayed to the users
  • general:logo_file - file data containing institution logo
  • support:eap_types - URL to a local support page for a specific eap methiod, not to be confused with general:url
  • support:email - email for users to contact for local instructions
  • support:phone - telephone number for users to contact for local instructions
  • support:url - URL where the user will find local instructions
  • internal:info_file - the pathname of the info_file saved in the working directory
  • internal:logo_file - array of pathnames of logo_files saved in the working directory
  • internal:CAs - the value is an array produced by X509::processCertificate() with the following filds
  • internal:SSID - an array indexed by SSID strings with values either TKIP or AES; if TKIP is set the both WPA/TKIP and WPA2/AES should be set if AES is set the this is a WPA2/AES only SSID; the consortium's defined SSIDs are always set as the first array elements.
  • internal:consortia an array of consortion IO as declared in the config-confassistant
  • internal:profile_count - the number of profiles for the associated IdP

these attributes are available and can be used, but the "internal" attributes are better suited for modules

  • eap:ca_file - certificate of the CA signing the RADIUS server key
  • media:SSID - additional SSID to configure, WPA2/AES only (device modules should use internal:SSID)
  • media:SSID_with_legacy - additional SSID to configure, WPA2/AES and WPA/TKIP (device modules should use internal:SSID)

Type

mixed|string|int —

$module_path

$module_path : 

stores the path to the module source location and is used by copyFile and translateFile the only reason for it to be a public variable ies that it is set by the DeviceFactory class module_path should not be used by module drivers.

Type

$selectedEap

$selectedEap : mixed|string|int

* The optimal EAP type selected given profile and device

Type

mixed|string|int —

$selectedEapObject

$selectedEapObject : 

Type

$sign

$sign : 

the path to the profile signing program device modules which require signing should use this property to exec the signer the signer program must accept two arguments - input and output file names the signer program mus operate in the local directory and filenames are relative to this directory

Type

$signer

$signer : 

Type

$device_id

$device_id : 

The string identifier of the device (don't show this to users)

Type

$options

$options : mixed|string|int

See devices-template.php for a list of available options

Type

mixed|string|int —

$support_email_substitute

$support_email_substitute : 

This string will be shown if no support email was configured by the admin

Type

$support_url_substitute

$support_url_substitute : 

This string will be shown if no support URL was configured by the admin

Type

$installerBasename

$installerBasename : 

This string should be used by all installer modules to set the installer file basename.

Type

$deviceUUID

$deviceUUID : 

stores identifier used by GEANTLink profiles

Type

$LANGS

$LANGS : 

Type

$codePage

$codePage : 

Type

$lang

$lang : 

Type

$useGeantLink

$useGeantLink : 

Type

Methods

__construct()

__construct() : 

device module constructor should be defined by each module.

The one important thing to do is to call setSupportedEapMethods with an array of EAP methods the device supports

Returns

setup()

setup(\core\AbstractProfile  profile,  token = NULL,  importPassword = NULL) : 

Set up working environment for a device module

Sets up the device module environment taking into account the actual profile selected by the user in the GUI. The selected profile is passed as the Profile $profile argumant.

This method needs to be called after the device instance has been created (the GUI class does that)

setup performs the following tasks:

  • collect profile attributes and pass them as the attributes property;
  • create the temporary working directory
  • process CA certificates and store them as 'internal:CAs' attribute
  • process and save optional info files and store references to them in 'internal:info_file' attribute

Parameters

\core\AbstractProfile profile

the profile object which will be passed by the caller

token
importPassword

Returns

calculatePreferredEapType()

calculatePreferredEapType(mixed|string|int  eapArrayofObjects) : 

Selects the preferred eap method based on profile EAP configuration and device EAP capabilities

Parameters

mixed|string|int eapArrayofObjects

an array of eap methods supported by a given device

Returns

writeDeviceInfo()

writeDeviceInfo() : 

prepare usage information for the installer every device module should override this method

Returns

HTML text to be displayed

getAttibute()

getAttibute( attrName) : 

Parameters

attrName

Returns

writeInstaller()

writeInstaller() : 

placeholder for the main device method

Returns

__destruct()

__destruct() : 

destroys the entity.

Logs the end of lifetime of the entity to the debug log on level 5.

Returns

getAttributeValue()

getAttributeValue(mixed|string|int  attributeArray, string|int  index1, string|int  index2) : 

This is a helper fuction to retrieve a value from two-dimensional arrays The function tests if the value for the first indes is defined and then the same with the second and finally returns the value if something on the way is not defined, NULL is returned

Parameters

mixed|string|int attributeArray
string|int index1
string|int index2

Returns

createTemporaryDirectory()

createTemporaryDirectory(  purpose = installer,   failIsFatal = 1) : mixed|string|int

create a temporary directory and return the location

Parameters

purpose

one of 'installer', 'logo', 'test' defined the purpose of the directory

failIsFatal

decides if a creation failure should cause an error; defaults to true

Returns

mixed|string|int —

the tuple of: base path, absolute path for directory, directory name

rrmdir()

rrmdir(  dir) : 

this direcory delete function has been copied from PHP documentation

Parameters

dir

name of the directory to delete

Returns

uuid()

uuid(  prefix,  deterministicSource = NULL) : 

generates a UUID, for the devices which identify file contents by UUID

Parameters

prefix

an extra prefix to set before the UUID

deterministicSource

Returns

UUID (possibly prefixed)

randomString()

randomString(  length,   keyspace = 23456789abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ) : 

produces a random string

Parameters

length

the length of the string to produce

keyspace

the pool of characters to use for producing the string

Throws

\Exception

Returns

copyBasicFiles()

copyBasicFiles() : 

Returns

copyPwdFiles()

copyPwdFiles() : 

Returns

copyGeantLinkFiles()

copyGeantLinkFiles() : 

Returns

echo_nsi()

echo_nsi(  in) : 

function to escape double quotes in a special NSI-compatible way

Parameters

in

input string

Returns

sprint_nsi()

sprint_nsi(  input) : 

Parameters

input

input string

Returns