public void GetConstructedKeyAuthorization_WhenNoWellKnownChallengeTokenWasReturnedFromConfiguration_ReturnsNull() { IAcmeChallengeResolver sut = CreateSut(false); string result = sut.GetConstructedKeyAuthorization(_fixture.Create <string>()); Assert.That(result, Is.Null); }
public void GetConstructedKeyAuthorization_WhenChallengeTokenIsNotNullEmptyOrWhiteSpace_AssertGetterWasCalledOnConfigurationWithSecurityAcmeChallengeWellKnownChallengeToken() { IAcmeChallengeResolver sut = CreateSut(); sut.GetConstructedKeyAuthorization(_fixture.Create <string>()); _configurationMock.Verify(m => m["Security:AcmeChallenge:WellKnownChallengeToken"], Times.Once); }
public void GetConstructedKeyAuthorization_WhenNoWellKnownChallengeTokenWasReturnedFromConfiguration_AssertGetterWasNotCalledOnConfigurationWithSecurityAcmeChallengeConstructedKeyAuthorization() { IAcmeChallengeResolver sut = CreateSut(false); sut.GetConstructedKeyAuthorization(_fixture.Create <string>()); _configurationMock.Verify(m => m["Security:AcmeChallenge:ConstructedKeyAuthorization"], Times.Never); }
public void GetWellKnownChallengeToken_WhenWhiteSpaceWasReturnedFromConfiguration_ReturnsNull() { IAcmeChallengeResolver sut = CreateSut(wellKnownChallengeToken: " "); string result = sut.GetWellKnownChallengeToken(); Assert.That(result, Is.Null); }
public void GetConstructedKeyAuthorization_WhenChallengeTokenIsWhiteSpace_ThrowsArgumentNullException() { IAcmeChallengeResolver sut = CreateSut(); ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.GetConstructedKeyAuthorization(" ")); Assert.That(result.ParamName, Is.EqualTo("challengeToken")); }
public void GetWellKnownChallengeToken_WhenCalled_AssertGetterWasCalledOnConfigurationWithSecurityAcmeChallengeWellKnownChallengeToken() { IAcmeChallengeResolver sut = CreateSut(); sut.GetWellKnownChallengeToken(); _configurationMock.Verify(m => m["Security:AcmeChallenge:WellKnownChallengeToken"], Times.Once); }
public void GetConstructedKeyAuthorization_WhenWellKnownChallengeTokenDoesNotMatchChallengeToken_AssertGetterNotCalledOnConfigurationWithSecurityAcmeChallengeConstructedKeyAuthorization() { string wellKnownChallengeToken = _fixture.Create <string>(); IAcmeChallengeResolver sut = CreateSut(wellKnownChallengeToken: wellKnownChallengeToken); sut.GetConstructedKeyAuthorization(wellKnownChallengeToken + _fixture.Create <string>()); _configurationMock.Verify(m => m["Security:AcmeChallenge:ConstructedKeyAuthorization"], Times.Never); }
public void GetConstructedKeyAuthorization_WhenWellKnownChallengeTokenMatchesChallengeTokenButWhiteSpaceWasReturnedFromConfigurationForConstructedKeyAuthorization_ReturnsNull() { string wellKnownChallengeToken = _fixture.Create <string>(); IAcmeChallengeResolver sut = CreateSut(wellKnownChallengeToken: wellKnownChallengeToken, constructedKeyAuthorization: " "); string result = sut.GetConstructedKeyAuthorization(wellKnownChallengeToken); Assert.That(result, Is.Null); }
public void GetConstructedKeyAuthorization_WhenWellKnownChallengeTokenDoesNotMatchChallengeToken_ReturnsNull() { string wellKnownChallengeToken = _fixture.Create <string>(); IAcmeChallengeResolver sut = CreateSut(wellKnownChallengeToken: wellKnownChallengeToken); string result = sut.GetConstructedKeyAuthorization(wellKnownChallengeToken + _fixture.Create <string>()); Assert.That(result, Is.Null); }
public void GetWellKnownChallengeToken_WhenNonNullEmptyOrWhiteSpaceWasReturnedFromConfiguration_ReturnsValueFromConfiguration() { string wellKnownChallengeToken = _fixture.Create <string>(); IAcmeChallengeResolver sut = CreateSut(wellKnownChallengeToken: wellKnownChallengeToken); string result = sut.GetWellKnownChallengeToken(); Assert.That(result, Is.EqualTo(wellKnownChallengeToken)); }
public void GetConstructedKeyAuthorization_WhenWellKnownChallengeTokenMatchesChallengeTokenAndNonNullEmptyOrWhiteSpaceWasReturnedFromConfigurationForConstructedKeyAuthorization_ReturnsValueFromConfiguration() { string wellKnownChallengeToken = _fixture.Create <string>(); string constructedKeyAuthorization = _fixture.Create <string>(); IAcmeChallengeResolver sut = CreateSut(wellKnownChallengeToken: wellKnownChallengeToken, constructedKeyAuthorization: constructedKeyAuthorization); string result = sut.GetConstructedKeyAuthorization(wellKnownChallengeToken); Assert.That(result, Is.EqualTo(constructedKeyAuthorization)); }
public SecurityController(IClaimResolver claimResolver, IDataProtectionProvider dataProtectionProvider, IAcmeChallengeResolver acmeChallengeResolver) { NullGuard.NotNull(claimResolver, nameof(claimResolver)) .NotNull(dataProtectionProvider, nameof(dataProtectionProvider)) .NotNull(acmeChallengeResolver, nameof(acmeChallengeResolver)); _claimResolver = claimResolver; _dataProtectionProvider = dataProtectionProvider; _acmeChallengeResolver = acmeChallengeResolver; }
public HomeController(IQueryBus queryBus, IClaimResolver claimResolver, ITokenHelperFactory tokenHelperFactory, IAcmeChallengeResolver acmeChallengeResolver) { NullGuard.NotNull(queryBus, nameof(queryBus)) .NotNull(claimResolver, nameof(claimResolver)) .NotNull(tokenHelperFactory, nameof(tokenHelperFactory)) .NotNull(acmeChallengeResolver, nameof(acmeChallengeResolver)); _queryBus = queryBus; _claimResolver = claimResolver; _tokenHelperFactory = tokenHelperFactory; _acmeChallengeResolver = acmeChallengeResolver; }