public void ShouldInitializeSettings() { var settings = new Dictionary <string, string> { { "oauth.aad.TenantId", "tenant789" }, { "oauth.aad.ClientId", "client1234" }, { "oauth.aad.ClientSecret", "secret456" }, { "oauth.aad.CallbackUrl", "http://example.com/auth" }, { "oauth.aad.DomainHint", "servicestack.net" }, { "oauth.aad.ResourceId", "r2d2" }, { "oauth.aad.FailureRedirectPath", "/bad/news" }, }; var appSettings = new DictionarySettings(settings); Subject = new AadAuthProvider(appSettings); Subject.TenantId.Should().Be("tenant789"); Subject.ClientId.Should().Be("client1234"); Subject.ClientSecret.Should().Be("secret456"); Subject.ConsumerKey.Should().Be(Subject.ClientId); Subject.ConsumerSecret.Should().Be(Subject.ClientSecret); Subject.AuthorizeUrl.Should().Be("https://login.microsoftonline.com/tenant789/oauth2/authorize"); Subject.AccessTokenUrl.Should().Be("https://login.microsoftonline.com/tenant789/oauth2/token"); Subject.CallbackUrl.Should().Be("http://example.com/auth"); Subject.DomainHint.Should().Be("servicestack.net"); Subject.ResourceId.Should().Be("r2d2"); Subject.FailureRedirectPath.Should().Be("/bad/news"); }
public void ShouldInitializeSettings() { var settings = new Dictionary<string, string> { { "oauth.aad.TenantId", "tenant789" }, { "oauth.aad.ClientId", "client1234" }, { "oauth.aad.ClientSecret", "secret456" }, { "oauth.aad.CallbackUrl", "http://example.com/auth" }, { "oauth.aad.DomainHint", "servicestack.net" }, { "oauth.aad.ResourceId", "r2d2" }, { "oauth.aad.FailureRedirectPath", "/bad/news" }, }; var appSettings = new DictionarySettings(settings); Subject = new AadAuthProvider(appSettings); Subject.TenantId.Should().Be("tenant789"); Subject.ClientId.Should().Be("client1234"); Subject.ClientSecret.Should().Be("secret456"); Subject.ConsumerKey.Should().Be(Subject.ClientId); Subject.ConsumerSecret.Should().Be(Subject.ClientSecret); Subject.AuthorizeUrl.Should().Be("https://login.microsoftonline.com/tenant789/oauth2/authorize"); Subject.AccessTokenUrl.Should().Be("https://login.microsoftonline.com/tenant789/oauth2/token"); Subject.CallbackUrl.Should().Be("http://example.com/auth"); Subject.DomainHint.Should().Be("servicestack.net"); Subject.ResourceId.Should().Be("r2d2"); Subject.FailureRedirectPath.Should().Be("/bad/news"); }
public void ShouldSetMinimumParameters() { var clientId = "cl1"; var clientSecret = "cs2"; Subject = new AadAuthProvider(clientId, clientSecret); Subject.ClientId.Should().Be(clientId); Subject.ClientSecret.Should().Be(clientSecret); ShouldUseCommonEndpointWhenTenantIdMissing(); }
public void ShouldUseGivenUrls() { var settings = new Dictionary <string, string> { { "oauth.aad.AuthorizeUrl", "https://authorize.example" }, { "oauth.aad.AccessTokenUrl", "https://token.example" }, }; var appSettings = new DictionarySettings(settings); Subject = new AadAuthProvider(appSettings); Subject.AuthorizeUrl.Should().Be("https://authorize.example"); Subject.AccessTokenUrl.Should().Be("https://token.example"); }
public void ShouldUseGivenUrls() { var settings = new Dictionary<string, string> { { "oauth.aad.AuthorizeUrl", "https://authorize.example" }, { "oauth.aad.AccessTokenUrl", "https://token.example" }, }; var appSettings = new DictionarySettings(settings); Subject = new AadAuthProvider(appSettings); Subject.AuthorizeUrl.Should().Be("https://authorize.example"); Subject.AccessTokenUrl.Should().Be("https://token.example"); }
public void Setup() { Subject = new AadAuthProvider(); }