feat: update custom_rdap_servers.example.yaml

This commit is contained in:
Maël Gangloff 2024-11-02 16:11:41 +01:00
parent c7a50eed65
commit 79a5a1d35a
No known key found for this signature in database
GPG Key ID: 11FDC81C24A7F629
6 changed files with 48 additions and 44 deletions

View File

@ -44,11 +44,13 @@
[ [ "ga" ], [ "https://rdap.nic.ga/" ] ],
[ [ "ht" ], [ "https://rdap.nic.ht/" ] ],
[ [ "in" ], [ "https://rdap.registry.in/" ] ],
[ [ "ke" ], [ "https://rdap.kenic.or.ke/" ] ],
[ [ "kn" ], [ "https://rdap.nic.kn/" ] ],
[ [ "li" ], [ "https://rdap.nic.li/" ] ],
[ [ "ml" ], [ "https://rdap.nic.ml/" ] ],
[ [ "mr" ], [ "https://rdap.nic.mr/" ] ],
[ [ "mz" ], [ "https://rdap.nic.mz/" ] ],
[ [ "ng" ], [ "https://rdap.nic.net.ng/" ] ],
[ [ "pr" ], [ "https://rdap.afilias-srs.net/rdap/pr/" ] ],
[ [ "sb" ], [ "https://rdap.nic.sb/" ] ],
[ [ "sn" ], [ "https://rdap.nic.sn/" ] ],

View File

@ -79,7 +79,7 @@ abstract class AbstractProvider
/**
* @throws \Exception when the registrar denies the authentication
*/
abstract public function assertAuthentication(): void; // TODO use dedicated exception type
abstract protected function assertAuthentication(): void; // TODO use dedicated exception type
abstract public function orderDomain(Domain $domain, bool $dryRun): void;

View File

