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
f9b24c4a
Commit
f9b24c4a
authored
Apr 01, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add basic auth to auth.inc
parent
cd06a9b9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
auth.inc
src/etc/inc/auth.inc
+19
-0
No files found.
src/etc/inc/auth.inc
View file @
f9b24c4a
...
@@ -1451,4 +1451,23 @@ function session_auth() {
...
@@ -1451,4 +1451,23 @@ function session_auth() {
return
true
;
return
true
;
}
}
/**
* do a basic authentication, uses $_SERVER['HTTP_AUTHORIZATION'] to validate user.
* @param $http_auth_header http_authorization header content
* @return bool
*/
function
http_basic_auth
(
$http_auth_header
)
{
$tags
=
explode
(
" "
,
$http_auth_header
)
;
if
(
count
(
$tags
)
>=
2
)
{
$userinfo
=
explode
(
":"
,
base64_decode
(
$tags
[
1
]))
;
if
(
count
(
$userinfo
)
>=
2
)
{
return
authenticate_user
(
$userinfo
[
0
],
$userinfo
[
1
]);
}
}
// not authenticated
return
false
;
}
?>
?>
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