- my $tmp_challenges = [ grep {$_->{type} eq $c_type} @$challenges ];
- die "no $c_type challenge defined in authorization\n"
- if ! scalar $tmp_challenges;
+ my $supported_types = $self->supported_challenge_types();
+
+ # preference returned by plugin!
+ foreach my $supported_type (@$supported_types) {
+ foreach my $challenge (@$challenges) {
+ next if $challenge->{type} ne $supported_type;