@@ -149,26 +149,20 @@ public final class MSALNativeAuthPublicClientApplication: MSALPublicClientApplic
149
149
150
150
// MARK: delegate methods
151
151
152
- /// Sign up a user with a given username and password .
152
+ /// Sign up a user using parameters .
153
153
/// - Parameters:
154
- /// - username: Username for the new account.
155
- /// - password: Optional. Password to be used for the new account.
156
- /// - attributes: Optional. User attributes to be used during account creation.
157
- /// - correlationId: Optional. UUID to correlate this request with the server for debugging.
154
+ /// - parameters: Parameters used for the Sign Up flow.
158
155
/// - delegate: Delegate that receives callbacks for the Sign Up flow.
159
156
public func signUp(
160
- username: String ,
161
- password: String ? = nil ,
162
- attributes: [ String : Any ] ? = nil ,
163
- correlationId: UUID ? = nil ,
157
+ parameters: MSALNativeAuthSignUpParameters ,
164
158
delegate: SignUpStartDelegate
165
159
) {
166
160
Task {
167
161
let controllerResponse = await signUpInternal (
168
- username: username,
169
- password: password,
170
- attributes: attributes,
171
- correlationId: correlationId
162
+ username: parameters . username,
163
+ password: parameters . password,
164
+ attributes: parameters . attributes,
165
+ correlationId: parameters . correlationId
172
166
)
173
167
174
168
let delegateDispatcher = SignUpStartDelegateDispatcher ( delegate: delegate, telemetryUpdate: controllerResponse. telemetryUpdate)
@@ -190,26 +184,47 @@ public final class MSALNativeAuthPublicClientApplication: MSALPublicClientApplic
190
184
}
191
185
}
192
186
193
- /// Sign in a user with a given username and password.
187
+ /// Sign up a user with a given username and password.
194
188
/// - Parameters:
195
- /// - username: Username for the account
196
- /// - password: Optional. Password for the account.
197
- /// - scopes : Optional. Permissions you want included in the access token received after sign in flow has completed .
189
+ /// - username: Username for the new account.
190
+ /// - password: Optional. Password to be used for the new account.
191
+ /// - attributes : Optional. User attributes to be used during account creation .
198
192
/// - correlationId: Optional. UUID to correlate this request with the server for debugging.
199
- /// - delegate: Delegate that receives callbacks for the Sign In flow.
200
- public func signIn(
193
+ /// - delegate: Delegate that receives callbacks for the Sign Up flow.
194
+ @available ( * , deprecated, message: " This method is now deprecated. Use the method 'signUp(parameters:)' instead. " )
195
+ public func signUp(
201
196
username: String ,
202
197
password: String ? = nil ,
203
- scopes : [ String ] ? = nil ,
198
+ attributes : [ String : Any ] ? = nil ,
204
199
correlationId: UUID ? = nil ,
200
+ delegate: SignUpStartDelegate
201
+ ) {
202
+ Task {
203
+ let parameters = MSALNativeAuthSignUpParameters ( username: username)
204
+ parameters. password = password
205
+ parameters. attributes = attributes
206
+ parameters. correlationId = correlationId
207
+ signUp (
208
+ parameters: parameters,
209
+ delegate: delegate
210
+ )
211
+ }
212
+ }
213
+
214
+ /// Sign in a user using parameters.
215
+ /// - Parameters:
216
+ /// - parameters: Parameters used for the Sign In flow.
217
+ /// - delegate: Delegate that receives callbacks for the Sign In flow.
218
+ public func signIn(
219
+ parameters: MSALNativeAuthSignInParameters ,
205
220
delegate: SignInStartDelegate
206
221
) {
207
222
Task {
208
223
let controllerResponse = await signInInternal (
209
- username: username,
210
- password: password,
211
- scopes: scopes,
212
- correlationId: correlationId
224
+ username: parameters . username,
225
+ password: parameters . password,
226
+ scopes: parameters . scopes,
227
+ correlationId: parameters . correlationId
213
228
)
214
229
215
230
let delegateDispatcher = SignInStartDelegateDispatcher ( delegate: delegate, telemetryUpdate: controllerResponse. telemetryUpdate)
@@ -235,18 +250,42 @@ public final class MSALNativeAuthPublicClientApplication: MSALPublicClientApplic
235
250
}
236
251
}
237
252
238
- /// Reset the password for a given username.
253
+ /// Sign in a user with a given username and password .
239
254
/// - Parameters:
240
- /// - username: Username for the account.
255
+ /// - username: Username for the account
256
+ /// - password: Optional. Password for the account.
257
+ /// - scopes: Optional. Permissions you want included in the access token received after sign in flow has completed.
241
258
/// - correlationId: Optional. UUID to correlate this request with the server for debugging.
242
- /// - delegate: Delegate that receives callbacks for the Reset Password flow.
243
- public func resetPassword(
259
+ /// - delegate: Delegate that receives callbacks for the Sign In flow.
260
+ @available ( * , deprecated, message: " This method is now deprecated. Use the method 'signIn(parameters:)' instead. " )
261
+ public func signIn(
244
262
username: String ,
263
+ password: String ? = nil ,
264
+ scopes: [ String ] ? = nil ,
245
265
correlationId: UUID ? = nil ,
266
+ delegate: SignInStartDelegate
267
+ ) {
268
+ let parameters = MSALNativeAuthSignInParameters ( username: username)
269
+ parameters. password = password
270
+ parameters. scopes = scopes
271
+ parameters. correlationId = correlationId
272
+ signIn (
273
+ parameters: parameters,
274
+ delegate: delegate
275
+ )
276
+ }
277
+
278
+ /// Reset the password using parameters
279
+ /// - Parameters:
280
+ /// - parameters: Parameters used for the Reset Password flow.
281
+ /// - delegate: Delegate that receives callbacks for the Reset Password flow.
282
+ public func resetPassword(
283
+ parameters: MSALNativeAuthResetPasswordParameters ,
246
284
delegate: ResetPasswordStartDelegate
247
285
) {
248
286
Task {
249
- let controllerResponse = await resetPasswordInternal ( username: username, correlationId: correlationId)
287
+ let controllerResponse = await resetPasswordInternal ( username: parameters. username,
288
+ correlationId: parameters. correlationId)
250
289
251
290
let delegateDispatcher = ResetPasswordStartDelegateDispatcher ( delegate: delegate, telemetryUpdate: controllerResponse. telemetryUpdate)
252
291
@@ -265,6 +304,25 @@ public final class MSALNativeAuthPublicClientApplication: MSALPublicClientApplic
265
304
}
266
305
}
267
306
307
+ /// Reset the password for a given username.
308
+ /// - Parameters:
309
+ /// - username: Username for the account.
310
+ /// - correlationId: Optional. UUID to correlate this request with the server for debugging.
311
+ /// - delegate: Delegate that receives callbacks for the Reset Password flow.
312
+ @available ( * , deprecated, message: " This method is now deprecated. Use the method 'resetPassword(parameters:)' instead. " )
313
+ public func resetPassword(
314
+ username: String ,
315
+ correlationId: UUID ? = nil ,
316
+ delegate: ResetPasswordStartDelegate
317
+ ) {
318
+ let parameters = MSALNativeAuthResetPasswordParameters ( username: username)
319
+ parameters. correlationId = correlationId
320
+ resetPassword (
321
+ parameters: parameters,
322
+ delegate: delegate
323
+ )
324
+ }
325
+
268
326
/// Retrieve the current signed in account from the cache.
269
327
/// - Parameter correlationId: Optional. UUID to correlate this request with the server for debugging.
270
328
/// - Returns: An object representing the account information if present in the local cache.
0 commit comments