diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ab4b602..0000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -reference: http://www.objc.io/issue-6/travis-ci.html -language: objective-c -osx_image: xcode8 -env: - global: - - LC_CTYPE=en_US.UTF-8 - - LANG=en_US.UTF-8 - - LINT_PODSPEC=no - - FORCE_CARTHAGE_VERSION=yes - - secure: uPyKTuEdp8aOw4bDrB6ACQkkHzDCTUCnIVraVpGhKulr8GrTQ8Lkwl6HONDYR7iC+U9PCGscbxcFumuUv4DkYrD4yIjdC5KOsilOr381eG1XDpXxFW5vZqBO4zDcxr7xemrhZ/h5qx07jXKU2dzfthe0xl3+2fyYrQinglTVQ9IVJzCAqANPS2/drU+dRInLm9ndhsxjcWeaZu+G6M5uwg/f4drUw0OwL05/BN5oDfI4jB02LDwJJXUWdDDf+CKC0/kMrFWgFTo1MWRnKgJwKpODdNb+AXWMIQnqnsNyv4hfwx9H2Y6Pj+/v32+zAzeJtzzBLlB14WDwPzEy05+LgFuxbQjcUDMipcwjL+rceQlBIe3L5hzu7g99KyukMjUejZi9o+xxN2ri001FbZGpjjl/0NcCKzbKVUErWFldWCuk43gHjrTHtgGr5XjJaBnd4tflwfgpZgRRxzPiXJiILerf9YhJnWKkxSpTgCI3CdWWkxqWKpx1mN5qOall4DNfyp1tIBj1EgDJjAwSbS12IBR6BWGrKb8VApeDpOlq3Bx9VTUvSosft2ufamTSbh8gYSjtOprRQ2b/Qv4gtW7BvRAlSwA8jkEMXG/K/LOdq8maWGeWKAx/AZMLlmxK2Lnyk5gICE7Sy07UjQ4yE9Ey/QmtFJRmnyC1eZZ5MmpX1X8= - matrix: - - SCHEME="Guardian" IOS_DESTINATION_VERSION="9.3" CARTHAGE_BUILD_PLATFORM="iOS" - - SCHEME="Guardian" IOS_DESTINATION_VERSION="10.0" CARTHAGE_BUILD_PLATFORM="iOS" -before_install: true -install: true -script: -- script/cibuild -branches: - only: - - master -after_success: - - bash <(curl -s https://codecov.io/bash) -J 'Guardian' \ No newline at end of file diff --git a/Guardian.xcodeproj/project.pbxproj b/Guardian.xcodeproj/project.pbxproj index 713445a..9d3e0f8 100644 --- a/Guardian.xcodeproj/project.pbxproj +++ b/Guardian.xcodeproj/project.pbxproj @@ -192,8 +192,6 @@ 5F20380E1D5E421F0005D2E2 /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; 5F20380F1D5E421F0005D2E2 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; 5F2038111D5E42AD0005D2E2 /* .gitignore */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitignore; sourceTree = ""; }; - 5F2038141D5E43CD0005D2E2 /* .travis.yml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .travis.yml; sourceTree = ""; }; - 5F2038161D5E43DD0005D2E2 /* .env */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = .env; path = script/.env; sourceTree = ""; }; 5F2038181D5E46210005D2E2 /* Gemfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Gemfile; sourceTree = ""; }; /* End PBXFileReference section */ @@ -406,8 +404,6 @@ isa = PBXGroup; children = ( 5F2038181D5E46210005D2E2 /* Gemfile */, - 5F2038161D5E43DD0005D2E2 /* .env */, - 5F2038141D5E43CD0005D2E2 /* .travis.yml */, 5F2038111D5E42AD0005D2E2 /* .gitignore */, 5F20380C1D5E421F0005D2E2 /* Cartfile.resolved */, 5F20380D1D5E421F0005D2E2 /* Cartfile.private */, diff --git a/Guardian/Guardian.swift b/Guardian/Guardian.swift index 56d25f4..0d3b4e3 100644 --- a/Guardian/Guardian.swift +++ b/Guardian/Guardian.swift @@ -22,6 +22,14 @@ import Foundation +let nonCachedSession: URLSession = { + let config = URLSessionConfiguration.default + config.requestCachePolicy = .reloadIgnoringLocalCacheData + config.urlCache = nil + + return URLSession.init(configuration: config) +}() + /** Creates a low level API client for Guardian MFA server @@ -36,7 +44,7 @@ import Foundation - seealso: Guardian.API */ -public func api(forDomain domain: String, session: URLSession = .shared) -> API { +public func api(forDomain domain: String, session: URLSession = nonCachedSession) -> API { return api(url: url(from: domain)!, session: session) } @@ -54,7 +62,7 @@ public func api(forDomain domain: String, session: URLSession = .shared) -> API - seealso: Guardian.API */ -public func api(url: URL, session: URLSession = .shared) -> API { +public func api(url: URL, session: URLSession = nonCachedSession) -> API { return APIClient(baseUrl: url, session: session) } @@ -76,7 +84,7 @@ public func api(url: URL, session: URLSession = .shared) -> API { - seealso: Guardian.Authentication */ -public func authentication(forDomain domain: String, andEnrollment enrollment: Enrollment, session: URLSession = .shared) -> Authentication { +public func authentication(forDomain domain: String, andEnrollment enrollment: Enrollment, session: URLSession = nonCachedSession) -> Authentication { let client = api(forDomain: domain, session: session) return RSAAuthentication(api: client, enrollment: enrollment) } @@ -100,7 +108,7 @@ public func authentication(forDomain domain: String, andEnrollment enrollment: E - seealso: Guardian.Authentication */ -public func authentication(url: URL, andEnrollment enrollment: Enrollment, session: URLSession = .shared) -> Authentication { +public func authentication(url: URL, andEnrollment enrollment: Enrollment, session: URLSession = nonCachedSession) -> Authentication { let client = api(url: url, session: session) return RSAAuthentication(api: client, enrollment: enrollment) } @@ -149,7 +157,7 @@ public func authentication(url: URL, andEnrollment enrollment: Enrollment, sessi - returns: a request to create an enrollment */ -public func enroll(forDomain domain: String, session: URLSession = .shared, usingUri uri: String, notificationToken: String, keyPair: RSAKeyPair) -> EnrollRequest { +public func enroll(forDomain domain: String, session: URLSession = nonCachedSession, usingUri uri: String, notificationToken: String, keyPair: RSAKeyPair) -> EnrollRequest { let client = api(forDomain: domain, session: session) return EnrollRequest(api: client, enrollmentUri: uri, notificationToken: notificationToken, keyPair: keyPair) } @@ -198,7 +206,7 @@ public func enroll(forDomain domain: String, session: URLSession = .shared, usin - returns: a request to create an enrollment */ -public func enroll(url: URL, session: URLSession = .shared, usingUri uri: String, notificationToken: String, keyPair: RSAKeyPair) -> EnrollRequest { +public func enroll(url: URL, session: URLSession = nonCachedSession, usingUri uri: String, notificationToken: String, keyPair: RSAKeyPair) -> EnrollRequest { let client = api(url: url, session: session) return EnrollRequest(api: client, enrollmentUri: uri, notificationToken: notificationToken, keyPair: keyPair) } @@ -246,7 +254,7 @@ public func enroll(url: URL, session: URLSession = .shared, usingUri uri: String - returns: a request to create an enrollment */ -public func enroll(forDomain domain: String, session: URLSession = .shared, usingTicket ticket: String, notificationToken: String, keyPair: RSAKeyPair) -> EnrollRequest { +public func enroll(forDomain domain: String, session: URLSession = nonCachedSession, usingTicket ticket: String, notificationToken: String, keyPair: RSAKeyPair) -> EnrollRequest { let client = api(forDomain: domain, session: session) return EnrollRequest(api: client, enrollmentTicket: ticket, notificationToken: notificationToken, keyPair: keyPair) } @@ -294,7 +302,7 @@ public func enroll(forDomain domain: String, session: URLSession = .shared, usin - returns: a request to create an enrollment */ -public func enroll(url: URL, session: URLSession = .shared, usingTicket ticket: String, notificationToken: String, keyPair: RSAKeyPair) -> EnrollRequest { +public func enroll(url: URL, session: URLSession = nonCachedSession, usingTicket ticket: String, notificationToken: String, keyPair: RSAKeyPair) -> EnrollRequest { let client = api(url: url, session: session) return EnrollRequest(api: client, enrollmentTicket: ticket, notificationToken: notificationToken, keyPair: keyPair) } diff --git a/GuardianTests/APIClientSpec.swift b/GuardianTests/APIClientSpec.swift index 3125fbe..a8086a0 100644 --- a/GuardianTests/APIClientSpec.swift +++ b/GuardianTests/APIClientSpec.swift @@ -30,7 +30,7 @@ class APIClientSpec: QuickSpec { override func spec() { - let client = APIClient(baseUrl: ValidURL, session: URLSession.shared) + let client = APIClient(baseUrl: ValidURL, session: Guardian.nonCachedSession) beforeEach { stub(condition: { _ in return true }) { _ in