Skip to content

Commit

Permalink
Ameba fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
eliasjpr committed Oct 11, 2024
1 parent acb64e5 commit a0ba29d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion spec/support/handlers_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Authly
it "returns authorization code with valid client_id and redirect_uri after user consent and includes state" do
state = "test_state"
# Initial Authorize Request
initia_response = HTTP::Client.get("#{BASE_URI}/oauth/authorize?client_id=1&redirect_uri=https://www.example.com/callback&response_type=code&state=#{state}")
HTTP::Client.get("#{BASE_URI}/oauth/authorize?client_id=1&redirect_uri=https://www.example.com/callback&response_type=code&state=#{state}")

# Consent Request
response = HTTP::Client.get("#{BASE_URI}/oauth/authorize?client_id=1&redirect_uri=https://www.example.com/callback&response_type=code&state=#{state}&consent=approved")
Expand Down
6 changes: 2 additions & 4 deletions src/authly/client.cr
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,10 @@ module Authly
end

def allowed_scopes?(client_id, scopes) : Bool
client = self.find! do |client|
client.id == client_id
end
the_client = self.find! { |client| client.id == client_id }
return false unless client

client.scopes.split(" ").all? do |scope|
the_client.scopes.split(" ").all? do |scope|
scopes.split(" ").includes?(scope)
end
rescue
Expand Down
2 changes: 1 addition & 1 deletion src/authly/handlers/response_helper.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Authly
def self.write(context, status_code, content_type = "text/plain", body = "")
context.response.status_code = status_code
context.response.content_type = content_type
context.response.write body.not_nil!.to_slice
context.response.write body
end

def self.redirect(context, location)
Expand Down

0 comments on commit a0ba29d

Please sign in to comment.