Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
belenios
belenios
Commits
0577106a
Commit
0577106a
authored
Jun 27, 2013
by
Stephane Glondu
Browse files
Enable/disable dummy auth in configuration file
parent
85efd2d8
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/web/registration.ml
View file @
0577106a
...
...
@@ -22,6 +22,7 @@ let populate accu f s = Lwt_stream.fold_s f s accu
let
secure_logfile
=
ref
None
let
data_dir
=
ref
None
let
source_file
=
ref
None
let
enable_dummy
=
ref
false
let
()
=
let
open
Ocsigen_extensions
.
Configuration
in
...
...
@@ -44,6 +45,11 @@ let () =
~
attributes
:
[
attribute
~
name
:
"dir"
~
obligatory
:
true
(
fun
s
->
data_dir
:=
Some
s
);
]
()
;
element
~
name
:
"enable-dummy"
~
obligatory
:
false
~
init
:
(
fun
()
->
enable_dummy
:=
true
)
()
;
];;
lwt
()
=
...
...
@@ -196,20 +202,23 @@ let () = Eliom_registration.Html5.register
let
()
=
Eliom_registration
.
Html5
.
register
~
service
:
Services
.
login_dummy
(
fun
()
()
->
let
service
=
Services
.
create_dummy_login
()
in
let
()
=
Eliom_registration
.
Redirection
.
register
~
service
~
scope
:
Eliom_common
.
default_session_scope
(
fun
()
user_name
->
let
open
Web_common
in
let
user_type
=
Dummy
in
Eliom_reference
.
set
Services
.
user
(
Some
{
user_name
;
user_type
})
>>
Web_common
.
security_log
(
fun
()
->
user_name
^
" successfully logged in using dummy"
)
>>
Services
.
get
()
)
in
Templates
.
dummy_login
~
service
)
if
!
enable_dummy
then
(
let
service
=
Services
.
create_dummy_login
()
in
let
()
=
Eliom_registration
.
Redirection
.
register
~
service
~
scope
:
Eliom_common
.
default_session_scope
(
fun
()
user_name
->
let
open
Web_common
in
let
user_type
=
Dummy
in
Eliom_reference
.
set
Services
.
user
(
Some
{
user_name
;
user_type
})
>>
Web_common
.
security_log
(
fun
()
->
user_name
^
" successfully logged in using dummy"
)
>>
Services
.
get
()
)
in
Templates
.
dummy_login
~
service
)
else
fail_http
404
)
let
next_lf
str
i
=
try
Some
(
String
.
index_from
str
i
'\n'
)
...
...
src/web/services.ml
View file @
0577106a
...
...
@@ -57,7 +57,6 @@ let create_dummy_login () =
()
let
auth_systems
=
[
"dummy"
,
login_dummy
;
"CAS"
,
Eliom_service
.
preapply
login_cas
None
;
]
...
...
tests/ocsigenserver.conf.in
View file @
0577106a
...
...
@@ -30,6 +30,7 @@
<static dir="_SRCDIR_/media/booth" />
</site>
<eliom module="_build/src/web/server.cma">
<enable-dummy/>
<log file="_RUNDIR_/log/security.log"/>
<data dir="tests/data"/>
</eliom>
...
...
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