Class: OohAuth::Tokens
- Inherits:
-
Application
- Object
- Merb::Controller
- Application
- OohAuth::Tokens
- Defined in:
- app/controllers/tokens.rb
Instance Method Summary collapse
-
#create(token) ⇒ Object
Activates an authentication receipt, converting it into a token the authenticating client can use in future requests.
-
#index ⇒ Object
Main action used for starting the authorisation process (desktop clients) and finishing it (web clients).
- #new ⇒ Object
Instance Method Details
#create(token) ⇒ Object
Activates an authentication receipt, converting it into a token the authenticating client can use in future requests.
50 51 52 53 54 55 56 57 58 59 |
# File 'app/controllers/tokens.rb', line 50 def create(token) only_provides :html commit = (params[:commit]=="allow") # Did they click the allow or the deny button? ENQUIRING MINDS NEED TO KNOW! raise NotFound unless @token = OohAuth::Token.get_token(request.token) # The oauth_token is now in the post body. raise NotFound unless @authenticating_client = @token.authenticating_client # Stop right there, criminal scum. @activated = @token.activate!(session.user, token[:expires], token[:permissions]) if commit redirect("#{request.callback}#{(request.callback["?"])? "&" : "?"}oauth_token=#{@token.token_key}") if commit and request.callback # the callback is in the post body display @token, :create end |
#index ⇒ Object
Main action used for starting the authorisation process (desktop clients) and finishing it (web clients)
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/tokens.rb', line 27 def index raise NotAcceptable unless @authenticating_client = request.authenticating_client if @token = request.authentication_token # If client and request key, give the activated token if it was activated. raise NotAcceptable unless @token.authenticating_client == @authenticating_client else # Generate a request key @token = OohAuth::Token.create_request_key(@authenticating_client) end # # Okay, no error raised. Gogo render. display @token, :show, :layout=>false end |