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


36
37
38
39
40
# File 'app/controllers/concerns/oauth_applications.rb', line 36

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

#get_created_sessionObject


24
25
26
# File 'app/controllers/concerns/oauth_applications.rb', line 24

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

#load_scopesObject


28
29
30
# File 'app/controllers/concerns/oauth_applications.rb', line 28

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

#permitted_paramsObject


32
33
34
# File 'app/controllers/concerns/oauth_applications.rb', line 32

def permitted_params
  %i{name redirect_uri scopes confidential expire_access_tokens}
end

#prepare_scopesObject


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

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

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

#set_created_sessionObject


20
21
22
# File 'app/controllers/concerns/oauth_applications.rb', line 20

def set_created_session
  session[CREATED_SESSION_KEY] = true
end