Class: OAuth2::Server::Flows::WebServer

Inherits:
Object
  • Object
show all
Includes:
Attributes
Defined in:
lib/oauth2/server/flows/web_server.rb

Instance Method Summary collapse

Instance Method Details

#access_tokenObject

TODO



46
47
48
49
# File 'lib/oauth2/server/flows/web_server.rb', line 46

def access_token
  # TODO: verify that type == "web_sever"
  # TODO: verify that redirect_uri == ticket.redirect_uri
end

#create_ticket(&block) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/oauth2/server/flows/web_server.rb', line 13

def create_ticket(&block)
  if block_given?
    callbacks[:create_ticket] = block
  else
    block.call
  end
end

#grant_authorizationObject

If the user authorized the client, we create a verification code. Then we redirect back with the verification code or an error message.



40
41
42
43
# File 'lib/oauth2/server/flows/web_server.rb', line 40

def grant_authorization
  create_verification_code if authorized?
  redirect_back
end

#request_authorizationObject

This method will create a ticket for the client and try to identify and verify the resource owner. If those two steps succeed, it displays the authorization form.



28
29
30
31
32
# File 'lib/oauth2/server/flows/web_server.rb', line 28

def request_authorization
  create_ticket
  verify_resource_owner or return
  render_authorize_form
end