Skip to content

Commit 8ade053

Browse files
authored
Merge branch 'master' into Fix_LiveQuery_decode_issue
2 parents 61f1c28 + 13e68c2 commit 8ade053

File tree

27 files changed

+249
-35
lines changed

27 files changed

+249
-35
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# [6.1.0](https://github.com/parse-community/Parse-SDK-iOS-OSX/compare/6.0.1...6.1.0) (2025-11-18)
2+
3+
4+
### Features
5+
6+
* Add `PFUser.logInWithUsernameInBackground` that takes additional auth data ([#1858](https://github.com/parse-community/Parse-SDK-iOS-OSX/issues/1858)) ([0854f8d](https://github.com/parse-community/Parse-SDK-iOS-OSX/commit/0854f8d844986ff1dab4f19fcdb68c0eba012eb4))
7+
18
## [6.0.1](https://github.com/parse-community/Parse-SDK-iOS-OSX/compare/6.0.0...6.0.1) (2025-11-17)
29

310

Parse/Parse/Internal/Commands/PFRESTUserCommand.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ NS_ASSUME_NONNULL_BEGIN
2323
password:(NSString *)password
2424
revocableSession:(BOOL)revocableSessionEnabled
2525
error:(NSError **)error;
26+
/**
27+
Creates a login command with a JSON body, allowing additional parameters such as authData.
28+
29+
This posts to the login route and is required for features like MFA where additional
30+
authentication data must be supplied alongside username/password.
31+
*/
32+
+ (instancetype)logInUserCommandWithParameters:(NSDictionary *)parameters
33+
revocableSession:(BOOL)revocableSessionEnabled
34+
error:(NSError **)error;
2635
+ (instancetype)serviceLoginUserCommandWithAuthenticationType:(NSString *)authenticationType
2736
authenticationData:(NSDictionary *)authenticationData
2837
revocableSession:(BOOL)revocableSessionEnabled

Parse/Parse/Internal/Commands/PFRESTUserCommand.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@ + (instancetype)logInUserCommandWithUsername:(NSString *)username
6565
error:error];
6666
}
6767

68+
+ (instancetype)logInUserCommandWithParameters:(NSDictionary *)parameters
69+
revocableSession:(BOOL)revocableSessionEnabled
70+
error:(NSError **)error {
71+
// Use POST /login for body parameters like authData
72+
return [self _commandWithHTTPPath:@"login"
73+
httpMethod:PFHTTPRequestMethodPOST
74+
parameters:parameters
75+
sessionToken:nil
76+
revocableSession:revocableSessionEnabled
77+
error:error];
78+
}
79+
6880
+ (instancetype)serviceLoginUserCommandWithAuthenticationType:(NSString *)authenticationType
6981
authenticationData:(NSDictionary *)authenticationData
7082
revocableSession:(BOOL)revocableSessionEnabled

Parse/Parse/Internal/User/Controller/PFUserController.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ NS_ASSUME_NONNULL_BEGIN
3838
- (BFTask *)logInCurrentUserAsyncWithUsername:(NSString *)username
3939
password:(NSString *)password
4040
revocableSession:(BOOL)revocableSession;
41+
/**
42+
Logs in the current user using username/password and additional parameters such as authData.
43+
The parameters dictionary can include keys like @"authData": @{ "mfa": @{ ... } } to support MFA flows.
44+
*/
45+
- (BFTask *)logInCurrentUserAsyncWithUsername:(NSString *)username
46+
password:(NSString *)password
47+
parameters:(nullable NSDictionary *)parameters
48+
revocableSession:(BOOL)revocableSession;
4149

4250
//TODO: (nlutsenko) Move this method into PFUserAuthenticationController after PFUser is decoupled further.
4351
- (BFTask *)logInCurrentUserAsyncWithAuthType:(NSString *)authType

Parse/Parse/Internal/User/Controller/PFUserController.m

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,20 @@ - (BFTask *)logInCurrentUserAsyncWithSessionToken:(NSString *)sessionToken {
6666
message:@"Invalid Session Token."]];
6767
}
6868

69-
PFUser *user = [PFUser _objectFromDictionary:dictionary
69+
// Sanitize response: do not persist transient MFA authData provider
70+
NSMutableDictionary *sanitized = [dictionary mutableCopy];
71+
id authData = sanitized[@"authData"];
72+
if ([authData isKindOfClass:[NSDictionary class]] && authData[@"mfa"]) {
73+
NSMutableDictionary *mutableAuth = [authData mutableCopy];
74+
[mutableAuth removeObjectForKey:@"mfa"]; // transient provider, do not persist
75+
if (mutableAuth.count > 0) {
76+
sanitized[@"authData"] = mutableAuth;
77+
} else {
78+
[sanitized removeObjectForKey:@"authData"];
79+
}
80+
}
81+
82+
PFUser *user = [PFUser _objectFromDictionary:sanitized
7083
defaultClassName:[PFUser parseClassName]
7184
completeData:YES];
7285
// Serialize the object to disk so we can later access it via currentUser
@@ -113,6 +126,46 @@ - (BFTask *)logInCurrentUserAsyncWithUsername:(NSString *)username
113126
}];
114127
}
115128

129+
- (BFTask *)logInCurrentUserAsyncWithUsername:(NSString *)username
130+
password:(NSString *)password
131+
parameters:(NSDictionary *)parameters
132+
revocableSession:(BOOL)revocableSession {
133+
@weakify(self);
134+
return [[BFTask taskFromExecutor:[BFExecutor defaultPriorityBackgroundExecutor] withBlock:^id{
135+
NSError *error = nil;
136+
NSMutableDictionary *merged = [@{ @"username": username ?: @"",
137+
@"password": password ?: @"" } mutableCopy];
138+
if (parameters.count > 0) {
139+
// Prevent authData from being persisted later by only sending it with the request body
140+
// and not mutating the PFUser object here. The server response will drive authData merge.
141+
[merged addEntriesFromDictionary:parameters];
142+
}
143+
PFRESTCommand *command = [PFRESTUserCommand logInUserCommandWithParameters:merged
144+
revocableSession:revocableSession
145+
error:&error];
146+
PFPreconditionReturnFailedTask(command, error);
147+
return [self.commonDataSource.commandRunner runCommandAsync:command
148+
withOptions:PFCommandRunningOptionRetryIfFailed];
149+
}] continueWithSuccessBlock:^id(BFTask *task) {
150+
@strongify(self);
151+
PFCommandResult *result = task.result;
152+
NSDictionary *dictionary = result.result;
153+
154+
if ([dictionary isKindOfClass:[NSNull class]] || !dictionary) {
155+
return [BFTask taskWithError:[PFErrorUtilities errorWithCode:kPFErrorObjectNotFound
156+
message:@"Invalid login credentials."]];
157+
}
158+
159+
PFUser *user = [PFUser _objectFromDictionary:dictionary
160+
defaultClassName:[PFUser parseClassName]
161+
completeData:YES];
162+
PFCurrentUserController *controller = self.coreDataSource.currentUserController;
163+
return [[controller saveCurrentObjectAsync:user] continueWithBlock:^id(BFTask *task) {
164+
return user;
165+
}];
166+
}];
167+
}
168+
116169
- (BFTask *)logInCurrentUserAsyncWithAuthType:(NSString *)authType
117170
authData:(NSDictionary *)authData
118171
revocableSession:(BOOL)revocableSession {

Parse/Parse/Resources/Parse-OSX.Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
<key>CFBundlePackageType</key>
1414
<string>FMWK</string>
1515
<key>CFBundleShortVersionString</key>
16-
<string>6.0.1</string>
16+
<string>6.1.0</string>
1717
<key>CFBundleSignature</key>
1818
<string>????</string>
1919
<key>CFBundleVersion</key>
20-
<string>6.0.1</string>
20+
<string>6.1.0</string>
2121
</dict>
2222
</plist>

Parse/Parse/Resources/Parse-iOS.Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
<key>CFBundlePackageType</key>
1414
<string>FMWK</string>
1515
<key>CFBundleShortVersionString</key>
16-
<string>6.0.1</string>
16+
<string>6.1.0</string>
1717
<key>CFBundleSignature</key>
1818
<string>????</string>
1919
<key>CFBundleSupportedPlatforms</key>
2020
<array>
2121
<string>iPhoneOS</string>
2222
</array>
2323
<key>CFBundleVersion</key>
24-
<string>6.0.1</string>
24+
<string>6.1.0</string>
2525
<key>MinimumOSVersion</key>
2626
<string>12.0</string>
2727
</dict>

Parse/Parse/Resources/Parse-tvOS.Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>6.0.1</string>
18+
<string>6.1.0</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>6.0.1</string>
22+
<string>6.1.0</string>
2323
<key>NSPrincipalClass</key>
2424
<string/>
2525
</dict>

Parse/Parse/Resources/Parse-watchOS.Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>6.0.1</string>
18+
<string>6.1.0</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>6.0.1</string>
22+
<string>6.1.0</string>
2323
<key>NSPrincipalClass</key>
2424
<string/>
2525
</dict>

Parse/Parse/Source/PFConstants.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#pragma mark - SDK Version
1515
///--------------------------------------
1616

17-
#define PARSE_VERSION @"6.0.1"
17+
#define PARSE_VERSION @"6.1.0"
1818

1919
///--------------------------------------
2020
#pragma mark - Platform

0 commit comments

Comments
 (0)