• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

malach-it / boruta_auth / 954161a5b397cc94069ec938dc16fcb785e37074-PR-29

18 Jan 2025 10:28PM UTC coverage: 85.651% (-4.3%) from 89.944%
954161a5b397cc94069ec938dc16fcb785e37074-PR-29

Pull #29

github

patatoid
refactor verifiable credentials status tokens
Pull Request #29: Agent credentials PoC

188 of 304 new or added lines in 20 files covered. (61.84%)

3 existing lines in 1 file now uncovered.

1552 of 1812 relevant lines covered (85.65%)

85.85 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.0
/lib/boruta/oauth/authorization/data.ex
1
defmodule Boruta.Oauth.Authorization.Data do
2
  @moduledoc """
3
  Check against given params and return the corresponding bind data and configuration
4
  """
5

6
  alias Boruta.Oauth.Error
7
  alias Boruta.Oauth.ResourceOwner
8

9
  @spec authorize(bind_data :: String.t() | nil, bind_configuration :: String.t() | nil) ::
10
          {:ok, bind_data :: map(), bind_configuration :: map()} | {:error, reason :: String.t()}
11
  @spec authorize(
12
          bind_data :: String.t() | nil,
13
          bind_configuration :: String.t() | nil,
14
          resource_owner :: %ResourceOwner{}
15
        ) ::
16
          {:ok, bind_data :: map(), bind_configuration :: map()} | {:error, reason :: String.t()}
17
  def authorize(bind_data, bind_configuration, resource_owner \\ %ResourceOwner{sub: nil})
7✔
18

19
  def authorize(bind_data, bind_configuration, resource_owner)
20
      when is_binary(bind_data) and
21
             is_binary(bind_configuration) do
22
    with {:ok, bind_data} <- Jason.decode(bind_data),
19✔
23
         {:ok, bind_configuration} <- Jason.decode(bind_configuration) do
18✔
24
      {:ok, Map.merge(resource_owner.extra_claims, bind_data), bind_configuration}
17✔
25
    else
26
      {:error, %Jason.DecodeError{} = error} ->
27
        {:error,
28
         %Error{
29
           status: :bad_request,
30
           error: :invalid_request,
31
           error_description: "Invalid bind parameter: " <> Jason.DecodeError.message(error)
32
         }}
33
    end
34
  end
35

36
  def authorize(_bind_data, _bind_configuration, _resource_owner),
NEW
37
    do: %Error{
×
38
      status: :bad_request,
39
      error: :invalid_request,
40
      error_description: "Missing parameter bind_data or bind_configuration"
41
    }
42
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc