1 package PVE
::ACME
::Challenge
;
6 use PVE
::JSONSchema
qw(get_standard_option);
8 use base
qw(PVE::SectionConfig);
11 additionalProperties
=> 0,
14 description
=> "ACME Plugin ID name",
16 format
=> 'pve-configid',
19 description
=> "ACME challenge type.",
23 description
=> "Flag to disable the config.",
27 nodes
=> get_standard_option
('pve-node-list', { optional
=> 1 }),
36 my ($class, $filename, $raw) = @_;
38 my $cfg = $class->SUPER::parse_config
($filename, $raw);
39 my $ids = $cfg->{ids
};
41 # make sure we have a standalone plugin definition as fallback!
42 if (!$ids->{standalone
} || $ids->{standalone
}->{type
} ne 'standalone') {
43 $ids->{standalone
} = {
52 my ($self, $type, $key, $value) = @_;
55 $value = MIME
::Base64
::encode_base64url
($value);
62 my ($self, $type, $key, $value) = @_;
65 $value = MIME
::Base64
::decode_base64url
($value);
71 sub supported_challenge_types
{
75 sub extract_challenge
{
76 my ($self, $challenges) = @_;
78 die "no challenges defined\n" if !$challenges;
80 my $supported_types = $self->supported_challenge_types();
82 # preference returned by plugin!
83 foreach my $supported_type (@$supported_types) {
84 foreach my $challenge (@$challenges) {
85 next if $challenge->{type
} ne $supported_type;
91 die "plugin does not support any of the requested challenge types\n";
94 # acme => PVE::ACME instance
95 # auth => authorization object returned by ACME server
97 # plugin => plugin config data
98 # alias => optional domain alias
100 # needs to set $data->{url} to URL of the challenge which has been set up
101 # can set other $data keys needed by teardown sub
103 my ($self, $acme, $auth, $data) = @_;
105 die "implement me\n";
110 my ($self, $acme, $auth, $data) = @_;
112 die "implement me\n";