ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
Auth_Container_SAP Class Reference
+ Inheritance diagram for Auth_Container_SAP:
+ Collaboration diagram for Auth_Container_SAP:

Public Member Functions

 Auth_Container_SAP ($options)
 Class constructor. More...
 
 fetchData ($username, $password)
 Performs username and password check. More...
 
 getError ()
 Retrieves the last error from the SAP connection and returns it as an array. More...
 
- Public Member Functions inherited from Auth_Container
 Auth_Container ()
 Constructor. More...
 
 fetchData ($username, $password, $isChallengeResponse=false)
 Fetch data from storage container. More...
 
 verifyPassword ($password1, $password2, $cryptType="md5")
 Crypt and verfiy the entered password. More...
 
 supportsChallengeResponse ()
 Returns true if the container supports Challenge Response password authentication. More...
 
 getCryptType ()
 Returns the crypt current crypt type of the container. More...
 
 listUsers ()
 List all users that are available from the storage container. More...
 
 getUser ($username)
 Returns a user assoc array. More...
 
 addUser ($username, $password, $additional=null)
 Add a new user to the storage container. More...
 
 removeUser ($username)
 Remove user from the storage container. More...
 
 changePassword ($username, $password)
 Change password for user in the storage container. More...
 
 log ($message, $level=AUTH_LOG_DEBUG)
 Log a message to the Auth log. More...
 
- Public Member Functions inherited from ilAuthContainerBase
 loginObserver ($a_username, $a_auth)
 Called after successful login. More...
 
 failedLoginObserver ($a_username, $a_auth)
 Called after failed login. More...
 
 checkAuthObserver ($a_username, $a_auth)
 Called after check auth requests. More...
 
 logoutObserver ($a_username, $a_auth)
 Called after logout. More...
 
 supportsCaptchaVerification ()
 Returns whether or not the auth container supports the verification of captchas This should be true for those auth methods, which are available in the default login form. More...
 

Data Fields

 $options
 
- Data Fields inherited from Auth_Container
 $activeUser = ""
 User that is currently selected from the storage container. More...
 
 $_auth_obj = null
 The Auth object this container is attached to. More...
 

Detailed Description

Definition at line 54 of file SAP.php.

Member Function Documentation

◆ Auth_Container_SAP()

Auth_Container_SAP::Auth_Container_SAP (   $options)

Class constructor.

Checks that required options are present and that the SAPRFC extension is loaded

Options that can be passed and their defaults:

array(
  'ASHOST' => "",
  'SYSNR'  => "",
  'CLIENT' => "000",
  'GWHOST' =>"",
  'GWSERV' =>"",
  'MSHOST' =>"",
  'R3NAME' =>"",
  'GROUP'  =>"",
  'LANG'   =>"EN",
  'TRACE'  =>"",
  'GETSSO2'=> true
)
Parameters
arrayarray of options.
Returns
void

Definition at line 94 of file SAP.php.

References PEAR\loadExtension(), and PEAR\raiseError().

95  {
96  $saprfc_loaded = PEAR::loadExtension('saprfc');
97  if (!$saprfc_loaded) {
98  return PEAR::raiseError('Cannot use SAP authentication, '
99  .'SAPRFC extension not loaded!');
100  }
101  if (empty($options['R3NAME']) && empty($options['ASHOST'])) {
102  return PEAR::raiseError('R3NAME or ASHOST required for authentication');
103  }
104  $this->options = array_merge($this->options, $options);
105  }
loadExtension($ext)
OS independant PHP extension load.
Definition: PEAR.php:745
& raiseError($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
This method is a wrapper that returns an instance of the configured error class with this object's de...
Definition: PEAR.php:524
+ Here is the call graph for this function:

◆ fetchData()

Auth_Container_SAP::fetchData (   $username,
  $password 
)

Performs username and password check.

Parameters
stringUsername
stringPassword
Returns
boolean TRUE on success (valid user), FALSE otherwise

Definition at line 117 of file SAP.php.

References $options, AUTH_LOG_DEBUG, getError(), Auth_Container\log(), and PEAR\raiseError().

118  {
119  $this->log('Auth_Container_SAP::fetchData() called.', AUTH_LOG_DEBUG);
120  $connection_options = $this->options;
121  $connection_options['USER'] = $username;
122  $connection_options['PASSWD'] = $password;
123  $rfc = saprfc_open($connection_options);
124  if (!$rfc) {
125  $message = "Couldn't connect to the SAP system.";
126  $error = $this->getError();
127  if ($error['message']) {
128  $message .= ': ' . $error['message'];
129  }
130  PEAR::raiseError($message, null, null, null, @$erorr['all']);
131  return false;
132  } else {
133  if (!empty($this->options['GETSSO2'])) {
134  $this->log('Attempting to retrieve SSO2 ticket.', AUTH_LOG_DEBUG);
135  if ($ticket = @saprfc_get_ticket($rfc)) {
136  $this->options['MYSAPSSO2'] = $ticket;
137  unset($this->options['GETSSO2']);
138  $this->_auth_obj->setAuthData('sap', $this->options);
139  } else {
140  PEAR::raiseError("SSO ticket retrieval failed");
141  }
142  }
143  @saprfc_close($rfc);
144  return true;
145  }
146 
147  }
getError()
Retrieves the last error from the SAP connection and returns it as an array.
Definition: SAP.php:158
const AUTH_LOG_DEBUG
Auth Log level - DEBUG.
Definition: Auth.php:59
& raiseError($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
This method is a wrapper that returns an instance of the configured error class with this object's de...
Definition: PEAR.php:524
log($message, $level=AUTH_LOG_DEBUG)
Log a message to the Auth log.
Definition: Container.php:246
+ Here is the call graph for this function:

◆ getError()

Auth_Container_SAP::getError ( )

Retrieves the last error from the SAP connection and returns it as an array.

Returns
array Array of error information

Definition at line 158 of file SAP.php.

Referenced by fetchData().

159  {
160 
161  $error = array();
162  $sap_error = saprfc_error();
163  if (empty($err)) {
164  return $error;
165  }
166  $err = explode("n", $sap_error);
167  foreach ($err AS $line) {
168  $item = split(':', $line);
169  $error[strtolower(trim($item[0]))] = trim($item[1]);
170  }
171  $error['all'] = $sap_error;
172  return $error;
173  }
+ Here is the caller graph for this function:

Field Documentation

◆ $options

Auth_Container_SAP::$options
Initial value:
= array(
'CLIENT' => '000',
'LANG' => 'EN',
'GETSSO2' => true,
)

Definition at line 61 of file SAP.php.

Referenced by fetchData().


The documentation for this class was generated from the following file: