Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OIDC authentication #1130

Merged
merged 4 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
274 changes: 274 additions & 0 deletions src/ComDiadocApi.cs

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions src/Constants/ObsoleteReasons.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ο»Ώnamespace Diadoc.Api.Constants
{
internal static class ObsoleteReasons
{
public const string UseAuthTokenOverload = "Use overload with authToken argument";
}
}
145 changes: 145 additions & 0 deletions src/DiadocApi.Async.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,33 +131,68 @@
public Task<OrganizationList> GetOrganizationsByInnKppAsync(string inn, string kpp, bool includeRelations = false)
{
if (inn == null) throw new ArgumentNullException("inn");
return diadocHttpApi.GetOrganizationsByInnKppAsync(inn, kpp, includeRelations);

Check warning on line 134 in src/DiadocApi.Async.cs

View workflow job for this annotation

GitHub Actions / build_and_test

'DiadocHttpApi.GetOrganizationsByInnKppAsync(string, string, bool)' is obsolete: 'Use overload with authToken argument'
}

public Task<OrganizationList> GetOrganizationsByInnKppAsync(string authToken, string inn, string kpp, bool includeRelations = false)
{
if (authToken == null) throw new ArgumentNullException(nameof(authToken));
if (inn == null) throw new ArgumentNullException(nameof(inn));
return diadocHttpApi.GetOrganizationsByInnKppAsync(authToken, inn, kpp, includeRelations);
}

public Task<Organization> GetOrganizationByIdAsync(string orgId)
{
if (orgId == null) throw new ArgumentNullException("orgId");
return diadocHttpApi.GetOrganizationByIdAsync(orgId);

Check warning on line 147 in src/DiadocApi.Async.cs

View workflow job for this annotation

GitHub Actions / build_and_test

'DiadocHttpApi.GetOrganizationByIdAsync(string)' is obsolete: 'Use overload with authToken argument'
}

public Task<Organization> GetOrganizationByIdAsync(string authToken, string orgId)
{
if (authToken == null) throw new ArgumentNullException(nameof(authToken));
if (orgId == null) throw new ArgumentNullException(nameof(orgId));
return diadocHttpApi.GetOrganizationByIdAsync(authToken, orgId);
}

public Task<Organization> GetOrganizationByBoxIdAsync(string boxId)
{
if (boxId == null) throw new ArgumentNullException("boxId");
return diadocHttpApi.GetOrganizationByBoxIdAsync(boxId);

Check warning on line 160 in src/DiadocApi.Async.cs

View workflow job for this annotation

GitHub Actions / build_and_test

'DiadocHttpApi.GetOrganizationByBoxIdAsync(string)' is obsolete: 'Use overload with authToken argument'
}

public Task<Organization> GetOrganizationByBoxIdAsync(string authToken, string boxId)
{
if (authToken == null) throw new ArgumentNullException(nameof(authToken));
if (boxId == null) throw new ArgumentNullException(nameof(boxId));
return diadocHttpApi.GetOrganizationByBoxIdAsync(authToken, boxId);
}

public Task<Organization> GetOrganizationByFnsParticipantIdAsync(string fnsParticipantId)
{
if (fnsParticipantId == null) throw new ArgumentException("fnsParticipantId");
return diadocHttpApi.GetOrganizationByFnsParticipantIdAsync(fnsParticipantId);

Check warning on line 173 in src/DiadocApi.Async.cs

View workflow job for this annotation

GitHub Actions / build_and_test

'DiadocHttpApi.GetOrganizationByFnsParticipantIdAsync(string)' is obsolete: 'Use overload with authToken argument'
}

public Task<Organization> GetOrganizationByFnsParticipantIdAsync(string authToken, string fnsParticipantId)
{
if (authToken == null) throw new ArgumentNullException(nameof(authToken));
if (fnsParticipantId == null) throw new ArgumentNullException(nameof(fnsParticipantId));
return diadocHttpApi.GetOrganizationByFnsParticipantIdAsync(authToken, fnsParticipantId);
}

public Task<Organization> GetOrganizationByInnKppAsync(string inn, string kpp)
{
if (inn == null) throw new ArgumentException("inn");
return diadocHttpApi.GetOrganizationByInnKppAsync(inn, kpp);

Check warning on line 186 in src/DiadocApi.Async.cs

View workflow job for this annotation

GitHub Actions / build_and_test

'DiadocHttpApi.GetOrganizationByInnKppAsync(string, string)' is obsolete: 'Use overload with authToken argument'
}

