From 70960140ec7a2f7104415c1adb30c01631d2b6a0 Mon Sep 17 00:00:00 2001 From: Vahan Harutyunyan Date: Thu, 21 Sep 2023 22:33:47 -0400 Subject: [PATCH 1/3] Set default Sessio nConfiguration's urlCache to nil --- FRCore/FRCore/Network/RestClient.swift | 3 ++- .../FRCoreTests/FRCore/Network/RestClientTests.swift | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/FRCore/FRCore/Network/RestClient.swift b/FRCore/FRCore/Network/RestClient.swift index 53e828a7..410c7eed 100644 --- a/FRCore/FRCore/Network/RestClient.swift +++ b/FRCore/FRCore/Network/RestClient.swift @@ -2,7 +2,7 @@ // RestClient.swift // FRCore // -// Copyright (c) 2020 ForgeRock. All rights reserved. +// Copyright (c) 2020-2023 ForgeRock. All rights reserved. // // This software may be modified and distributed under the terms // of the MIT license. See the LICENSE file for details. @@ -33,6 +33,7 @@ public class RestClient: NSObject { config.httpCookieStorage = nil config.httpCookieAcceptPolicy = .never config.httpShouldSetCookies = false + config.urlCache = nil return config } } diff --git a/FRCore/FRCoreTests/FRCore/Network/RestClientTests.swift b/FRCore/FRCoreTests/FRCore/Network/RestClientTests.swift index dba647dc..2fd2288c 100644 --- a/FRCore/FRCoreTests/FRCore/Network/RestClientTests.swift +++ b/FRCore/FRCoreTests/FRCore/Network/RestClientTests.swift @@ -2,7 +2,7 @@ // RestClientTests.swift // FRCoreTests // -// Copyright (c) 2020 ForgeRock. All rights reserved. +// Copyright (c) 2020-2023 ForgeRock. All rights reserved. // // This software may be modified and distributed under the terms // of the MIT license. See the LICENSE file for details. @@ -125,5 +125,12 @@ class RestClientTests: FRBaseTestCase { break } } + + + func test_04_test_cache_control() { + + RestClient.shared.setURLSessionConfiguration(config: RestClient.defaultURLSessionConfiguration) + + XCTAssertNil(RestClient.shared._urlSession?.configuration.urlCache) + } } - From c2cd06037fc799dbb94b4df190feb92d89f8a9a8 Mon Sep 17 00:00:00 2001 From: Vahan Harutyunyan Date: Mon, 25 Sep 2023 14:23:30 -0400 Subject: [PATCH 2/3] Add comments to explain disabling caching and cookie storage --- FRCore/FRCore/Network/RestClient.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/FRCore/FRCore/Network/RestClient.swift b/FRCore/FRCore/Network/RestClient.swift index 410c7eed..36f386ba 100644 --- a/FRCore/FRCore/Network/RestClient.swift +++ b/FRCore/FRCore/Network/RestClient.swift @@ -30,9 +30,11 @@ public class RestClient: NSObject { static var defaultURLSessionConfiguration: URLSessionConfiguration { get { let config = URLSessionConfiguration.default + // Setting `httpCookieStorage` to nil disables cookie storage config.httpCookieStorage = nil config.httpCookieAcceptPolicy = .never config.httpShouldSetCookies = false + // Setting `urlCache` to nil disables caching config.urlCache = nil return config } From 8a3df9b786914e51374ef567ea2422f9a7ba249a Mon Sep 17 00:00:00 2001 From: Vahan Harutyunyan Date: Mon, 25 Sep 2023 14:46:33 -0400 Subject: [PATCH 3/3] Disable Device binding and device signing tests --- .../xcshareddata/xcschemes/FRTestHost.xcscheme | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/FRTestHost/FRTestHost.xcodeproj/xcshareddata/xcschemes/FRTestHost.xcscheme b/FRTestHost/FRTestHost.xcodeproj/xcshareddata/xcschemes/FRTestHost.xcscheme index f5a93677..0a74c2db 100644 --- a/FRTestHost/FRTestHost.xcodeproj/xcshareddata/xcschemes/FRTestHost.xcscheme +++ b/FRTestHost/FRTestHost.xcodeproj/xcshareddata/xcschemes/FRTestHost.xcscheme @@ -187,6 +187,14 @@ BlueprintName = "FRAuthTests" ReferencedContainer = "container:../FRAuth/FRAuth.xcodeproj"> + + + + + +