]> git.openstreetmap.org Git - rails.git/blobdiff - lib/oauth.rb
Add openid connect support using doorkeeper-openid_connect gem
[rails.git] / lib / oauth.rb
index 7ff2ba8b4358428c04814a899d5e8563be0b971b..0456c08732a927eb1c944f74b5ccc969f9971ce4 100644 (file)
@@ -1,6 +1,7 @@
 module Oauth
   SCOPES = %w[read_prefs write_prefs write_diary write_api read_gpx write_gpx write_notes].freeze
   PRIVILEGED_SCOPES = %w[read_email skip_authorization].freeze
+  OAUTH2_SCOPES = %w[openid].freeze
 
   class Scope
     attr_reader :name
@@ -14,9 +15,10 @@ module Oauth
     end
   end
 
-  def self.scopes(privileged: false)
+  def self.scopes(oauth2: false, privileged: false)
     scopes = SCOPES
     scopes += PRIVILEGED_SCOPES if privileged
+    scopes += OAUTH2_SCOPES if oauth2
     scopes.collect { |s| Scope.new(s) }
   end
 end