83 private $max_retries = 3;
94 if (!extension_loaded(
"radius")) {
95 throw new KumbiaException(
"Debe cargar la extensi�n de php llamada radius");
98 foreach (array(
'server',
'secret') as $param) {
99 if (isset($extra_args[$param])) {
100 $this->$param = $extra_args[$param];
102 throw new KumbiaException(
"Debe especificar el par�metro '$param' en los par�metros");
106 foreach (array(
'username',
'password') as $param) {
107 if (isset($extra_args[$param])) {
108 $this->$param = $extra_args[$param];
119 if (!$this->resource) {
122 $identity = array(
"username" => $this->username,
"realm" => $this->username);
134 $radius = radius_auth_open();
136 throw new KumbiaException(
"No se pudo crear el autenticador de Radius");
139 if (!radius_add_server($radius, $this->server, $this->port, $this->secret,
140 $this->timeout, $this->max_retries)) {
144 if (!radius_create_request($radius, RADIUS_ACCESS_REQUEST)) {
148 if (!radius_put_string($radius, RADIUS_USER_NAME, $this->username)) {
152 if (!radius_put_string($radius, RADIUS_USER_PASSWORD, $this->password)) {
156 if (!radius_put_int($radius, RADIUS_AUTHENTICATE_ONLY, 1)) {
160 $this->resource = $radius;
162 if (radius_send_request($radius) == RADIUS_ACCESS_ACCEPT) {
175 if ($this->resource) {
176 radius_close($this->resource);
187 foreach (array(
'server',
'secret',
'username',
'principal',
188 'password',
'port',
'max_retries') as $param) {
189 if (isset($extra_args[$param])) {
190 $this->$param = $extra_args[$param];