160 specified, we will use the host from the current request. |
160 specified, we will use the host from the current request. |
161 |
161 |
162 Returns: |
162 Returns: |
163 string |
163 string |
164 """ |
164 """ |
165 req = user_service_pb.StringProto() |
165 req = user_service_pb.CreateLoginURLRequest() |
166 resp = user_service_pb.StringProto() |
166 resp = user_service_pb.CreateLoginURLResponse() |
167 req.set_value(dest_url) |
167 req.set_destination_url(dest_url) |
168 try: |
168 try: |
169 apiproxy_stub_map.MakeSyncCall('user', 'CreateLoginURL', req, resp) |
169 apiproxy_stub_map.MakeSyncCall('user', 'CreateLoginURL', req, resp) |
170 except apiproxy_errors.ApplicationError, e: |
170 except apiproxy_errors.ApplicationError, e: |
171 if (e.application_error == |
171 if (e.application_error == |
172 user_service_pb.UserServiceError.REDIRECT_URL_TOO_LONG): |
172 user_service_pb.UserServiceError.REDIRECT_URL_TOO_LONG): |
174 elif (e.application_error == |
174 elif (e.application_error == |
175 user_service_pb.UserServiceError.NOT_ALLOWED): |
175 user_service_pb.UserServiceError.NOT_ALLOWED): |
176 raise NotAllowedError |
176 raise NotAllowedError |
177 else: |
177 else: |
178 raise e |
178 raise e |
179 return resp.value() |
179 return resp.login_url() |
180 |
180 |
181 CreateLoginURL = create_login_url |
181 CreateLoginURL = create_login_url |
182 |
182 |
183 |
183 |
184 def create_logout_url(dest_url): |
184 def create_logout_url(dest_url): |
190 specified, we will use the host from the current request. |
190 specified, we will use the host from the current request. |
191 |
191 |
192 Returns: |
192 Returns: |
193 string |
193 string |
194 """ |
194 """ |
195 req = user_service_pb.StringProto() |
195 req = user_service_pb.CreateLogoutURLRequest() |
196 resp = user_service_pb.StringProto() |
196 resp = user_service_pb.CreateLogoutURLResponse() |
197 req.set_value(dest_url) |
197 req.set_destination_url(dest_url) |
198 try: |
198 try: |
199 apiproxy_stub_map.MakeSyncCall('user', 'CreateLogoutURL', req, resp) |
199 apiproxy_stub_map.MakeSyncCall('user', 'CreateLogoutURL', req, resp) |
200 except apiproxy_errors.ApplicationError, e: |
200 except apiproxy_errors.ApplicationError, e: |
201 if (e.application_error == |
201 if (e.application_error == |
202 user_service_pb.UserServiceError.REDIRECT_URL_TOO_LONG): |
202 user_service_pb.UserServiceError.REDIRECT_URL_TOO_LONG): |
203 raise RedirectTooLongError |
203 raise RedirectTooLongError |
204 else: |
204 else: |
205 raise e |
205 raise e |
206 return resp.value() |
206 return resp.logout_url() |
207 |
207 |
208 CreateLogoutURL = create_logout_url |
208 CreateLogoutURL = create_logout_url |
209 |
209 |
210 |
210 |
211 def get_current_user(): |
211 def get_current_user(): |