Module: OauthApplications

Extended by:
ActiveSupport::Concern
Included in:
Admin::ApplicationsController, Groups::Settings::ApplicationsController, Oauth::ApplicationsController
Defined in:
app/controllers/concerns/oauth_applications.rb

Constant Summary collapse

CREATED_SESSION_KEY =
:oauth_applications_created

Instance Method Summary collapse

Instance Method Details

#application_paramsObject



34
35
36
37
38
# File 'app/controllers/concerns/oauth_applications.rb', line 34

def application_params
  params
    .require(:doorkeeper_application)
    .permit(*permitted_params)
end

#get_created_sessionObject



22
23
24
# File 'app/controllers/concerns/oauth_applications.rb', line 22

def get_created_session
  session.delete(CREATED_SESSION_KEY) || false
end

#load_scopesObject



26
27
28
# File 'app/controllers/concerns/oauth_applications.rb', line 26

def load_scopes
  @scopes ||= Doorkeeper.configuration.scopes
end

#permitted_paramsObject



30
31
32
# File 'app/controllers/concerns/oauth_applications.rb', line 30

def permitted_params
  %i[name redirect_uri scopes confidential]
end

#prepare_scopesObject



12
13
14
15
16
# File 'app/controllers/concerns/oauth_applications.rb', line 12

def prepare_scopes
  scopes = params.fetch(:doorkeeper_application, {}).fetch(:scopes, nil)

  params[:doorkeeper_application][:scopes] = scopes.join(' ') if scopes
end

#set_created_sessionObject



18
19
20
# File 'app/controllers/concerns/oauth_applications.rb', line 18

def set_created_session
  session[CREATED_SESSION_KEY] = true
end