changed CHANGELOG.md
 
@@ -5,6 5,16 @@ All notable changes to this project will be documented in this file.
5
5
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) according to OAuth / OpenID connect specifications, changes may break in order to comply with those.
7
7
8
## [2.3.3] - 2024-03-20
9
10
### Removed
11
12
- removed analytics gathering repl on `boruta.gen.migration` task
13
14
### Security
15
16
- revoke previous issued tokens in case of code replay
17
8
18
## [2.3.2] - 2023-12-23
9
19
10
20
- Note that you must run the `boruta.gen.migration` task to keep your database schema up to date while upgrading to this version.
changed hex_metadata.config
 
@@ -32,6 32,7 @@
32
32
<<"lib/boruta/oauth/requests/hybrid_request.ex">>,
33
33
<<"lib/boruta/oauth/requests/revoke_request.ex">>,
34
34
<<"lib/boruta/oauth/requests/client_credentials_request.ex">>,
35
<<"lib/boruta/oauth/requests/presentation_definition_request.ex">>,
35
36
<<"lib/boruta/oauth/requests/introspect_request.ex">>,
36
37
<<"lib/boruta/oauth/responses">>,
37
38
<<"lib/boruta/oauth/responses/authorize.ex">>,
 
@@ -249,4 250,4 @@
249
250
{<<"optional">>,false},
250
251
{<<"repository">>,<<"hexpm">>},
251
252
{<<"requirement">>,<<"~> 1.0">>}]]}.
252
- {<<"version">>,<<"2.3.2">>}.
253
{<<"version">>,<<"2.3.3">>}.
changed lib/boruta/adapters/ecto/codes.ex
 
@@ -81,7 81,11 @@ defmodule Boruta.Ecto.Codes do
81
81
82
82
@impl Boruta.Oauth.Codes
83
83
def revoke(%Oauth.Token{value: value} = code) do
84
- with %Token{} = token <- repo().get_by(Token, value: value),
84
with %Token{} = previous_token <- repo().get_by(Token, previous_code: value),
85
%Token{} = token <- repo().get_by(Token, value: value),
86
{:ok, _token} <-
87
Token.revoke_changeset(previous_token)
88
|> repo().update(),
85
89
{:ok, token} <-
86
90
Token.revoke_changeset(token)
87
91
|> repo().update(),
added lib/boruta/oauth/requests/presentation_definition_request.ex
 
@@ -0,0 1,20 @@
1
defmodule Boruta.Oauth.PresentationDefinitionRequest do
2
@moduledoc """
3
Presentation definition request
4
"""
5
6
@typedoc """
7
Type representing a presentation definition request as stated in [OpenID for Verifiable Presentations - draft 20](https://openid.net/specs/openid-4-verifiable-presentations-1_0.html).
8
"""
9
@type t :: %__MODULE__{
10
client_id: String.t(),
11
redirect_uri: String.t(),
12
presentation_definition: String.t(),
13
nonce: String.t()
14
}
15
@enforce_keys [:client_id, :redirect_uri, :presentation_definition, :nonce]
16
defstruct client_id: nil,
17
redirect_uri: nil,
18
presentation_definition: nil,
19
nonce: nil
20
end
changed lib/mix/tasks/boruta.gen.migration.ex
 
@@ -29,8 29,6 @@ defmodule Mix.Tasks.Boruta.Gen.Migration do
29
29
no_umbrella!("boruta.gen.migration")
30
30
repos = parse_repo(args)
31
31
32
- register_application(repos)
33
-
34
32
Enum.map(repos, fn repo ->
35
33
ensure_repo(repo, args)
36
34
 
@@ -82,47 80,4 @@ defmodule Mix.Tasks.Boruta.Gen.Migration do
82
80
use Boruta.Migrations.<%= @migration_name %>
83
81
end
84
82
""")
85
-
86
- defp register_application(repos) do
87
- initialized? =
88
- Enum.any?(repos, fn repo ->
89
- try do
90
- Ecto.Adapters.SQL.query!(repo, "SELECT count(*) FROM oauth_clients")
91
- true
92
- rescue
93
- _ ->
94
- false
95
- end
96
- end)
97
-
98
- unless initialized? do
99
- register_application_repl()
100
- end
101
- end
102
-
103
- @dialyzer {:no_return, register_application_repl: 0}
104
- defp register_application_repl do
105
- Finch.start_link(name: RegistrationHttp)
106
- Application.ensure_started(:telemetry)
107
-
108
- IO.puts("====================")
109
- IO.puts("Please provide information about boruta package usage for statistical purposes")
110
- IO.puts("")
111
- IO.puts("The owners would be thankful if you could provide those information")
112
- IO.puts("====================")
113
- company_name = Owl.IO.input(label: "Your company name:", optional: true)
114
- company_size = Owl.IO.input(label: "Company size:", cast: :integer, optional: true)
115
- purpose = Owl.IO.input(label: "Purpose of the installation:", optional: true)
116
-
117
- Finch.build(
118
- :post,
119
- "https://getform.io/f/f3907bc0-8ae5-46d6-b1ec-9e4253e2e4f1",
120
- [{"Content-Type", "application/json"}],
121
- %{
122
- company_name: company_name,
123
- company_size: company_size,
124
- purpose: purpose
125
- } |> Jason.encode!()
126
- ) |> Finch.request(RegistrationHttp)
127
- end
128
83
end
changed mix.exs
 
@@ -5,7 5,7 @@ defmodule Boruta.MixProject do
5
5
[
6
6
name: "Boruta core",
7
7
app: :boruta,
8
- version: "2.3.2",
8
version: "2.3.3",
9
9
elixir: "~> 1.11",
10
10
elixirc_paths: elixirc_paths(Mix.env()),
11
11
start_permanent: Mix.env() == :prod,