Class: Api::OpenidConnect::ClientsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/api/openid_connect/clients_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject


26
27
28
29
30
# File 'app/controllers/api/openid_connect/clients_controller.rb', line 26

def create
  registrar = OpenIDConnect::Client::Registrar.new(request.url, params)
  client = Api::OpenidConnect::OAuthApplication.register! registrar
  render json: client.as_json(root: false)
end

#findObject


32
33
34
35
36
37
38
39
# File 'app/controllers/api/openid_connect/clients_controller.rb', line 32

def find
  client = Api::OpenidConnect::OAuthApplication.find_by(client_name: params[:client_name])
  if client
    render json: {client_id: client.client_id}
  else
    render json: {error: "Client with name #{params[:client_name]} does not exist"}
  end
end