Class: OauthIssuersController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/oauth_issuers_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



19
20
21
22
23
24
25
# File 'app/controllers/oauth_issuers_controller.rb', line 19

def create
  attrs = {:identifier  => params[:issuer_id],
           :hmac_secret => params[:issuer_secret]}

  issuer = Rack::OAuth2::Server.register_issuer(attrs)
  render :json => issuer.to_json
end

#destroyObject



27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/oauth_issuers_controller.rb', line 27

def destroy
  issuer = Rack::OAuth2::Server.get_issuer(params[:id])

  if issuer
    issuer.destroy
    render :nothing => true, :status => :ok
  else
    render :nothing => true, :status => :not_found
  end
end

#indexObject

oauth_required :only => [:create, :destroy]



4
5
6
7
# File 'app/controllers/oauth_issuers_controller.rb', line 4

def index
  issuers = Rack::OAuth2::Server::Issuer.collection.find.entries
  render :json => issuers.to_json
end

#showObject



9
10
11
12
13
14
15
16
17
# File 'app/controllers/oauth_issuers_controller.rb', line 9

def show
  issuer = Rack::OAuth2::Server.get_issuer(params[:id])

  if issuer
    render :json => issuer.to_json
  else
    render :nothing => true, :status => :not_found
  end
end