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.

142 lines
5.9 KiB

  1. .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
  2. :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
  3. :alt: License: AGPL-3
  4. ==============
  5. OAuth Provider
  6. ==============
  7. This module allows you to turn Odoo into an OAuth 2 provider.
  8. It's meant to provide the basic authentication feature, and some data access routes.
  9. But you are encouraged to create custom routes, in other modules, to give structured data for any specific need.
  10. Installation
  11. ============
  12. To install this module, you need to:
  13. #. Install the oauthlib python module
  14. #. Install the module like any other in Odoo
  15. #. For the token retrieval to work on a multi-database instance, you should add this module in the server_wide_modules list
  16. Configuration
  17. =============
  18. This module requires you to configure two things :
  19. #. The scopes are used to define restricted data access
  20. #. The clients are used to declare applications that will be allowed to request tokens and data
  21. To configure scopes, you need to:
  22. #. Go to Settings > Users > OAuth Provider Scopes
  23. #. Create some scopes:
  24. - The scope name and description will be displayed to the user on the authorization page.
  25. - The code is the value provided by the OAuth clients to request access to the scope.
  26. - The model defines which model the scope is linked to (access to user data, partners, sales orders, etc.).
  27. - The filter allows you to determine which records will be accessible through this scope. No filter means all records of the model are accessible.
  28. - The field names allows you to define which fields will be provided to the clients. An empty list only returns the id of accessible records.
  29. To configure clients, you need to:
  30. #. Go to Settings > Users > OAuth Provider Clients
  31. #. Create at least one client:
  32. - The name will be displayed to the user on the authorization page.
  33. - The client identifier is the value provided by the OAuth clients to request authorizations/tokens.
  34. - The application type adapts the process to four pre-defined profiles:
  35. - Web Application : Authorization Code Grant
  36. - Mobile Application : Implicit Grant
  37. - Legacy Application : Resource Owner Password Credentials Grant
  38. - Backend Application : User Credentials Grant (not implemented yet)
  39. - The skip authorization checkbox allows the client to skip the authorization page, and directly deliver a token without prompting the user (useful when the application is trusted).
  40. - The allowed scopes list defines which data will be accessible by this client applicaton.
  41. - The allowed redirect URIs must match the URI sent by the client, to avoid redirecting users to an unauthorized service. The first value in the list is the default redirect URI.
  42. For example, to configure an Odoo's *auth_oauth* module compatible client, you will enter these values :
  43. - Name : Anything you want
  44. - Client identifier : The identifier you want to give to this client
  45. - Application Type : Mobile Application (Odoo uses the implicit grant mode, which corresponds to the mobile application profile)
  46. - Allowed Scopes : Nothing required, but allowing access to current user's email and name is used by Odoo to fill user's information on signup
  47. - Allowed Redirect URIs : http://odoo.example.com/auth_oauth/signin
  48. Usage
  49. =====
  50. This module will allow OAuth clients to use your Odoo instance as an OAuth provider.
  51. Once configured, you must give these information to your client application :
  52. #. Client identifier : Identifies the application (to be able to check allowed scopes and redirect URIs)
  53. #. Allowed scopes : The codes of scopes allowed for this client
  54. #. URLs for the requests :
  55. - Authorization request : http://odoo.example.com/oauth2/authorize
  56. - Token request : http://odoo.example.com/oauth2/token
  57. - Token information request : http://odoo.example.com/oauth2/tokeninfo
  58. Parameters : access_token
  59. - User information request : http://odoo.example.com/oauth2/userinfo
  60. Parameters : access_token
  61. - Any other model information request (depending on the scopes) : http://odoo.example.com/oauth2/otherinfo
  62. Parameters : access_token and model
  63. For example, to configure the *auth_oauth* Odoo module as a client, you will enter these values :
  64. - Provider name : Anything you want
  65. - Client ID : The identifier of the client configured in your Odoo Provider instance
  66. - Body : Text displayed on Odoo's login page link
  67. - Authentication URL : http://odoo.example.com/oauth2/authorize
  68. - Scope : A space separated list of scope codes allowed to the client in your Odoo Provider instance
  69. - Validation URL : http://odoo.example.com/oauth2/tokeninfo
  70. - Data URL : http://odoo.example.com/oauth2/userinfo
  71. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
  72. :alt: Try me on Runbot
  73. :target: https://runbot.odoo-community.org/runbot/149/9.0
  74. Known issues / Roadmap
  75. ======================
  76. * Implement the backend application profile (client credentials grant type)
  77. * Add checkboxes on the authorization page to allow the user to disable some scopes for a token ? (I don't know if this is allowed in the OAuth protocol)
  78. Bug Tracker
  79. ===========
  80. Bugs are tracked on `GitHub Issues
  81. <https://github.com/OCA/server-tools/issues>`_. In case of trouble, please
  82. check there if your issue has already been reported. If you spotted it first,
  83. help us smashing it by providing a detailed and welcomed feedback.
  84. Credits
  85. =======
  86. Images
  87. ------
  88. * Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
  89. Contributors
  90. ------------
  91. * Sylvain Garancher <sylvain.garancher@syleam.fr>
  92. Maintainer
  93. ----------
  94. .. image:: https://odoo-community.org/logo.png
  95. :alt: Odoo Community Association
  96. :target: https://odoo-community.org
  97. This module is maintained by the OCA.
  98. OCA, or the Odoo Community Association, is a nonprofit organization whose
  99. mission is to support the collaborative development of Odoo features and
  100. promote its widespread use.
  101. To contribute to this module, please visit https://odoo-community.org.