@ -177,7 +177,9 @@ class AutodnsProvider extends AbstractProvider
}
if (
empty($username) || empty($password)
!is_string($username) || empty($username)
|| !is_string($password) || empty($password)
|| true !== $authData['ownerConfirm']
) {
throw new BadRequestHttpException('Bad authData schema');
}
@ -211,7 +213,7 @@ class AutodnsProvider extends AbstractProvider
/**
* @throws TransportExceptionInterface
*/
public function assertAuthentication(): void
protected function assertAuthentication(): void
{
try {
$response = $this->client->request(

View File

@ -108,7 +108,7 @@ class GandiProvider extends AbstractProvider
/**
* @throws TransportExceptionInterface
*/
public function assertAuthentication(): void
protected function assertAuthentication(): void
{
$response = $this->client->request('GET', '/v5/organization/user-info', (new HttpOptions())
->setAuthBearer($this->authData['token'])

View File

@ -21,8 +21,11 @@ class NamecheapProvider extends AbstractProvider
public const SANDBOX_BASE_URL = 'https://api.sandbox.namecheap.com/xml.response';
public function __construct(CacheItemPoolInterface $cacheItemPool, private HttpClientInterface $client, private readonly string $outgoingIp)
{
public function __construct(
CacheItemPoolInterface $cacheItemPool,
private readonly HttpClientInterface $client,
private readonly string $outgoingIp,
) {
parent::__construct($cacheItemPool);
}
@ -32,11 +35,10 @@ class NamecheapProvider extends AbstractProvider
*/
public function orderDomain(Domain $domain, $dryRun): void
{
$addressesRes = $this->call('namecheap.users.address.getList', [], $dryRun);
$addresses = $addressesRes->AddressGetListResult->List;
$addresses = $this->call('namecheap.users.address.getList', [], $dryRun)->AddressGetListResult->List;
if (count($addresses) < 1) {
throw new \Exception('Namecheap account requires at least one address to purchase a domain');
throw new BadRequestHttpException('Namecheap account requires at least one address to purchase a domain');
}
$addressId = (string) $addresses->attributes()['AddressId'];
@ -54,10 +56,11 @@ class NamecheapProvider extends AbstractProvider
self::mergePrefixKeys('AuxBilling', $address, $domainAddresses);
$this->call('namecheap.domains.create', array_merge([
'DomainName' => $domain->getLdhName(),
'Years' => 1,
'AddFreeWhoisguard' => 'yes',
'WGEnabled' => 'yes',
'DomainName' => $domain->getLdhName(), // Domain name to register
'Years' => 1, // Number of years to register
'AddFreeWhoisguard' => 'yes', // Adds free domain privacy for the domain
'WGEnabled' => 'yes', // Enables free domain privacy for the domain
'IsPremiumDomain' => 'False',
], $domainAddresses), $dryRun);
}
@ -100,13 +103,10 @@ class NamecheapProvider extends AbstractProvider
public function verifySpecificAuthData(array $authData): array
{
$apiUser = $authData['ApiUser'];
$apiKey = $authData['ApiKey'];
if (!is_string($apiUser) || empty($apiUser)
|| !is_string($apiKey) || empty($apiKey)
) {
throw new BadRequestHttpException('Bad authData schema');
foreach (['ApiUser', 'ApiKey'] as $key) {
if (empty($authData[$key]) || !is_string($authData[$key])) {
throw new BadRequestHttpException("Bad authData schema: missing or invalid '$key'");
}
}
return [
@ -121,9 +121,13 @@ class NamecheapProvider extends AbstractProvider
* @throws RedirectionExceptionInterface
* @throws ClientExceptionInterface
*/
public function assertAuthentication(): void
protected function assertAuthentication(): void
{
$this->call('namecheap.domains.gettldlist', [], false);
$addresses = $this->call('namecheap.users.address.getList', [], false)->AddressGetListResult->List;
if (count($addresses) < 1) {
throw new BadRequestHttpException('Namecheap account requires at least one address to purchase a domain');
}
}
/**

View File

@ -133,34 +133,30 @@ class OvhProvider extends AbstractProvider
*/
public function verifySpecificAuthData(array $authData): array
{
$appKey = $authData['appKey'];
$appSecret = $authData['appSecret'];
$apiEndpoint = $authData['apiEndpoint'];
$consumerKey = $authData['consumerKey'];
$ovhSubsidiary = $authData['ovhSubsidiary'];
$pricingMode = $authData['pricingMode'];
if (!is_string($appKey) || empty($appKey)
|| !is_string($appSecret) || empty($appSecret)
|| !is_string($consumerKey) || empty($consumerKey)
|| !is_string($apiEndpoint) || empty($apiEndpoint)
|| !is_string($ovhSubsidiary) || empty($ovhSubsidiary)
|| !is_string($pricingMode) || empty($pricingMode)
) {
throw new BadRequestHttpException('Bad authData schema');
foreach ([
'appKey',
'appSecret',
'apiEndpoint',
'consumerKey',
'ovhSubsidiary',
'pricingMode',
] as $key) {
if (empty($authData[$key]) || !is_string($authData[$key])) {
throw new BadRequestHttpException("Bad authData schema: missing or invalid '$key'");
}
}
return [
'appKey' => $appKey,
'appSecret' => $appSecret,
'apiEndpoint' => $apiEndpoint,
'consumerKey' => $consumerKey,
'ovhSubsidiary' => $ovhSubsidiary,
'pricingMode' => $pricingMode,
'appKey' => $authData['appKey'],
'appSecret' => $authData['appSecret'],
'apiEndpoint' => $authData['apiEndpoint'],
'consumerKey' => $authData['consumerKey'],
'ovhSubsidiary' => $authData['ovhSubsidiary'],
'pricingMode' => $authData['pricingMode'],
];
}
public function assertAuthentication(): void
protected function assertAuthentication(): void
{
$conn = new Api(
$this->authData['appKey'],