public Task<Organization> GetOrganizationByInnKppAsync(string authToken, string inn, string kpp)
{
if (authToken == null) throw new ArgumentNullException(nameof(authToken));
if (inn == null) throw new ArgumentNullException(nameof(inn));
return diadocHttpApi.GetOrganizationByInnKppAsync(authToken, inn, kpp);
}

public Task<RoamingOperatorList> GetRoamingOperatorsAsync(string authToken, string boxId)
{
return diadocHttpApi.GetRoamingOperatorsAsync(authToken, boxId);
Expand All @@ -166,9 +201,16 @@
public Task<Box> GetBoxAsync(string boxId)
{
if (boxId == null) throw new ArgumentNullException("boxId");
return diadocHttpApi.GetBoxAsync(boxId);

Check warning on line 204 in src/DiadocApi.Async.cs

View workflow job for this annotation

GitHub Actions / build_and_test

'DiadocHttpApi.GetBoxAsync(string)' is obsolete: 'Use overload with authToken argument'
}

public Task<Box> GetBoxAsync(string authToken, string boxId)
{
if (authToken == null) throw new ArgumentNullException(nameof(authToken));
if (boxId == null) throw new ArgumentNullException(nameof(boxId));
return diadocHttpApi.GetBoxAsync(authToken, boxId);
}

public Task<Department> GetDepartmentAsync(string authToken, string orgId, string departmentId)
{
if (authToken == null) throw new ArgumentNullException("authToken");
Expand Down Expand Up @@ -836,74 +878,158 @@

public Task<RussianAddress> ParseRussianAddressAsync(string address)
{
return diadocHttpApi.ParseRussianAddressAsync(address);

Check warning on line 881 in src/DiadocApi.Async.cs

View workflow job for this annotation

GitHub Actions / build_and_test

'DiadocHttpApi.ParseRussianAddressAsync(string)' is obsolete: 'Use overload with authToken argument'
}

public Task<RussianAddress> ParseRussianAddressAsync(string authToken, string address)
{
if (authToken == null) throw new ArgumentNullException(nameof(authToken));
return diadocHttpApi.ParseRussianAddressAsync(authToken, address);
}

public Task<InvoiceInfo> ParseInvoiceXmlAsync(byte[] invoiceXmlContent)
{
return diadocHttpApi.ParseInvoiceXmlAsync(invoiceXmlContent);

Check warning on line 892 in src/DiadocApi.Async.cs

View workflow job for this annotation

GitHub Actions / build_and_test

'DiadocHttpApi.ParseInvoiceXmlAsync(byte[])' is obsolete: 'Use overload with authToken argument'
}

public Task<InvoiceInfo> ParseInvoiceXmlAsync(string authToken, byte[] invoiceXmlContent)
{
if (authToken == null) throw new ArgumentNullException(nameof(authToken));
return diadocHttpApi.ParseInvoiceXmlAsync(authToken, invoiceXmlContent);
}

public Task<Torg12SellerTitleInfo> ParseTorg12SellerTitleXmlAsync(byte[] xmlContent)
{
return diadocHttpApi.ParseTorg12SellerTitleXmlAsync(xmlContent);
}

public Task<Torg12SellerTitleInfo> ParseTorg12SellerTitleXmlAsync(string authToken, byte[] xmlContent)
{
if (authToken == null) throw new ArgumentNullException(nameof(authToken));
return diadocHttpApi.ParseTorg12SellerTitleXmlAsync(authToken, xmlContent);
}

public Task<Torg12BuyerTitleInfo> ParseTorg12BuyerTitleXmlAsync(byte[] xmlContent)
{
return diadocHttpApi.ParseTorg12BuyerTitleXmlAsync(xmlContent);
}

public Task<Torg12BuyerTitleInfo> ParseTorg12BuyerTitleXmlAsync(string authToken, byte[] xmlContent)
{
if (authToken == null) throw new ArgumentNullException(nameof(authToken));
return diadocHttpApi.ParseTorg12BuyerTitleXmlAsync(authToken, xmlContent);
}

public Task<TovTorgSellerTitleInfo> ParseTovTorg551SellerTitleXmlAsync(byte[] xmlContent)
{
return diadocHttpApi.ParseTovTorg551SellerTitleXmlAsync(xmlContent);
}

public Task<TovTorgSellerTitleInfo> ParseTovTorg551SellerTitleXmlAsync(string authToken, byte[] xmlContent)
{
if (authToken == null) throw new ArgumentNullException(nameof(authToken));
return diadocHttpApi.ParseTovTorg551SellerTitleXmlAsync(authToken, xmlContent);
}

public Task<TovTorgBuyerTitleInfo> ParseTovTorg551BuyerTitleXmlAsync(byte[] xmlContent)
{
return diadocHttpApi.ParseTovTorg551BuyerTitleXmlAsync(xmlContent);
}

public Task<TovTorgBuyerTitleInfo> ParseTovTorg551BuyerTitleXmlAsync(string authToken, byte[] xmlContent)
{
if (authToken == null) throw new ArgumentNullException(nameof(authToken));
return diadocHttpApi.ParseTovTorg551BuyerTitleXmlAsync(authToken, xmlContent);
}

public Task<AcceptanceCertificateSellerTitleInfo> ParseAcceptanceCertificateSellerTitleXmlAsync(byte[] xmlContent)
{
return diadocHttpApi.ParseAcceptanceCertificateSellerTitleXmlAsync(xmlContent);
}

public Task<AcceptanceCertificateSellerTitleInfo> ParseAcceptanceCertificateSellerTitleXmlAsync(string authToken, byte[] xmlContent)
{
if (authToken == null) throw new ArgumentNullException(nameof(authToken));
return diadocHttpApi.ParseAcceptanceCertificateSellerTitleXmlAsync(authToken, xmlContent);
}

public Task<AcceptanceCertificateBuyerTitleInfo> ParseAcceptanceCertificateBuyerTitleXmlAsync(byte[] xmlContent)
{
return diadocHttpApi.ParseAcceptanceCertificateBuyerTitleXmlAsync(xmlContent);
}

public Task<AcceptanceCertificateBuyerTitleInfo> ParseAcceptanceCertificateBuyerTitleXmlAsync(string authToken, byte[] xmlContent)
{
if (authToken == null) throw new ArgumentNullException(nameof(authToken));
return diadocHttpApi.ParseAcceptanceCertificateBuyerTitleXmlAsync(authToken, xmlContent);
}

public Task<AcceptanceCertificate552SellerTitleInfo> ParseAcceptanceCertificate552SellerTitleXmlAsync(byte[] xmlContent)
{
return diadocHttpApi.ParseAcceptanceCertificate552SellerTitleXmlAsync(xmlContent);
}

public Task<AcceptanceCertificate552SellerTitleInfo> ParseAcceptanceCertificate552SellerTitleXmlAsync(string authToken, byte[] xmlContent)
{
if (authToken == null) throw new ArgumentNullException(nameof(authToken));
return diadocHttpApi.ParseAcceptanceCertificate552SellerTitleXmlAsync(authToken, xmlContent);
}

public Task<AcceptanceCertificate552BuyerTitleInfo> ParseAcceptanceCertificate552BuyerTitleXmlAsync(byte[] xmlContent)
{
return diadocHttpApi.ParseAcceptanceCertificate552BuyerTitleXmlAsync(xmlContent);
}

public Task<AcceptanceCertificate552BuyerTitleInfo> ParseAcceptanceCertificate552BuyerTitleXmlAsync(string authToken, byte[] xmlContent)
{
if (authToken == null) throw new ArgumentNullException(nameof(authToken));
return diadocHttpApi.ParseAcceptanceCertificate552BuyerTitleXmlAsync(authToken, xmlContent);
}

public Task<UniversalTransferDocumentSellerTitleInfo> ParseUniversalTransferDocumentSellerTitleXmlAsync(byte[] xmlContent, string documentVersion = DefaultDocumentVersions.Utd)
{
return diadocHttpApi.ParseUniversalTransferDocumentSellerTitleXmlAsync(xmlContent, documentVersion);
}

public Task<UniversalTransferDocumentSellerTitleInfo> ParseUniversalTransferDocumentSellerTitleXmlAsync(string authToken, byte[] xmlContent, string documentVersion = DefaultDocumentVersions.Utd)
{
if (authToken == null) throw new ArgumentNullException(nameof(authToken));
return diadocHttpApi.ParseUniversalTransferDocumentSellerTitleXmlAsync(authToken, xmlContent, documentVersion);
}

public Task<UniversalTransferDocumentBuyerTitleInfo> ParseUniversalTransferDocumentBuyerTitleXmlAsync(byte[] xmlContent)
{
return diadocHttpApi.ParseUniversalTransferDocumentBuyerTitleXmlAsync(xmlContent);
}

public Task<UniversalTransferDocumentBuyerTitleInfo> ParseUniversalTransferDocumentBuyerTitleXmlAsync(string authToken, byte[] xmlContent)
{
if (authToken == null) throw new ArgumentNullException(nameof(authToken));
return diadocHttpApi.ParseUniversalTransferDocumentBuyerTitleXmlAsync(authToken, xmlContent);
}

public Task<UniversalCorrectionDocumentSellerTitleInfo> ParseUniversalCorrectionDocumentSellerTitleXmlAsync(byte[] xmlContent, string documentVersion = DefaultDocumentVersions.Ucd)
{
return diadocHttpApi.ParseUniversalCorrectionDocumentSellerTitleXmlAsync(xmlContent, documentVersion);
}

public Task<UniversalCorrectionDocumentSellerTitleInfo> ParseUniversalCorrectionDocumentSellerTitleXmlAsync(string authToken, byte[] xmlContent, string documentVersion = DefaultDocumentVersions.Ucd)
{
if (authToken == null) throw new ArgumentNullException(nameof(authToken));
return diadocHttpApi.ParseUniversalCorrectionDocumentSellerTitleXmlAsync(authToken, xmlContent, documentVersion);
}

public Task<UniversalTransferDocumentBuyerTitleInfo> ParseUniversalCorrectionDocumentBuyerTitleXmlAsync(byte[] xmlContent)
{
return diadocHttpApi.ParseUniversalCorrectionDocumentBuyerTitleXmlAsync(xmlContent);
}

public Task<UniversalTransferDocumentBuyerTitleInfo> ParseUniversalCorrectionDocumentBuyerTitleXmlAsync(string authToken, byte[] xmlContent)
{
if (authToken == null) throw new ArgumentNullException(nameof(authToken));
return diadocHttpApi.ParseUniversalCorrectionDocumentBuyerTitleXmlAsync(authToken, xmlContent);
}

public Task<byte[]> ParseTitleXmlAsync(
string authToken,
string boxId,
Expand Down Expand Up @@ -952,6 +1078,13 @@
return diadocHttpApi.GetOrganizationsByInnListAsync(innList);
}

public Task<List<Organization>> GetOrganizationsByInnListAsync(string authToken, GetOrganizationsByInnListRequest innList)
{
if (authToken == null) throw new ArgumentNullException(nameof(authToken));
if (innList == null) throw new ArgumentNullException(nameof(innList));
return diadocHttpApi.GetOrganizationsByInnListAsync(authToken, innList);
}

public Task<List<OrganizationWithCounteragentStatus>> GetOrganizationsByInnListAsync(string authToken, string myOrgId,
GetOrganizationsByInnListRequest innList)
{
Expand All @@ -969,11 +1102,23 @@
return diadocHttpApi.ParseRevocationRequestXmlAsync(revocationRequestXmlContent);
}

public Task<RevocationRequestInfo> ParseRevocationRequestXmlAsync(string authToken, byte[] revocationRequestXmlContent)
{
if (authToken == null) throw new ArgumentNullException(nameof(authToken));
return diadocHttpApi.ParseRevocationRequestXmlAsync(authToken, revocationRequestXmlContent);
}

public Task<SignatureRejectionInfo> ParseSignatureRejectionXmlAsync(byte[] signatureRejectionXmlContent)
{
return diadocHttpApi.ParseSignatureRejectionXmlAsync(signatureRejectionXmlContent);
}

public Task<SignatureRejectionInfo> ParseSignatureRejectionXmlAsync(string authToken, byte[] signatureRejectionXmlContent)
{
if (authToken == null) throw new ArgumentNullException(nameof(authToken));
return diadocHttpApi.ParseSignatureRejectionXmlAsync(authToken, signatureRejectionXmlContent);
}

public Task<DocumentProtocolResult> GenerateDocumentProtocolAsync(string authToken, string boxId, string messageId,
string documentId)
{
Expand Down
Loading
Loading