20 lines
871 B
C#
20 lines
871 B
C#
using System;
|
|
using NuGet.Protocol.Plugins;
|
|
|
|
namespace NugetSecretCredential;
|
|
|
|
internal class GetOperationClaimsRequestHandler : RequestHandlerBase<GetOperationClaimsRequest, GetOperationClaimsResponse>
|
|
{
|
|
private static readonly GetOperationClaimsResponse CanProvideCredentialsResponse =
|
|
new GetOperationClaimsResponse(new List<OperationClaim> { OperationClaim.Authentication });
|
|
|
|
private static readonly GetOperationClaimsResponse EmptyGetOperationClaimsResponse =
|
|
new GetOperationClaimsResponse(new List<OperationClaim>());
|
|
|
|
public override Task<GetOperationClaimsResponse> HandleRequestAsync(GetOperationClaimsRequest request, CancellationToken cancel)
|
|
{
|
|
return request.PackageSourceRepository != null || request.ServiceIndex != null
|
|
? Task.FromResult(EmptyGetOperationClaimsResponse)
|
|
: Task.FromResult(CanProvideCredentialsResponse);
|
|
}
|
|
} |