Commit d48110d
Changed files (2)
app
controllers
oauth
spec
requests
oauth
app/controllers/oauth/clients_controller.rb
@@ -30,7 +30,7 @@ module Oauth
return if Token.revoked?(claims[:jti]) || claims.empty?
Token.find(claims[:jti])
end
- request_http_token_authentication unless @token.present?
+ return request_http_token_authentication unless @token.present?
unless Client.where(id: params[:id]).exists?
@token.revoke!
spec/requests/oauth/clients_spec.rb
@@ -119,5 +119,13 @@ RSpec.describe "/oauth/clients" do
specify { expect(response).to have_http_status(:unauthorized) }
specify { expect(access_token.reload).to be_revoked }
end
+
+ context "when an authorization header is not provided" do
+ let(:client) { create(:client) }
+
+ before { get "/oauth/clients/#{client.to_param}", headers: {} }
+
+ specify { expect(response).to have_http_status(:unauthorized) }
+ end
end
end