public HmacAuthenticationOptions(ISigningAlgorithm algorithm, ISecretRepository secretRepository, string signInAsAuthenticationType = Schemas.HMAC) : base(Schemas.HMAC) { Algorithm = algorithm; SecretRepository = secretRepository; SignInAsAuthenticationType = signInAsAuthenticationType; }
public UserController(IUserRepository userRepository, ICommonMethods commonMethods, IUserInformationRepository userInformationRepository, ISecretRepository secretRepository) { _userRepository = userRepository; _commonMethods = commonMethods; _userInformationRepository = userInformationRepository; _secretRepository = secretRepository; }
public SecretController(ILogger <SecretController> logger, ISecretRepository secretRepository, ILoggerAdapter <SecretController> loggerAdapter, IMediator mediator, IMapper mapper) { _secretRepository = secretRepository; _loggerAdapter = loggerAdapter; _mediator = mediator; _mapper = mapper; }
public CacheHandler(ISecretRepository secretRepository, IBuildMessageRepresentation representationBuilder, ICalculteSignature signatureCalculator) : base(secretRepository, representationBuilder, signatureCalculator) { _secretRepo = secretRepository; _representBuilder = representationBuilder; _sigCalc = signatureCalculator; }
public SecretProvider( IOptionsSnapshot <SecretSettings> secretSettings, ISecretRepository secretRepository) { this.secretSettings = secretSettings; this.secretRepository = secretRepository; }
/// <summary> /// Create a new instance of the <see cref="HmacSigningHandler"/> class. /// </summary> /// <param name="secretRepository"></param> /// <param name="representationBuilder"></param> /// <param name="signatureCalculator"></param> /// <param name="scheme"></param> public HmacSigningHandler(ISecretRepository secretRepository, IMessageRepresentationBuilder representationBuilder, ISignatureCalculator signatureCalculator, string scheme = "SHA256") { this.secretRepository = secretRepository; this.representationBuilder = representationBuilder; this.signatureCalculator = signatureCalculator; this.scheme = scheme; }
public HmacAuthenticationHandler(ISecretRepository secretRepository, IBuildMessageRepresentation representationBuilder, ICalculteSignature signatureCalculator) { _secretRepository = secretRepository; _representationBuilder = representationBuilder; _signatureCalculator = signatureCalculator; }
public static ContainerBuilder UseForPeghTest(this ContainerBuilder builder, ISecretRepository secretRepository) { RegisterDefaultTypes(builder); builder.RegisterInstance(secretRepository).As <ISecretRepository>(); builder.RegisterType <PeghEnvironment>().As <IPeghEnvironment>(); builder.RegisterType <Disguiser>().As <IDisguiser>(); return(builder); }
/// <summary> /// Create a new instance of the <see cref="HmacSigningHandler"/> class. /// </summary> /// <param name="secretRepository"></param> /// <param name="representationBuilder"></param> /// <param name="signatureCalculator"></param> public HmacSigningHandler(ISecretRepository secretRepository, IMessageRepresentationBuilder representationBuilder, ISignatureCalculator signatureCalculator) { this.secretRepository = secretRepository; this.representationBuilder = representationBuilder; this.signatureCalculator = signatureCalculator; }
public NugetPackageUpdater(IGitUtilities gitUtilities, IProcessRunner processRunner, INugetFeedLister nugetFeedLister, ISecretRepository secretRepository, IPackageConfigsScanner packageConfigsScanner, ISimpleLogger simpleLogger) { GitUtilities = gitUtilities; ProcessRunner = processRunner; NugetFeedLister = nugetFeedLister; SecretRepository = secretRepository; PackageConfigsScanner = packageConfigsScanner; SimpleLogger = simpleLogger; }
} // find the appsecret by appkey public HmacSigningHandler(ISecretRepository secretRepository, IBuildMessageRepresentation representationBuilder, ICalculteSignature signatureCalculator) { _secretRepository = secretRepository; _representationBuilder = representationBuilder; _signatureCalculator = signatureCalculator; TrySetAppKey(); }
public HmacAuthenticationHandler(ISecretRepository secretRepository, IBuildMessageRepresentation representationBuilder, ICalculateSignature signatureCalculator, IHashHelper hashHelper) { _secretRepository = secretRepository; _representationBuilder = representationBuilder; _signatureCalculator = signatureCalculator; _hashHelper = hashHelper; }
public HmacServerHandler( ISecretRepository secretRepository, ISigningAlgorithm signingAlgorithm, TimeSpan?clockSkew = null, ITime time = null) { this.secretRepository = secretRepository; this.signingAlgorithm = signingAlgorithm; this.clockSkew = clockSkew ?? Constants.DefaultClockSkew; this.time = time ?? SystemTime.Instance; }
public PrivilegedAccessQueryHandler(ISecretRepository secretRepository, ITotpService totpService, IOAuthTokenService tokenService, ICacheProvider cacheProvider, ILogger logger) { _secretRepository = secretRepository; _totpService = totpService; _tokenService = tokenService; _cacheProvider = cacheProvider; _logger = logger; }
public NugetPackageToPushFinder(IFolderResolver folderResolver, IGitUtilities gitUtilities, INugetConfigReader nugetConfigReader, INugetFeedLister nugetFeedLister, IProjectFactory projectFactory, IPushedHeadTipShaRepository pushedHeadTipShaRepository, ISecretRepository secretRepository, IChangedBinariesLister changedBinariesLister) { FolderResolver = folderResolver; GitUtilities = gitUtilities; NugetConfigReader = nugetConfigReader; NugetFeedLister = nugetFeedLister; ProjectFactory = projectFactory; PushedHeadTipShaRepository = pushedHeadTipShaRepository; SecretRepository = secretRepository; ChangedBinariesLister = changedBinariesLister; }
// ******************************************************************* // Constructors. // ******************************************************************* #region Constructors /// <summary> /// This constructor creates a new instance of the <see cref="SecretStore"/> /// class. /// </summary> /// <param name="logger">The logger to use with the store.</param> /// <param name="secretRepository">The repository to use with the store.</param> public SecretStore( ILogger <SecretStore> logger, ISecretRepository secretRepository ) { // Validate the parameters before attempting to use them. Guard.Instance().ThrowIfNull(logger, nameof(logger)) .ThrowIfNull(secretRepository, nameof(secretRepository)); // Save the references. Logger = logger; SecretRepository = secretRepository; }
internal static bool Validate(IOwinRequest req, ISigningAlgorithm algorithm, ISecretRepository secretRepository, ITime time, TimeSpan clockSkew) { var h = req.Headers; var client = GetClient(req); var nonce = GetNonce(req); var auth = h.Get(Headers.Authorization)?.Split(' '); var scheme = auth?.Length == 2 ? auth[0] : null; var token = auth?.Length == 2 ? auth[1] : null; DateTimeOffset date = DateTimeOffset.TryParse(h.Get(Headers.Date), out date) ? date : DateTimeOffset.MinValue; if (client != null && nonce != null && scheme == Schemas.Bearer && token != null && time.UtcNow - date <= clockSkew) { var contentMd5 = h.Get(Headers.ContentMD5); var builder = new CannonicalRepresentationBuilder(); var content = builder.BuildRepresentation( nonce, client, req.Method, req.ContentType, req.Accept.Split(','), contentMd5 == null ? null : Convert.FromBase64String(contentMd5), date, req.Uri); SecureString secret = secretRepository.GetSecret(client); if (secret != null) { var isTokenValid = algorithm.Verify( secret, Encoding.UTF8.GetBytes(content), Convert.FromBase64String(token)); if (isTokenValid) { return(true); } } } return(false); }
public WakekApplication(IApplicationCommandController controller, IApplicationCommandExecutionContext context, SynchronizationContext uiSynchronizationContext, Func <string, int> navigateToStringReturnContentAsNumber, ISecretRepository secretRepository, IXmlSerializedObjectReader xmlSerializedObjectReader, IBenchmarkExecutionFactory benchmarkExecutionFactory, IXmlSerializer xmlSerializer, ITelemetryDataReader telemetryDataReader, IHttpClientFactory httpClientFactory) { Controller = controller; Context = context; UiSynchronizationContext = uiSynchronizationContext; NavigateToStringReturnContentAsNumber = navigateToStringReturnContentAsNumber; XmlSerializedObjectReader = xmlSerializedObjectReader; Log = new ApplicationLog(); NextSequenceNumber = 1; SecretRepository = secretRepository; Controller.AddCommand(new ExecuteCommand(this, benchmarkExecutionFactory, xmlSerializer, telemetryDataReader, httpClientFactory), true); }
/// <summary> /// Creates a new instance of the <see cref="HmacSignatureValidator"/> class. /// </summary> /// <param name="signatureCalculator"></param> /// <param name="representationBuilder"></param> /// <param name="secretRepository"></param> /// <param name="objectCache"></param> /// <param name="validityPeriod"></param> /// <param name="clockDrift"></param> public HmacSignatureValidator(ISignatureCalculator signatureCalculator, IMessageRepresentationBuilder representationBuilder, ISecretRepository secretRepository, ICache objectCache, int validityPeriod, int clockDrift) { this.secretRepository = secretRepository; this.representationBuilder = representationBuilder; this.signatureCalculator = signatureCalculator; this.objectCache = objectCache; ValidityPeriod = validityPeriod; ClockDrift = clockDrift; }
private static async Task SetShouldDefaultSecretsBeStored(ISecretRepository sut, bool shouldThey, IErrorsAndInfos errorsAndInfos) { var shouldDefaultSecretsBeStored = await ShouldDefaultSecretsBeStoredAsync(sut, errorsAndInfos); if (shouldThey == shouldDefaultSecretsBeStored.AutomaticallySaveDefaultSecretIfAbsent) { return; } shouldDefaultSecretsBeStored.AutomaticallySaveDefaultSecretIfAbsent = shouldThey; shouldDefaultSecretsBeStored = await ShouldDefaultSecretsBeStoredAsync(sut, errorsAndInfos); Assert.AreEqual(shouldThey, shouldDefaultSecretsBeStored.AutomaticallySaveDefaultSecretIfAbsent); }
public HmrcAuthTokenBroker( [RequiredPolicy(HmrcExecutionPolicy.Name)] ExecutionPolicy executionPolicy, ILogger logger, IOAuthTokenService tokenService, ISecretRepository secretRepository, ITotpService totpService, ITokenRefresher tokenRefresher, IHmrcAuthTokenBrokerConfig hmrcAuthTokenBrokerConfig) { _secretRepository = secretRepository; _totpService = totpService; _tokenService = tokenService; _logger = logger; _executionPolicy = executionPolicy; _tokenRefresher = tokenRefresher; _hmrcAuthTokenBrokerConfig = hmrcAuthTokenBrokerConfig; _initialiseTask = InitialiseToken(); }
public async Task <string> Disguise(ISecretRepository secretRepository, string s, IErrorsAndInfos errorsAndInfos) { var bytes = Encoding.UTF8.GetBytes(s); EnsurePrimeNumbers(bytes); long pos = bytes.Length; var primePos = bytes.Length; var disguised = ""; var secretLongString = await secretRepository.GetAsync(new LongSecretString(), errorsAndInfos); var longString = secretLongString.TheLongString; foreach (var aByte in bytes) { pos += aByte * PrimeNumbers[primePos]; primePos += aByte; disguised += longString.Substring((int)(pos % (longString.Length - 3)), 3); } return(disguised); }
public StringCrypter(ISecretRepository secretRepository) { SecretRepository = secretRepository; }
public AutoCommitterAndPusher(IGitUtilities gitUtilities, ISecretRepository secretRepository, IPushedHeadTipShaRepository pushedHeadTipShaRepository) { GitUtilities = gitUtilities; SecretRepository = secretRepository; PushedHeadTipShaRepository = pushedHeadTipShaRepository; }
public FolderResolver(ISecretRepository secretRepository) { SecretRepository = secretRepository; Replacements = new Dictionary <string, string>(); }
public HomeController(ISecretRepository secretRepository) { _secretRepository = secretRepository; }
/// <summary> /// Creates a new instance of the <see cref="SecretRepositoryCache"/> class. /// </summary> /// <param name="repository">Underlying repository with the secrets</param> /// <param name="cachePolicy">Cache to use</param> public SecretRepositoryCache(ISecretRepository repository, CachePolicy cachePolicy) { this.repository = repository; this.cachePolicy = cachePolicy; }
/// <summary> /// Creates a new instance of the <see cref="SecretRepositoryDistributedCache"/> class. /// </summary> /// <param name="repository">Underlying repository with the secrets</param> /// <param name="cache">Cache to use</param> /// <param name="duration">Duration to cache after acquisition</param> public SecretRepositoryDistributedCache(ISecretRepository repository, IDistributedCache cache, TimeSpan duration) { this.repository = repository; this.cache = cache; this.duration = duration; }
public SecretKeyValidatorsMiddleware(RequestDelegate next, ISecretRepository _repo) { _next = next; ContactsRepo = _repo; }
public GitHubUtilities(IGitUtilities gitUtilities, ISecretRepository secretRepository) { vGitUtilities = gitUtilities; vSecretRepository = secretRepository; }
/// <summary> /// Creates a new instance of the <see cref="SecretRepositoryMemoryCache"/> class. /// </summary> /// <param name="repository">Underlying repository with the secrets</param> /// <param name="cache">Cache to use</param> /// <param name="duration">Duration to cache after acquisition</param> public SecretRepositoryMemoryCache(ISecretRepository repository, IMemoryCache cache, TimeSpan duration) { this.repository = repository; this.cache = cache; this.duration = duration; }
public HmacMiddlewareOptions(ISecretRepository secretRepository, ISigningAlgorithm algorithm) { SecretRepository = secretRepository; Algorithm = algorithm; }
public SecretService(IValidationDictionary validationDictionary) { _validationDictionary = validationDictionary; _secretRepository = new EntitySecretRepository(); ProfileService = new ProfileService(validationDictionary); }