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.

104 lines
4.7 KiB

  1. Doorkeeper.configure do
  2. # Change the ORM that doorkeeper will use (needs plugins)
  3. orm :active_record
  4. # This block will be called to check whether the resource owner is authenticated or not.
  5. resource_owner_authenticator do
  6. current_user || redirect_to(new_user_session_url)
  7. end
  8. # If you want to restrict access to the web interface for adding oauth authorized applications, you need to declare the block below.
  9. # admin_authenticator do
  10. # # Put your admin authentication logic here.
  11. # # Example implementation:
  12. # Admin.find_by_id(session[:admin_id]) || redirect_to(new_admin_session_url)
  13. # end
  14. # Authorization Code expiration time (default 10 minutes).
  15. # authorization_code_expires_in 10.minutes
  16. # Access token expiration time (default 2 hours).
  17. # If you want to disable expiration, set this to nil.
  18. # access_token_expires_in 2.hours
  19. # Assign a custom TTL for implicit grants.
  20. # custom_access_token_expires_in do |oauth_client|
  21. # oauth_client.application.additional_settings.implicit_oauth_expiration
  22. # end
  23. # Use a custom class for generating the access token.
  24. # https://github.com/doorkeeper-gem/doorkeeper#custom-access-token-generator
  25. # access_token_generator "::Doorkeeper::JWT"
  26. # Reuse access token for the same resource owner within an application (disabled by default)
  27. # Rationale: https://github.com/doorkeeper-gem/doorkeeper/issues/383
  28. # reuse_access_token
  29. # Issue access tokens with refresh token (disabled by default)
  30. # use_refresh_token
  31. # Provide support for an owner to be assigned to each registered application (disabled by default)
  32. # Optional parameter :confirmation => true (default false) if you want to enforce ownership of
  33. # a registered application
  34. # Note: you must also run the rails g doorkeeper:application_owner generator to provide the necessary support
  35. # enable_application_owner :confirmation => false
  36. # Define access token scopes for your provider
  37. # For more information go to
  38. # https://github.com/doorkeeper-gem/doorkeeper/wiki/Using-Scopes
  39. # default_scopes :public
  40. # optional_scopes :write, :update
  41. # Change the way client credentials are retrieved from the request object.
  42. # By default it retrieves first from the `HTTP_AUTHORIZATION` header, then
  43. # falls back to the `:client_id` and `:client_secret` params from the `params` object.
  44. # Check out the wiki for more information on customization
  45. # client_credentials :from_basic, :from_params
  46. # Change the way access token is authenticated from the request object.
  47. # By default it retrieves first from the `HTTP_AUTHORIZATION` header, then
  48. # falls back to the `:access_token` or `:bearer_token` params from the `params` object.
  49. # Check out the wiki for more information on customization
  50. # access_token_methods :from_bearer_authorization, :from_access_token_param, :from_bearer_param
  51. # Change the native redirect uri for client apps
  52. # When clients register with the following redirect uri, they won't be redirected to any server and the authorization code will be displayed within the provider
  53. # The value can be any string. Use nil to disable this feature. When disabled, clients must provide a valid URL
  54. # (Similar behaviour: https://developers.google.com/accounts/docs/OAuth2InstalledApp#choosingredirecturi)
  55. #
  56. # native_redirect_uri 'urn:ietf:wg:oauth:2.0:oob'
  57. # Forces the usage of the HTTPS protocol in non-native redirect uris (enabled
  58. # by default in non-development environments). OAuth2 delegates security in
  59. # communication to the HTTPS protocol so it is wise to keep this enabled.
  60. #
  61. # force_ssl_in_redirect_uri !Rails.env.development?
  62. # Specify what grant flows are enabled in array of Strings. The valid
  63. # strings and the flows they enable are:
  64. #
  65. # "authorization_code" => Authorization Code Grant Flow
  66. # "implicit" => Implicit Grant Flow
  67. # "password" => Resource Owner Password Credentials Grant Flow
  68. # "client_credentials" => Client Credentials Grant Flow
  69. #
  70. # If not specified, Doorkeeper enables authorization_code and
  71. # client_credentials.
  72. #
  73. # implicit and password grant flows have risks that you should understand
  74. # before enabling:
  75. # http://tools.ietf.org/html/rfc6819#section-4.4.2
  76. # http://tools.ietf.org/html/rfc6819#section-4.4.3
  77. #
  78. # grant_flows %w(authorization_code client_credentials)
  79. # Under some circumstances you might want to have applications auto-approved,
  80. # so that the user skips the authorization step.
  81. # For example if dealing with a trusted application.
  82. # skip_authorization do |resource_owner, client|
  83. # client.superapp? or resource_owner.admin?
  84. # end
  85. # WWW-Authenticate Realm (default "Doorkeeper").
  86. # realm "Doorkeeper"
  87. end