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
26113c81
Commit
26113c81
authored
Oct 12, 2015
by
Ad Schellevis
Committed by
Franco Fichtner
Oct 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(captiveportal, new) psr style fix
(cherry picked from commit
e508d11f
)
parent
231f7277
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
14 deletions
+18
-14
AccessController.php
...ntrollers/OPNsense/CaptivePortal/Api/AccessController.php
+18
-14
No files found.
src/opnsense/mvc/app/controllers/OPNsense/CaptivePortal/Api/AccessController.php
View file @
26113c81
...
@@ -72,15 +72,17 @@ class AccessController extends ApiControllerBase
...
@@ -72,15 +72,17 @@ class AccessController extends ApiControllerBase
*/
*/
private
function
getClientIp
()
private
function
getClientIp
()
{
{
// determine orginal sender of this request
// determine orginal sender of this request
$trusted_proxy
=
array
(
"127.0.0.1"
);
$trusted_proxy
=
array
(
"127.0.0.1"
);
if
(
$this
->
request
->
getHeader
(
'X-Forwarded-For'
)
!=
""
&&
in_array
(
$this
->
request
->
getClientAddress
(),
$trusted_proxy
)
)
{
if
(
$this
->
request
->
getHeader
(
'X-Forwarded-For'
)
!=
""
&&
// use X-Forwarded-For header to determine real client
in_array
(
$this
->
request
->
getClientAddress
(),
$trusted_proxy
)
return
$this
->
request
->
getHeader
(
'X-Forwarded-For'
);
)
{
}
else
{
// use X-Forwarded-For header to determine real client
// client accesses the Api directly
return
$this
->
request
->
getHeader
(
'X-Forwarded-For'
);
return
$this
->
request
->
getClientAddress
();
}
else
{
}
// client accesses the Api directly
return
$this
->
request
->
getClientAddress
();
}
}
}
/**
/**
...
@@ -146,11 +148,13 @@ class AccessController extends ApiControllerBase
...
@@ -146,11 +148,13 @@ class AccessController extends ApiControllerBase
$backend
=
new
Backend
();
$backend
=
new
Backend
();
$CPsession
=
$backend
->
configdpRun
(
$CPsession
=
$backend
->
configdpRun
(
"captiveportal allow"
,
"captiveportal allow"
,
array
((
string
)
$cpZone
->
zoneid
,
array
(
(
string
)
$cpZone
->
zoneid
,
$userName
,
$userName
,
$clientIp
,
$clientIp
,
$authServerName
,
$authServerName
,
'json'
)
'json'
)
);
);
$CPsession
=
json_decode
(
$CPsession
,
true
);
$CPsession
=
json_decode
(
$CPsession
,
true
);
if
(
$CPsession
!=
null
)
{
if
(
$CPsession
!=
null
)
{
...
@@ -160,12 +164,12 @@ class AccessController extends ApiControllerBase
...
@@ -160,12 +164,12 @@ class AccessController extends ApiControllerBase
}
}
}
}
}
else
{
}
else
{
return
array
(
"clientState"
=>
'NOT_AUTHORIZED'
,
"ipAddress"
=>
$clientIp
);
return
array
(
"clientState"
=>
'NOT_AUTHORIZED'
,
"ipAddress"
=>
$clientIp
);
}
}
}
}
}
}
return
array
(
"clientState"
=>
'UNKNOWN'
,
"ipAddress"
=>
$clientIp
);
return
array
(
"clientState"
=>
'UNKNOWN'
,
"ipAddress"
=>
$clientIp
);
}
}
...
@@ -187,7 +191,7 @@ class AccessController extends ApiControllerBase
...
@@ -187,7 +191,7 @@ class AccessController extends ApiControllerBase
$backend
=
new
Backend
();
$backend
=
new
Backend
();
$statusRAW
=
$backend
->
configdpRun
(
$statusRAW
=
$backend
->
configdpRun
(
"captiveportal disconnect"
,
"captiveportal disconnect"
,
array
(
$zoneid
,
$clientSession
[
'sessionId'
],
'json'
)
array
(
$zoneid
,
$clientSession
[
'sessionId'
],
'json'
)
);
);
$status
=
json_decode
(
$statusRAW
,
true
);
$status
=
json_decode
(
$statusRAW
,
true
);
if
(
$status
!=
null
)
{
if
(
$status
!=
null
)
{
...
...
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