You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
818 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2016 SYLEAM
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. import werkzeug
  5. from openerp import http
  6. from openerp.addons import oauth_provider
  7. from openerp.addons.web.controllers.main import ensure_db
  8. class OAuth2ProviderController(
  9. oauth_provider.controllers.main.OAuth2ProviderController):
  10. @http.route(
  11. '/oauth2/public_key', type='http', auth='none', methods=['GET'])
  12. def public_key(self, client_id=None, *args, **kwargs):
  13. """ Returns the public key of the requested client """
  14. ensure_db()
  15. client = http.request.env['oauth.provider.client'].sudo().search([
  16. ('identifier', '=', client_id),
  17. ])
  18. return werkzeug.wrappers.BaseResponse(
  19. client.jwt_public_key or '', status=200)