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

Deprecate methods [SDK-2749] #499

Merged
merged 3 commits into from
Aug 30, 2021
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
1 change: 1 addition & 0 deletions Auth0/AuthProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

```
*/
@available(*, deprecated, message: "not available for OIDC-conformant clients")
public protocol AuthProvider {
func login(withConnection connection: String, scope: String, parameters: [String: Any]) -> NativeAuthTransaction

Expand Down
2 changes: 1 addition & 1 deletion Auth0/AuthTransaction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ When that happens the OS will call a method in your `AppDelegate` and that is wh
*/
public protocol AuthTransaction: AuthResumable, AuthCancelable {

/// value of the OAuth 2.0 state parameter. It must be a cryptographically secure randon string used to protect the app with request forgery.
/// value of the OAuth 2.0 state parameter. It must be a cryptographically secure random string used to protect the app with request forgery.
var state: String? { get }

}
Expand Down
16 changes: 10 additions & 6 deletions Auth0/Authentication.swift
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public protocol Authentication: Trackable, Loggable {

- returns: authentication request that will yield Auth0 User Credentials
- seeAlso: Credentials
- warning: this method is deprecated in favor of `login(usernameOrEmail username:, password:, realm:, audience:, scope:)` for Database connections. For Passwordless connections use `login(email:, code:, audience:, scope:, parameters:)` or `login(phoneNumber:, code:, audience:, scope:, parameters:)` instead.
- warning: deprecated in favor of `login(usernameOrEmail username:, password:, realm:, audience:, scope:)` for Database connections. For Passwordless connections use `login(email:, code:, audience:, scope:, parameters:)` or `login(phoneNumber:, code:, audience:, scope:, parameters:)` instead.
- requires: Legacy Grant `http://auth0.com/oauth/legacy/grant-type/ro`. Check [our documentation](https://auth0.com/docs/clients/client-grant-types) for more info and how to enable it.
*/
@available(*, deprecated, message: "see login(usernameOrEmail username:, password:, realm:, audience:, scope:)")
Expand Down Expand Up @@ -540,7 +540,7 @@ public protocol Authentication: Trackable, Loggable {
```

- parameter token: token obtained by authenticating the user
- warning: this method is deprecated in favor of `userInfo(withAccessToken accessToken:)`
- warning: deprecated in favor of `userInfo(withAccessToken accessToken:)`
- returns: a request that will yield token information
*/
@available(*, deprecated, message: "see userInfo(withAccessToken accessToken:)")
Expand All @@ -559,8 +559,9 @@ public protocol Authentication: Trackable, Loggable {
- parameter token: token obtained by authenticating the user

- returns: a request that will yield user information
- warning: for OIDC-conformant clients please use `userInfo(withAccessToken accessToken:)`
- warning: deprecated in favor of `userInfo(withAccessToken accessToken:)`
*/
@available(*, deprecated, message: "see userInfo(withAccessToken accessToken:)")
func userInfo(token: String) -> Request<Profile, AuthenticationError>

/**
Expand Down Expand Up @@ -606,9 +607,10 @@ public protocol Authentication: Trackable, Loggable {
- parameter parameters: additional parameters sent during authentication

- returns: a request that will yield Auth0 user's credentials
- warning: disabled for OIDC-conformant clients, an alternative will be added in a future release
- warning: deprecated as it is not available for OIDC-conformant clients
- requires: Legacy Grant `http://auth0.com/oauth/legacy/grant-type/access_token`. Check [our documentation](https://auth0.com/docs/clients/client-grant-types) for more info and how to enable it.
*/
@available(*, deprecated, message: "not available for OIDC-conformant clients")
func loginSocial(token: String, connection: String, scope: String, parameters: [String: Any]) -> Request<Credentials, AuthenticationError>

/**
Expand Down Expand Up @@ -677,7 +679,7 @@ public protocol Authentication: Trackable, Loggable {
- parameter fullName: The full name property returned with the Apple ID Credentials

- returns: a request that will yield Auth0 user's credentials
- warning: this method is deprecated in favor of `login(appleAuthorizationCode authorizationCode:, fullName:, scope:, audience:)`
- warning: deprecated in favor of `login(appleAuthorizationCode authorizationCode:, fullName:, scope:, audience:)`
*/
@available(*, deprecated, message: "see login(appleAuthorizationCode authorizationCode:, fullName:, scope:, audience:)")
func tokenExchange(withAppleAuthorizationCode authCode: String, scope: String?, audience: String?, fullName: PersonNameComponents?) -> Request<Credentials, AuthenticationError>
Expand Down Expand Up @@ -710,9 +712,11 @@ public protocol Authentication: Trackable, Loggable {
/**
Calls delegation endpoint with the given parameters.
The only parameters it adds by default are `grant_type` and `client_id`.
- parameter parametes: dictionary with delegation parameters to send in the request.
- parameter parameters: dictionary with delegation parameters to send in the request.
- returns: a request that will yield the result of delegation
- warning: deprecated due to the `/delegation` endpoint being deprecated
*/
@available(*, deprecated, message: "the delegation endpoint is deprecated")
func delegation(withParameters parameters: [String: Any]) -> Request<[String: Any], AuthenticationError>

/**
Expand Down
8 changes: 7 additions & 1 deletion Auth0/DesktopWebAuth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ typealias Auth0WebAuth = DesktopWebAuth
Resumes the current Auth session (if any).

- parameter urls: urls received by the macOS application in AppDelegate
- warning: deprecated as the SDK will not support macOS versions older than Catalina
*/
@available(*, deprecated, message: "the SDK will not support macOS versions older than Catalina")
public func resumeAuth(_ urls: [URL]) {
guard let url = urls.first else { return }
_ = TransactionStore.shared.resume(url)
Expand All @@ -60,7 +62,9 @@ public extension _ObjectiveOAuth2 {
Resumes the current Auth session (if any).

- parameter urls: urls received by the macOS application in AppDelegate
- warning: deprecated as the SDK will not support macOS versions older than Catalina
*/
@available(*, deprecated, message: "the SDK will not support macOS versions older than Catalina")
@objc(resumeAuthWithURLs:)
static func resume(_ urls: [URL]) {
resumeAuth(urls)
Expand All @@ -71,13 +75,15 @@ public extension _ObjectiveOAuth2 {
public protocol AuthResumable {

/**
Resumes the transaction when the third party application notifies the application using an url with a custom scheme.
Resumes the transaction when the third party application notifies the application using a url with a custom scheme.
This method should be called from the Application's `AppDelegate` or by using the `public func resumeAuth(_ urls: [URL])` method.

- parameter url: the url sent by the third party application that contains the result of the Auth

- returns: if the url was expected and properly formatted otherwise it will return `false`.
- warning: deprecated as the SDK will not support macOS versions older than Catalina
*/
@available(*, deprecated, message: "the SDK will not support macOS versions older than Catalina")
func resume(_ url: URL) -> Bool

}
Expand Down
6 changes: 3 additions & 3 deletions Auth0/MobileWebAuth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,11 @@ public extension _ObjectiveOAuth2 {
public protocol AuthResumable {

/**
Resumes the transaction when the third party application notifies the application using an url with a custom scheme.
Resumes the transaction when the third party application notifies the application using a url with a custom scheme.
This method should be called from the Application's `AppDelegate` or using `public func resumeAuth(_ url: URL, options: [UIApplicationOpenURLOptionsKey: Any]) -> Bool` method.

- parameter url: the url send by the third party application that contains the result of the Auth
- parameter options: options recieved in the openUrl method of the `AppDelegate`
- parameter options: options received in the openUrl method of the `AppDelegate`

- returns: if the url was expected and properly formatted otherwise it will return `false`.
*/
Expand All @@ -240,7 +240,7 @@ public extension AuthResumable {
- parameter url: url received in application's AppDelegate
- parameter options: a dictionary of launch options received from application's AppDelegate

- returns: `true` if the url completed (successfuly or not) this session, `false` otherwise
- returns: `true` if the url completed (successfully or not) this session, `false` otherwise
*/
func resume(_ url: URL, options: [A0URLOptionsKey: Any] = [:]) -> Bool {
return self.resume(url, options: options)
Expand Down
10 changes: 5 additions & 5 deletions Auth0/NativeAuth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#if WEB_AUTH_PLATFORM
/**
The NativeAuthCredentials struct defines the data requirements necessary to be returned
from a successul authentication with an IdP SDK as part of the NativeAuthTransaction process.
from a successful authentication with an IdP SDK as part of the NativeAuthTransaction process.
*/
public struct NativeAuthCredentials {
/// Access token returned by the IdP SDK
Expand All @@ -47,7 +47,7 @@ public struct NativeAuthCredentials {
Represent a Auth transaction where the user first authenticates with a third party Identity Provider (IdP) and then tries to perform Auth with Auth0.
This is usually used when a Social connection has a native SDK, e.g. Facebook, and for usability or need to call the IdP API the SDK should be used to login.

When implemeting this protocol you only need to take care of the IdP authentication and yield it's results so the Auth0 part of the flow will be taken care of for you
When implementing this protocol you only need to take care of the IdP authentication and yield it's results so the Auth0 part of the flow will be taken care of for you

To accomplish this the results of the IdP authentication should be send using the callback received when the method `func auth(callback: @escaping Callback) -> ()` is called.

Expand All @@ -61,7 +61,7 @@ public protocol NativeAuthTransaction: AuthTransaction {
var connection: String { get }
/// Additional authentication parameters sent to Auth0 to perform the final auth
var parameters: [String: Any] { get }
/// Authenticaton object to perform the Auth0 social auth
/// Authentication object to perform the Auth0 social auth
var authentication: Authentication { get }

/// Callback where the result of the native authentication is sent
Expand All @@ -70,10 +70,10 @@ public protocol NativeAuthTransaction: AuthTransaction {
/**
Starts the native Auth flow using the IdP SDK and once completed it will notify the result using the callback.

On sucesss the IdP access token, and any parameter needed by Auth0 to authenticate, should be used to create a `NativeAuthCredentials`.
On success the IdP access token, and any parameter needed by Auth0 to authenticate, should be used to create a `NativeAuthCredentials`.

```
let credetials = NativeAuthCredentials(token: "{IdP Token}", extras: [:])
let credentials = NativeAuthCredentials(token: "{IdP Token}", extras: [:])
let result = Auth0.Result.success(credentials)
```
- parameter callback: callback with the IdP credentials on success or the cause of the error.
Expand Down
2 changes: 2 additions & 0 deletions Auth0/WebAuthenticatable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ public protocol WebAuthenticatable: Trackable, Loggable {
Before enabling this flag you'll need to configure Universal Links

- returns: the same WebAuth instance to allow method chaining
- warning: deprecated as Universal Links cannot be used as OAuth callbacks anymore. See https://openradar.appspot.com/51091611
*/
@available(*, deprecated, message: "cannot be used anymore, see https://openradar.appspot.com/51091611")
func useUniversalLink() -> Self

/**
Expand Down
4 changes: 0 additions & 4 deletions OAuth2Mac/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,4 @@ class AppDelegate: NSObject, NSApplicationDelegate {
// Insert code here to tear down your application
}

func application(_ application: NSApplication, open urls: [URL]) {
Auth0.resumeAuth(urls)
}

}