Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
coco
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
coco
Commits
4a962d21
Commit
4a962d21
authored
Jun 27, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] 修复connect with token的bug
parent
75a776dd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
connection.py
coco/connection.py
+2
-1
httpd.py
coco/httpd.py
+6
-7
No files found.
coco/connection.py
View file @
4a962d21
...
...
@@ -104,7 +104,8 @@ class SSHConnection:
ssh
.
connect
(
gateway
.
ip
,
port
=
gateway
.
port
,
username
=
gateway
.
username
,
password
=
gateway
.
password
,
pkey
=
gateway
.
private_key_obj
)
pkey
=
gateway
.
private_key_obj
,
timeout
=
TIMEOUT
)
except
(
paramiko
.
AuthenticationException
,
paramiko
.
BadAuthenticationType
,
SSHException
):
...
...
coco/httpd.py
View file @
4a962d21
...
...
@@ -34,6 +34,10 @@ class BaseNamespace(Namespace):
user
=
app_service
.
check_user_cookie
(
session_id
,
csrf_token
)
if
token
:
user
=
app_service
.
check_user_with_token
(
token
)
msg
=
"Get current user: session_id<{}> token<{}> => {}"
.
format
(
session_id
,
token
,
user
)
logger
.
debug
(
msg
)
return
user
...
...
@@ -149,12 +153,9 @@ class ProxyNamespace(BaseNamespace):
token
=
message
.
get
(
'token'
,
None
)
secret
=
message
.
get
(
'secret'
,
None
)
win_size
=
message
.
get
(
'size'
,
(
80
,
24
))
room
=
self
.
new_room
()
self
.
emit
(
'room'
,
{
'room'
:
room
[
"id"
],
'secret'
:
secret
})
if
not
token
or
not
secret
:
logger
.
debug
(
"Token or secret is None: {}"
.
format
(
token
,
secret
))
self
.
emit
(
'data'
,
{
'data'
:
"
\n
Operation not permitted!"
,
'room'
:
room
[
"id"
]})
self
.
emit
(
'disconnect'
)
return
None
...
...
@@ -162,14 +163,12 @@ class ProxyNamespace(BaseNamespace):
logger
.
debug
(
info
)
if
not
info
:
logger
.
debug
(
"Token info is None"
)
self
.
emit
(
'data'
,
{
'data'
:
"
\n
Operation not permitted!"
,
'room'
:
room
[
"id"
]})
self
.
emit
(
'disconnect'
)
return
None
user_id
=
info
.
get
(
'user'
,
None
)
self
.
current_user
=
app_service
.
get_user_profile
(
user_id
)
room
[
"request"
]
.
user
=
self
.
current_user
#
room["request"].user = self.current_user
self
.
on_host
({
'secret'
:
secret
,
'uuid'
:
info
[
'asset'
],
...
...
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