Skip to content

Commit

Permalink
fix: correct deprioritize_none_alg/1
Browse files Browse the repository at this point in the history
Previously, it would return only two items: the first non-`none`
algorithm, and `none`. This doesn't appear to be what we want: instead,
we want the full list in their regular order, but with `none` at the
end.

Related to #297, as the root cause of
the crash I was seeing was the the first algorithm in the authorizer's
list wasn't supported by JOSE, so we went immediately to `none`.
  • Loading branch information
paulswartz authored and maennchen committed Dec 7, 2023
1 parent 9bfc399 commit 2a53282
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/oidcc_authorization.erl
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,14 @@ essential_params(QueryParams) ->

-spec deprioritize_none_alg(Algorithms :: [binary()]) -> [binary()].
deprioritize_none_alg(Algorithms) ->
lists:usort(
{WithNone, WithoutNone} = lists:partition(
fun
(<<"none">>, _B) -> false;
(_A, <<"none">>) -> true;
(_A, _B) -> true
(<<"none">>) -> true;
(_) -> false
end,
Algorithms
).
),
WithoutNone ++ WithNone.

-spec random_string(Bytes :: pos_integer()) -> binary().
random_string(Bytes) ->
Expand Down
2 changes: 1 addition & 1 deletion test/oidcc_authorization_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ create_redirect_url_with_request_object_and_max_clock_skew_test() ->
request_parameter_supported = true,
request_object_signing_alg_values_supported = [
<<"none">>,
<<"PS256">>,
<<"HS256">>,
<<"RS256">>,
<<"PS256">>,
<<"ES256">>,
<<"EdDSA">>
],
Expand Down

0 comments on commit 2a53282

Please sign in to comment.