Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
8a3e5f39
Commit
8a3e5f39
authored
Oct 22, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(auth) add getLastAuthProperties to interface and implementations
parent
9ff86ea4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
1 deletion
+52
-1
IAuthConnector.php
...opnsense/mvc/app/library/OPNsense/Auth/IAuthConnector.php
+6
-0
LDAP.php
src/opnsense/mvc/app/library/OPNsense/Auth/LDAP.php
+9
-0
Local.php
src/opnsense/mvc/app/library/OPNsense/Auth/Local.php
+9
-0
Radius.php
src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php
+28
-1
No files found.
src/opnsense/mvc/app/library/OPNsense/Auth/IAuthConnector.php
View file @
8a3e5f39
...
@@ -41,6 +41,12 @@ interface IAuthConnector
...
@@ -41,6 +41,12 @@ interface IAuthConnector
*/
*/
public
function
setProperties
(
$config
);
public
function
setProperties
(
$config
);
/**
* after authentication, you can call this method to retrieve optional return data from the authenticator
* @return mixed named list of authentication properties, may be returned by the authenticator
*/
public
function
getLastAuthProperties
();
/**
/**
* authenticate user
* authenticate user
* @param $username username to authenticate
* @param $username username to authenticate
...
...
src/opnsense/mvc/app/library/OPNsense/Auth/LDAP.php
View file @
8a3e5f39
...
@@ -286,6 +286,15 @@ class LDAP implements IAuthConnector
...
@@ -286,6 +286,15 @@ class LDAP implements IAuthConnector
return
false
;
return
false
;
}
}
/**
* unused
* @return array mixed named list of authentication properties
*/
public
function
getLastAuthProperties
()
{
return
array
();
}
/**
/**
* authenticate user against ldap server
* authenticate user against ldap server
* @param $username username to authenticate
* @param $username username to authenticate
...
...
src/opnsense/mvc/app/library/OPNsense/Auth/Local.php
View file @
8a3e5f39
...
@@ -46,6 +46,15 @@ class Local implements IAuthConnector
...
@@ -46,6 +46,15 @@ class Local implements IAuthConnector
// local authenticator doesn't use any additional settings.
// local authenticator doesn't use any additional settings.
}
}
/**
* unused
* @return array mixed named list of authentication properties
*/
public
function
getLastAuthProperties
()
{
return
array
();
}
/**
/**
* authenticate user against local database (in config.xml)
* authenticate user against local database (in config.xml)
* @param $username username to authenticate
* @param $username username to authenticate
...
...
src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php
View file @
8a3e5f39
...
@@ -77,6 +77,10 @@ class Radius implements IAuthConnector
...
@@ -77,6 +77,10 @@ class Radius implements IAuthConnector
*/
*/
private
$nasIdentifier
=
'local'
;
private
$nasIdentifier
=
'local'
;
/**
* @var array internal list of authentication properties (returned by radius auth)
*/
private
$lastAuthProperties
=
array
();
/**
/**
* set connector properties
* set connector properties
...
@@ -102,6 +106,15 @@ class Radius implements IAuthConnector
...
@@ -102,6 +106,15 @@ class Radius implements IAuthConnector
}
}
}
}
/**
* unused
* @return array mixed named list of authentication properties
*/
public
function
getLastAuthProperties
()
{
return
$this
->
lastAuthProperties
;
}
/**
/**
* authenticate user against radius
* authenticate user against radius
* @param $username username to authenticate
* @param $username username to authenticate
...
@@ -110,6 +123,7 @@ class Radius implements IAuthConnector
...
@@ -110,6 +123,7 @@ class Radius implements IAuthConnector
*/
*/
public
function
authenticate
(
$username
,
$password
)
public
function
authenticate
(
$username
,
$password
)
{
{
$this
->
lastAuthProperties
=
array
()
;
// reset auth properties
$radius
=
radius_auth_open
();
$radius
=
radius_auth_open
();
$error
=
null
;
$error
=
null
;
...
@@ -154,11 +168,24 @@ class Radius implements IAuthConnector
...
@@ -154,11 +168,24 @@ class Radius implements IAuthConnector
syslog
(
LOG_ERR
,
'RadiusError:'
.
radius_strerror
(
$error
));
syslog
(
LOG_ERR
,
'RadiusError:'
.
radius_strerror
(
$error
));
}
else
{
}
else
{
$request
=
radius_send_request
(
$radius
);
$request
=
radius_send_request
(
$radius
);
if
(
!
$r
equest
)
{
if
(
!
$r
adius
)
{
syslog
(
LOG_ERR
,
'RadiusError:'
.
radius_strerror
(
$error
));
syslog
(
LOG_ERR
,
'RadiusError:'
.
radius_strerror
(
$error
));
}
else
{
}
else
{
switch
(
$request
)
{
switch
(
$request
)
{
case
RADIUS_ACCESS_ACCEPT
:
case
RADIUS_ACCESS_ACCEPT
:
while
(
$resa
=
radius_get_attr
(
$radius
))
{
switch
(
$resa
[
'attr'
])
{
case
RADIUS_SESSION_TIMEOUT
:
$this
->
lastAuthProperties
[
'session_timeout'
]
=
radius_cvt_int
(
$resa
[
'data'
]);
break
;
case
85
:
// Acct-Interim-Interval
$this
->
lastAuthProperties
[
'Acct-Interim-Interval'
]
=
radius_cvt_int
(
$resa
[
'data'
]);
break
;
default
:
break
;
}
}
return
true
;
return
true
;
break
;
break
;
case
RADIUS_ACCESS_REJECT
:
case
RADIUS_ACCESS_REJECT
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment