Commit 3734e074 authored by theworldbright's avatar theworldbright

Fix pronto errors

parent 98fd1807
......@@ -95,7 +95,7 @@ module Api
end
def restore_request_parameters
req = Rack::Request.new(request.env)
req = build_rack_request
req.update_param("client_id", session[:client_id])
req.update_param("redirect_uri", session[:redirect_uri])
req.update_param("response_type", response_type_as_space_seperated_values)
......@@ -104,6 +104,10 @@ module Api
req.update_param("nonce", session[:nonce])
end
def build_rack_request
Rack::Request.new(request.env)
end
def response_type_as_space_seperated_values
if session[:response_type].respond_to?(:map)
session[:response_type].map(&:to_s).join(" ")
......
......@@ -30,7 +30,7 @@ module Api
def create_code
self.code = SecureRandom.hex(32)
save
self.code
code
end
def create_access_token
......
......@@ -20,7 +20,7 @@ module Api
end
def image_uri
self.logo_uri ? self.logo_uri : "branding/logos/asterisk.png"
logo_uri ? logo_uri : "branding/logos/asterisk.png"
end
class << self
......
class Api::V0::BasePresenter
module Api
module V0
class BasePresenter
end
end
end
......@@ -109,7 +109,8 @@ module Diaspora
config.action_mailer.asset_host = AppConfig.pod_uri.to_s
config.middleware.use Rack::OAuth2::Server::Resource::Bearer, "OpenID Connect" do |req|
Api::OpenidConnect::OAuthAccessToken.valid(Time.zone.now.utc).find_by(token: req.access_token) || req.invalid_token!
Api::OpenidConnect::OAuthAccessToken
.valid(Time.zone.now.utc).find_by(token: req.access_token) || req.invalid_token!
end
end
end
......@@ -9,7 +9,7 @@ o_auth_query_params = %i(
Given /^I send a post request from that client to the implicit flow authorization endpoint$/ do
client_json = JSON.parse(last_response.body)
visit new_api_openid_connect_authorization_path +
"?client_id=#{client_json["client_id"]}&#{o_auth_query_params}"
"?client_id=#{client_json['client_id']}&#{o_auth_query_params}"
end
Given /^I send a post request from that client to the implicit flow authorization endpoint using a invalid client id/ do
......
......@@ -8,14 +8,14 @@ module Api
@app = Rack::OAuth2::Server::Token.new do |req, res|
o_auth_app = retrieve_client(req)
if app_valid?(o_auth_app, req)
handle_flows(o_auth_app, req, res)
handle_flows(req, res)
else
req.invalid_client!
end
end
end
def handle_flows(o_auth_app, req, res)
def handle_flows(req, res)
case req.grant_type
when :refresh_token
handle_refresh_flow(req, res)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment