This repository was archived by the owner on Sep 7, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +27
-1
lines changed
Expand file tree Collapse file tree 3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change 1+ docs /_build
2+ LangDev.egg-info
3+ db.sqlite
4+ * .pyc
5+ * .swp
6+ * .cfg
7+ .DS_Store
Original file line number Diff line number Diff line change @@ -103,6 +103,17 @@ <h1>Not Found</h1>
103103 even if there is no given user, give < code > error=ignore</ code > option into
104104 request.</ p >
105105
106+ < h3 > Request the user information</ h3 >
107+ < p > If you need the information of given user when the authentication has
108+ succeed, give < code > with=userinfo</ code > option into request.</ p >
109+
110+ < h3 > Response example: when < code > with=userinfo</ code > option was given</ h3 >
111+ < pre > HTTP/1.1 200 OK
112+ Vary: Accept
113+ Content-Type: application/json
114+
115+ {{ require('langdev.web.serializers').json(current_user) }}</ pre >
116+
106117 < h2 > Delete</ h2 >
107118 {% call render_raw_form('delete_app', app_key=app.key) %}
108119 < input type ="submit " value ="Delete " />
Original file line number Diff line number Diff line change @@ -87,6 +87,7 @@ def delete_app(app_key):
8787def sso (app_key , user_login ):
8888 """Simple SSO API."""
8989 app = get_app (app_key )
90+ require_userinfo = request .values .get ('with' ) == 'userinfo'
9091 error_ignored = request .values .get ('error' ) == 'ignore'
9192 success = None
9293 if User .LOGIN_PATTERN .match (user_login ):
@@ -108,5 +109,12 @@ def sso(app_key, user_login):
108109 success = False
109110 if success is None :
110111 success = app .hmac (user .password ) == request .values ['password' ]
111- return render ('thirdparty/sso' , success , success = success )
112+ if success and require_userinfo :
113+ result = user
114+ # workaround to include ``email`` attribute in the response.
115+ # see also :func:`langdev.objsimplify.transform`.
116+ g .current_user = user
117+ else :
118+ result = success
119+ return render ('thirdparty/sso' , result , success = success )
112120
You can’t perform that action at this time.
0 commit comments