Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
PUBLIC
/
surfer-okd
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 3d716d9e
authored
Nov 17, 2016
by
Johannes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename auth exports
1 parent
f9f5c021
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
app.js
src/auth.js
app.js
View file @
3d716d9
...
...
@@ -22,9 +22,9 @@ var router = new express.Router();
var
multipart
=
multipart
({
maxFieldsSize
:
2
*
1024
,
limit
:
'512mb'
,
timeout
:
3
*
60
*
1000
});
router
.
get
(
'/api/files/*'
,
auth
.
ldap
,
files
.
get
);
router
.
put
(
'/api/files/*'
,
auth
.
ldap
,
multipart
,
files
.
put
);
router
.
delete
(
'/api/files/*'
,
auth
.
ldap
,
files
.
del
);
router
.
get
(
'/api/files/*'
,
auth
.
verify
,
files
.
get
);
router
.
put
(
'/api/files/*'
,
auth
.
verify
,
multipart
,
files
.
put
);
router
.
delete
(
'/api/files/*'
,
auth
.
verify
,
files
.
del
);
router
.
get
(
'/api/healthcheck'
,
function
(
req
,
res
)
{
res
.
status
(
200
).
send
();
});
// welcome screen in case / does not serve up any file yet
...
...
src/auth.js
View file @
3d716d9
...
...
@@ -24,11 +24,11 @@ var LDAP_USERS_BASE_DN = process.env.LDAP_USERS_BASE_DN;
if
(
LDAP_URL
&&
LDAP_USERS_BASE_DN
)
{
console
.
log
(
'Enable ldap auth'
);
exports
.
ldap
=
passport
.
authenticate
(
'ldap'
);
exports
.
verify
=
passport
.
authenticate
(
'ldap'
);
}
else
{
console
.
log
(
'Use local user file:'
,
LOCAL_AUTH_FILE
);
exports
.
ldap
=
function
(
req
,
res
,
next
)
{
exports
.
verify
=
function
(
req
,
res
,
next
)
{
var
users
=
safe
.
JSON
.
parse
(
safe
.
fs
.
readFileSync
(
LOCAL_AUTH_FILE
));
if
(
!
users
)
return
res
.
send
(
401
);
if
(
!
users
[
req
.
query
.
username
])
return
res
.
send
(
401
);
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment