Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
61933f8e
Commit
61933f8e
authored
10 years ago
by
Kegan Dougal
Browse files
Options
Downloads
Patches
Plain Diff
Added M_UNKNOWN_TOKEN error code and send it when there is an unrecognised access_token
parent
d5033849
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
docs/client-server/specification.rst
+4
-1
4 additions, 1 deletion
docs/client-server/specification.rst
synapse/api/auth.py
+3
-2
3 additions, 2 deletions
synapse/api/auth.py
synapse/api/errors.py
+1
-0
1 addition, 0 deletions
synapse/api/errors.py
with
8 additions
and
3 deletions
docs/client-server/specification.rst
+
4
−
1
View file @
61933f8e
...
...
@@ -262,7 +262,10 @@ the error, but the keys 'error' and 'errcode' will always be present.
Some standard error codes are below:
M_FORBIDDEN:
Forbidden access, e.g. bad access token, failed login.
Forbidden access, e.g. joining a room without permission, failed login.
M_UNKNOWN_TOKEN:
The access token specified was not recognised.
M_BAD_JSON:
Request contained valid JSON, but it was malformed in some way, e.g. missing
...
...
This diff is collapsed.
Click to expand it.
synapse/api/auth.py
+
3
−
2
View file @
61933f8e
...
...
@@ -18,7 +18,7 @@
from
twisted.internet
import
defer
from
synapse.api.constants
import
Membership
from
synapse.api.errors
import
AuthError
,
StoreError
from
synapse.api.errors
import
AuthError
,
StoreError
,
Codes
from
synapse.api.events.room
import
(
RoomTopicEvent
,
RoomMemberEvent
,
MessageEvent
,
FeedbackEvent
)
...
...
@@ -163,4 +163,5 @@ class Auth(object):
user_id
=
yield
self
.
store
.
get_user_by_token
(
token
=
token
)
defer
.
returnValue
(
self
.
hs
.
parse_userid
(
user_id
))
except
StoreError
:
raise
AuthError
(
403
,
"
Unrecognised access token.
"
)
raise
AuthError
(
403
,
"
Unrecognised access token.
"
,
errcode
=
Codes
.
UNKNOWN_TOKEN
)
This diff is collapsed.
Click to expand it.
synapse/api/errors.py
+
1
−
0
View file @
61933f8e
...
...
@@ -27,6 +27,7 @@ class Codes(object):
BAD_PAGINATION
=
"
M_BAD_PAGINATION
"
UNKNOWN
=
"
M_UNKNOWN
"
NOT_FOUND
=
"
M_NOT_FOUND
"
UNKNOWN_TOKEN
=
"
M_UNKNOWN_TOKEN
"
class
CodeMessageException
(
Exception
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment