Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
emqx-auth-anonymous
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taegyun Kim
emqx-auth-anonymous
Commits
bb71eebf
Commit
bb71eebf
authored
Jun 17, 2020
by
Taegyun Kim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
template 기반으로 수정
parent
86705207
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
49 additions
and
37 deletions
+49
-37
etc/emqx_auth_anonymous.config
etc/emqx_auth_anonymous.config
+5
-0
rebar.config
rebar.config
+2
-21
src/emqx_auth_anonymous.app.src
src/emqx_auth_anonymous.app.src
+1
-1
src/emqx_auth_anonymous.erl
src/emqx_auth_anonymous.erl
+14
-3
src/emqx_auth_anonymous_app.erl
src/emqx_auth_anonymous_app.erl
+6
-12
src/emqx_auth_anonymous_sub.erl
src/emqx_auth_anonymous_sub.erl
+14
-0
test/emqx_auth_anonymous_SUITE.erl
test/emqx_auth_anonymous_SUITE.erl
+7
-0
No files found.
etc/emqx_auth_anonymous.config
0 → 100644
View file @
bb71eebf
[
{
emqx_auth_anonymous
, []}
].
rebar.config
View file @
bb71eebf
{
deps
,[]}.
{
profiles
,
[{
test
,
[{
deps
,[]}]
}
]}.
{
erl_opts
, [
warn_unused_vars
,
warn_shadow_vars
,
warn_unused_import
,
warn_obsolete_guard
,
debug_info
,
{
parse_transform
}]}.
{
xref_checks
, [
undefined_function_calls
,
undefined_functions
,
locals_not_used
,
deprecated_function_calls
,
warnings_as_errors
,
deprecated_functions
]}.
{
cover_enabled
,
true
}.
{
cover_opts
, [
verbose
]}.
{
cover_export_enabled
,
true
}.
{
deps
, []}.
{
erl_opts
, [
debug_info
]}.
src/emqx_auth_anonymous.app.src
View file @
bb71eebf
...
...
@@ -2,7 +2,7 @@
[{description, "EMQ X Authentication for anonymous"},
{vsn, "git"},
{modules, []},
{registered, []},
{registered, [
emqx_auth_anonymous_sup
]},
{applications, [kernel,stdlib]},
{mod, {emqx_auth_anonymous_app,[]}},
{env, []},
...
...
src/emqx_auth_anonymous.erl
View file @
bb71eebf
-
module
(
emqx_auth_anonymous
).
-
export
([
check
/
2
]
).
-
include_lib
(
"emqx/include/emqx.hrl"
).
check
(
#
{
username
:
=
Username
,
password
:
=
Password
},
AuthResult
)
->
-
export
([
load
/
0
,
unload
/
0
]).
-
export
([
on_client_authenticate
/
2
]).
load
()
->
emqx
:
hook
(
'client.authenticate'
,
{
?
MODULE
,
on_client_authenticate
,
[]}).
on_client_authenticate
(
#
{
username
:
=
Username
,
password
:
=
Password
},
AuthResult
)
->
io
:
format
(
"username:
~w
, password:
~w~n
"
,
[
Username
,
Password
]),
{
stop
,
AuthResult
#
{
auth_result
=>
success
,
anonymous
=>
false
}}.
{
ok
,
AuthResult
}.
unload
()
->
emqx
:
unhook
(
'client.authenticate'
,
{
?
MODULE
,
on_client_authenticate
}).
src/emqx_auth_anonymous_app.erl
View file @
bb71eebf
-
module
(
emqx_auth_anonymous_app
).
-
behaviour
(
application
).
-
behaviour
(
supervisor
).
-
emqx_plugin
(
?
MODULE
).
-
export
([
start
/
2
,
stop
/
1
]).
-
export
([
init
/
1
]).
-
export
([
start
/
2
,
stop
/
1
]).
start
(_
Type
,
_
Args
)
->
emqx
:
hook
(
'client.authenticate'
,
fun
emqx_auth_anonymous
:
check
/
2
),
supervisor
:
start_link
({
local
,
?
MODULE
},
?
MODULE
,
[]).
start
(_
StartType
,
_
StartArgs
)
->
{
ok
,
Sup
}
=
emqx_auth_anonymous_sub
:
start_link
(),
emqx_plugin_template
:
load
(),
{
ok
,
Sup
}.
stop
(_
State
)
->
emqx
:
unhook
(
'client.authenticate'
,
fun
emqx_auth_anonymous
:
check
/
2
).
%%--------------------------------------------------------------------
init
([])
->
{
ok
,
{
{
one_for_all
,
1
,
10
},
[]}
}.
emqx_plugin_template
:
unload
().
src/emqx_auth_anonymous_sub.erl
0 → 100644
View file @
bb71eebf
-
module
(
emqx_auth_anonymous_sub
).
-
behaviour
(
supervisor
).
-
export
([
start_link
/
0
]).
-
export
([
init
/
1
]).
start_link
()
->
supervisor
:
start_link
({
local
,
?
MODULE
},
?
MODULE
,
[]).
init
([])
->
{
ok
,
{
{
one_for_all
,
0
,
1
},
[]}
}.
test/emqx_auth_anonymous_SUITE.erl
0 → 100644
View file @
bb71eebf
-
module
(
emqx_auth_anonymous_SUITE
).
-
compile
(
export_all
).
all
()
->
[].
groups
()
->
[].
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