Class: SsoProvyder::AuthController

Inherits:
ApplicationController show all
Defined in:
app/controllers/sso_provyder/auth_controller.rb

Overview

parent to auth web and auth api

Direct Known Subclasses

AuthApiController, AuthWebController

Instance Method Summary collapse

Instance Method Details

#authenticate_appObject



3
4
5
6
# File 'app/controllers/sso_provyder/auth_controller.rb', line 3

def authenticate_app
  args = { :app_id => params[:client_id], :app_secret => params[:client_secret] }
  authenticate_application(args, "Client")
end

#authenticate_application(args = {}, role = "Client") ⇒ Object

role can be “Client” (Direct client) or “Api client” (Client calling the client)



10
11
12
13
14
15
16
17
18
# File 'app/controllers/sso_provyder/auth_controller.rb', line 10

def authenticate_application(args = {}, role = "Client")
  @application = SsoProvyder::Client.authenticate(args[:app_id], args[:app_secret])

  unless !!@application
    render :json => {:error => "Could not find #{role} application"}
    return
  end
  
end