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",
18 description
=> "ACME challenge type.",
22 description
=> "Flag to disable the config.",
26 nodes
=> get_standard_option
('pve-node-list', { optional
=> 1 }),
35 my ($class, $filename, $raw) = @_;
37 my $cfg = $class->SUPER::parse_config
($filename, $raw);
38 my $ids = $cfg->{ids
};
40 # make sure we have a standalone plugin definition as fallback!
41 if (!$ids->{standalone
} || $ids->{standalone
}->{type
} ne 'standalone') {
42 $ids->{standalone
} = {
51 my ($self, $type, $key, $value) = @_;
54 $value = MIME
::Base64
::encode_base64url
($value);
61 my ($self, $type, $key, $value) = @_;
64 $value = MIME
::Base64
::decode_base64url
($value);
70 sub supported_challenge_types
{
74 sub extract_challenge
{
75 my ($self, $challenges) = @_;
77 die "no challenges defined\n" if !$challenges;
79 my $supported_types = $self->supported_challenge_types();
81 # preference returned by plugin!
82 foreach my $supported_type (@$supported_types) {
83 foreach my $challenge (@$challenges) {
84 next if $challenge->{type
} ne $supported_type;
90 die "plugin does not support any of the requested challenge types\n";
93 # acme => PVE::ACME instance
94 # auth => authorization object returned by ACME server
96 # plugin => plugin config data
97 # alias => optional domain alias
99 # needs to set $data->{url} to URL of the challenge which has been set up
100 # can set other $data keys needed by teardown sub
102 my ($self, $acme, $auth, $data) = @_;
104 die "implement me\n";
109 my ($self, $acme, $auth, $data) = @_;
111 die "implement me\n";