Skip to content

Commit

Permalink
Merge pull request #94 from plone/jwt-tweak
Browse files Browse the repository at this point in the history
only need to provide token
  • Loading branch information
lukasgraf committed May 17, 2016
2 parents 72c1000 + fd702fd commit dac9c1b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
11 changes: 2 additions & 9 deletions docs/source/_json/login.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ HTTP 200 OK
content-type: application/json

{
"jwt": {
"algorithm": "HS256",
"expires": 1463534055.943888,
"fullname": "Foo bar",
"type": "JWT",
"username": "admin"
},
"signature": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiZnVsbG5hbWUiOiJGb28gYmFyIiwiZXhwaXJlcyI6MTQ2MzUzNDA1NS45NDM4ODgsInR5cGUiOiJKV1QiLCJhbGdvcml0aG0iOiJIUzI1NiJ9.3IafcTKFwcaiSqwuWJ9yxt3iotTYYhLCv7P8_K32hD0",
"success": true
"success": true,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiZnVsbG5hbWUiOiJGb28gYmFyIiwiZXhwaXJlcyI6MTQ2MzU0MDkzNS4wMjYyNzgsInR5cGUiOiJKV1QiLCJhbGdvcml0aG0iOiJIUzI1NiJ9.jhNWjzVg6OIWUVGu6Z4Svy6-5E-VM6aK-Sw6ZJHbdVE"
}
4 changes: 1 addition & 3 deletions src/plone/restapi/services/authentication/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ def render(self):
'fullname': 'Foo bar',
'expires': time.time() + (60 * 60 * 12) # 12 hour length?
}
encoded = jwt.encode(data, self.secret, algorithm='HS256')
return {
'success': True,
'jwt': data,
'signature': encoded
'token': jwt.encode(data, self.secret, algorithm='HS256')
}


Expand Down

0 comments on commit dac9c1b

Please sign in to comment.