Class: SsoProvyder::AuthApiController

Inherits:
AuthController show all
Defined in:
app/controllers/sso_provyder/auth_api_controller.rb

Instance Method Summary collapse

Methods inherited from AuthController

#authenticate_app, #authenticate_application

Instance Method Details

#valid_current_api_clientObject

is called by sso_api_clyent to check a client app is registered in sso_provyder



9
10
11
# File 'app/controllers/sso_provyder/auth_api_controller.rb', line 9

def valid_current_api_client
  render :json => { :app =>  application_api_json(@application) }
end

#valid_current_api_client_userObject

is called by sso_api_clyent to check a client app is registered in sso_provyder and identify the current_user



17
18
19
20
21
22
23
24
25
# File 'app/controllers/sso_provyder/auth_api_controller.rb', line 17

def valid_current_api_client_user
  access_grant = SsoProvyder::AccessGrant.authenticate_with({:access_token => params[:access_token], :client_id => @application.id})
  if access_grant.nil?
    render :json => {:error => "Could not authenticate Client App User"}
    return
  end
  
  render :json => { :app => application_api_json(@application), :user =>  user_api_json(access_grant.user) }
end