public async Task Test_tenant_settings_sequence() { string token = await GenerateManagementApiToken(); var apiClient = new ManagementApiClient(token, GetVariable("AUTH0_MANAGEMENT_API_URL")); // Get the current settings var settings = apiClient.TenantSettings.GetAsync(); settings.Should().NotBeNull(); // Update the tenant settings var settingsUpdateRequest = new TenantSettingsUpdateRequest { ErrorPage = new TenantErrorPage { Html = null, ShowLogLink = false, Url = $"www.{Guid.NewGuid():N}.aaa/error" }, FriendlyName = Guid.NewGuid().ToString("N"), PictureUrl = $"www.{Guid.NewGuid():N}.aaa/picture.png", SupportEmail = $"support@{Guid.NewGuid():N}.aaa", SupportUrl = $"www.{Guid.NewGuid():N}.aaa/support" }; var settingsUpdateResponse = await apiClient.TenantSettings.UpdateAsync(settingsUpdateRequest); settingsUpdateResponse.Should().BeEquivalentTo(settingsUpdateRequest); }
public async Task Test_tenant_settings_sequence() { var scopes = new { tenant_settings = new { actions = new string[] { "read", "update" } } }; string token = GenerateToken(scopes); var apiClient = new ManagementApiClient(token, new Uri(GetVariable("AUTH0_MANAGEMENT_API_URL"))); // Get the current settings var settings = apiClient.TenantSettings.Get(); settings.Should().NotBeNull(); // Update the tenant settings var settingsUpdateRequest = new TenantSettingsUpdateRequest { ErrorPage = new TenantErrorPage { Html = null, ShowLogLink = false, Url = $"www.{Guid.NewGuid().ToString("N")}.aaa/error" }, FriendlyName = Guid.NewGuid().ToString("N"), PictureUrl = $"www.{Guid.NewGuid().ToString("N")}.aaa/picture.png", SupportEmail = $"support@{Guid.NewGuid().ToString("N")}.aaa", SupportUrl = $"www.{Guid.NewGuid().ToString("N")}.aaa/support" }; var settingsUpdateResponse = await apiClient.TenantSettings.Update(settingsUpdateRequest); settingsUpdateResponse.ShouldBeEquivalentTo(settingsUpdateRequest); }
private async Task SetGuardianMfaPage(BanjoPage page) { using var managementClient = await _managementApiClientFactory.CreateAsync(); var updateRequest = new TenantSettingsUpdateRequest() { GuardianMfaPage = new TenantGuardianMfaPage() { Enabled = true, Html = page.Html } }; await Update(async() => { await managementClient.TenantSettings.UpdateAsync(updateRequest); return(page); }, page.PageType.ToString()); }
public async Task Test_tenant_settings_sequence() { string token = await GenerateManagementApiToken(); using (var apiClient = new ManagementApiClient(token, GetVariable("AUTH0_MANAGEMENT_API_URL"))) { // Get the current settings var settings = apiClient.TenantSettings.GetAsync(); settings.Should().NotBeNull(); // Update the tenant settings - do not set some properties as the tenant is pre-configured // to allow all the right logout urls etc. var settingsUpdateRequest = new TenantSettingsUpdateRequest { ChangePassword = new TenantChangePassword { Enabled = true, Html = "<b>hi</b>", }, ErrorPage = new TenantErrorPage { Html = null, ShowLogLink = false, Url = $"www.{Guid.NewGuid():N}.aaa/error", }, GuardianMfaPage = new TenantGuardianMfaPage { Html = "<b>hi</b>", Enabled = true, }, FriendlyName = Guid.NewGuid().ToString("N"), PictureUrl = $"www.{Guid.NewGuid():N}.aaa/picture.png", SupportEmail = $"support@{Guid.NewGuid():N}.aaa", SupportUrl = $"www.{Guid.NewGuid():N}.aaa/support", DefaultAudience = "", DefaultDirectory = "Username-Password-Authentication", EnabledLocales = new[] { "en" }, Flags = new TenantFlags() { ChangePwdFlowV1 = false, DisableClickjackProtectionHeaders = true, EnableAPIsSection = true, EnableClientConnections = false, EnablePipeline2 = true }, DeviceFlow = new TenantDeviceFlow() { Charset = TenantDeviceFlowCharset.Base20, Mask = "***-***-***" } }; var settingsUpdateResponse = await apiClient.TenantSettings.UpdateAsync(settingsUpdateRequest); settingsUpdateResponse.Should().BeEquivalentTo(settingsUpdateRequest, options => options.Excluding(p => p.SandboxVersion).Excluding(p => p.SandboxVersionsAvailable)); var resetUpdateRequest = new TenantSettingsUpdateRequest { ChangePassword = new TenantChangePassword { Html = null, Enabled = false, }, ErrorPage = new TenantErrorPage { Html = null, Url = "", }, GuardianMfaPage = new TenantGuardianMfaPage { Html = null, Enabled = false, }, FriendlyName = "Auth0.NET SDK integration test", PictureUrl = "", SupportEmail = "*****@*****.**", SupportUrl = "", }; await apiClient.TenantSettings.UpdateAsync(resetUpdateRequest); } }
/// <summary> /// Updates the settings for the tenant. /// </summary> /// <param name="request">A <see cref="TenantSettingsUpdateRequest" /> containing the settings for the tenant which are to /// be updated.</param> /// <returns>A <see cref="TenantSettings" /> containing the updated settings for the tenant.</returns> public Task <TenantSettings> UpdateAsync(TenantSettingsUpdateRequest request) { return(Connection.PatchAsync <TenantSettings>("tenants/settings", request, null)); }
/// <summary> /// Updates the settings for the tenant. /// </summary> /// <param name="request"> /// <see cref="TenantSettingsUpdateRequest" /> containing the settings for the tenant which are to be updated. /// </param> /// <returns>A <see cref="TenantSettings" /> containing the updated settings for the tenant.</returns> public Task <TenantSettings> UpdateAsync(TenantSettingsUpdateRequest request) { return(Connection.SendAsync <TenantSettings>(new HttpMethod("PATCH"), BuildUri("tenants/settings"), request, DefaultHeaders)); }
public Task<TenantSettings> Update(TenantSettingsUpdateRequest request) { return UpdateAsync(request); }
/// <summary> /// Updates the settings for the tenant. /// </summary> /// <param name="request">A <see cref="TenantSettingsUpdateRequest" /> containing the settings for the tenant which are to /// be updated.</param> /// <returns>A <see cref="TenantSettings" /> containing the updated settings for the tenant.</returns> public Task<TenantSettings> UpdateAsync(TenantSettingsUpdateRequest request) { return Connection.PatchAsync<TenantSettings>("tenants/settings", request, null); }
public Task <TenantSettings> Update(TenantSettingsUpdateRequest request) { return(UpdateAsync(request)); }