Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure the default URLSession for OAuth2Client is ephemeral #152

Merged
merged 2 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion OktaAuthFoundation.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "OktaAuthFoundation"
s.module_name = "AuthFoundation"
s.version = "1.4.2"
s.version = "1.4.3"
s.summary = "Okta Authentication Foundation"
s.description = <<-DESC
Provides the foundation and common features used to authenticate users, managing the lifecycle and storage of tokens and credentials, and provide a base for other Okta SDKs to build upon.
Expand Down
2 changes: 1 addition & 1 deletion OktaDirectAuth.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "OktaDirectAuth"
s.version = "1.4.2"
s.version = "1.4.3"
s.summary = "Okta Direct Authentication"
s.description = <<-DESC
Enables application developers to build native sign in experiences using the Okta Direct Authentication API.
Expand Down
2 changes: 1 addition & 1 deletion OktaOAuth2.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "OktaOAuth2"
s.version = "1.4.2"
s.version = "1.4.3"
s.summary = "Okta OAuth2 Authentication"
s.description = <<-DESC
Enables application developers to authenticate users utilizing a variety of OAuth2 authentication flows.
Expand Down
2 changes: 1 addition & 1 deletion OktaWebAuthenticationUI.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "OktaWebAuthenticationUI"
s.module_name = "WebAuthenticationUI"
s.version = "1.4.2"
s.version = "1.4.3"
s.summary = "Okta Web Authentication UI"
s.description = <<-DESC
Authenticate users using web-based OIDC.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ This library uses semantic versioning and follows Okta's [Library Version Policy

| Version | Status |
| ------- | ---------------------------------- |
| 1.4.2 | ✔️ Stable |
| 1.4.3 | ✔️ Stable |

The latest release can always be found on the [releases page][github-releases].

Expand Down
2 changes: 1 addition & 1 deletion Sources/AuthFoundation/OAuth2/OAuth2Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public final class OAuth2Client {
_ = Date.coordinator

self.configuration = configuration
self.session = session ?? URLSession.shared
self.session = session ?? URLSession(configuration: .ephemeral)

NotificationCenter.default.post(name: .oauth2ClientCreated, object: self)

Expand Down
2 changes: 1 addition & 1 deletion Sources/AuthFoundation/Version.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
import Foundation

// swiftlint:disable identifier_name
public let Version = SDKVersion(sdk: "okta-authfoundation-swift", version: "1.4.2")
public let Version = SDKVersion(sdk: "okta-authfoundation-swift", version: "1.4.3")
// swiftlint:enable identifier_name
2 changes: 1 addition & 1 deletion Sources/OktaDirectAuth/Version.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
@_exported import AuthFoundation

// swiftlint:disable identifier_name
public let Version = SDKVersion(sdk: "okta-directauth-swift", version: "1.4.2")
public let Version = SDKVersion(sdk: "okta-directauth-swift", version: "1.4.3")
// swiftlint:enable identifier_name
2 changes: 1 addition & 1 deletion Sources/OktaOAuth2/Version.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
@_exported import AuthFoundation

// swiftlint:disable identifier_name
public let Version = SDKVersion(sdk: "okta-oauth2-swift", version: "1.4.2")
public let Version = SDKVersion(sdk: "okta-oauth2-swift", version: "1.4.3")
// swiftlint:enable identifier_name
2 changes: 1 addition & 1 deletion Sources/WebAuthenticationUI/Version.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ import Foundation
import AuthFoundation

// swiftlint:disable identifier_name
public let Version = SDKVersion(sdk: "okta-webauthenticationui-swift", version: "1.4.2")
public let Version = SDKVersion(sdk: "okta-webauthenticationui-swift", version: "1.4.3")
// swiftlint:enable identifier_name
4 changes: 4 additions & 0 deletions Tests/AuthFoundationTests/OAuth2ClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ final class OAuth2ClientTests: XCTestCase {
clientId: "abc123",
scopes: "openid profile",
authentication: .none))

// Ensure the default session is ephemeral
let urlSession = try XCTUnwrap(client.session as? URLSession)
XCTAssertEqual(urlSession.configuration.urlCache?.diskCapacity, 0)

client = OAuth2Client(baseURL: URL(string: "https://example.com")!,
clientId: "abc123",
Expand Down
Loading