Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
L
luna
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
ops
luna
Commits
05940a90
Commit
05940a90
authored
8 years ago
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update authentication
parent
ace58ad8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
config.py
config.py
+1
-1
authentication.py
luna/authentication.py
+3
-1
No files found.
config.py
View file @
05940a90
...
...
@@ -4,7 +4,7 @@ DEBUG = True
# NAME = 'luna'
# BIND_HOST = '0.0.0.0'
# LISTEN_PORT = 5000
# JUMPSERVER_ENDPOINT = 'http://localhost:8080'
# JUMPSERVER_ENDPOINT = 'http://localhost:8080
/
'
# ACCESS_KEY = None
# ACCESS_KEY_ENV = 'LUNA_ACCESS_KEY'
# ACCESS_KEY_STORE = os.path.join(BASE_DIR, 'luna', 'keys', '.access_key')
...
...
This diff is collapsed.
Click to expand it.
luna/authentication.py
View file @
05940a90
...
...
@@ -23,11 +23,13 @@ def login_required(func=None, login_url=None):
csrf_token
=
request
.
cookies
.
get
(
'csrftoken'
,
''
)
if
''
in
[
session_id
,
csrf_token
]:
print
(
session_id
,
csrf_token
)
return
redirect
(
url
)
g
.
user_service
=
UserService
(
endpoint
=
app
.
config
[
'JUMPSERVER_ENDPOINT'
])
g
.
user_service
.
auth_from_session
(
session_id
,
csrf_token
)
user
=
g
.
user_service
.
is_authenticated
()
print
(
user
)
if
user
:
g
.
user
=
user
assets
=
g
.
user_service
.
get_my_assets
()
...
...
@@ -37,7 +39,7 @@ def login_required(func=None, login_url=None):
g
.
assets
=
assets_dict
return
func
(
*
args
,
**
kwargs
)
else
:
return
redirect
(
login_url
)
print
(
'hello'
)
return
wrapper
...
...
This diff is collapsed.
Click to expand it.
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