2022-03-08 19:42:28 +01:00
|
|
|
%echo "#!/usr/bin/env perl"
|
2022-07-05 22:07:23 +02:00
|
|
|
# retrieve and modify (if no argument) well-known file
|
2022-03-08 19:42:28 +01:00
|
|
|
|
|
|
|
use HTTP::Tiny;
|
|
|
|
use JSON qw(from_json to_json);
|
|
|
|
|
|
|
|
my $baseUrl = 'https://%%domain_name_eth0/';
|
|
|
|
|
|
|
|
my $response = HTTP::Tiny->new->get('http://localhost/.well-known/openid-configuration');
|
|
|
|
|
|
|
|
die "Failed!\n" unless $response->{success};
|
|
|
|
|
|
|
|
my $json = from_json($response->{content});
|
2022-07-05 22:07:23 +02:00
|
|
|
%echo "$num_args = $#ARGV + 1;"
|
|
|
|
|
|
|
|
if ($num_args == 0) {
|
|
|
|
$json->{token_endpoint} = $baseUrl . 'oauth2/token';
|
|
|
|
$json->{userinfo_endpoint} = $baseUrl . 'oauth2/userinfo';
|
|
|
|
$json->{jwks_uri} = $baseUrl . 'oauth2/jwks';
|
|
|
|
}
|
2022-03-08 19:42:28 +01:00
|
|
|
printf to_json($json) . "\n";
|