- fix load credentials

This commit is contained in:
Giuseppe Nucifora 2018-04-10 18:50:53 +02:00
parent ab78379716
commit e93483ea53
9 changed files with 26 additions and 10 deletions

View File

@ -49,6 +49,8 @@
NSLogDebug(@"%@",[[PNObjectConfig sharedInstance] endPointPath]); NSLogDebug(@"%@",[[PNObjectConfig sharedInstance] endPointPath]);
NSLogDebug(@"%@",[[PNObjectConfig sharedInstance] endPointUrl]); NSLogDebug(@"%@",[[PNObjectConfig sharedInstance] endPointUrl]);
[[PNObjectConfig sharedInstance] loadManagersWithCredentials];
PNObjViewController *viewController = [[PNObjViewController alloc] init]; PNObjViewController *viewController = [[PNObjViewController alloc] init];
switch ([[UIDevice currentDevice] deviceFamily]) { switch ([[UIDevice currentDevice] deviceFamily]) {

View File

@ -38,7 +38,7 @@ PODS:
- NSString-Helper (1.0.6) - NSString-Helper (1.0.6)
- nv-ios-http-status (0.0.1) - nv-ios-http-status (0.0.1)
- PEAR-FileManager-iOS (1.3.1) - PEAR-FileManager-iOS (1.3.1)
- PNObject (2.5.1): - PNObject (2.5.5):
- AFNetworking - AFNetworking
- CodFis-Helper - CodFis-Helper
- DDDKeychainWrapper - DDDKeychainWrapper
@ -85,7 +85,7 @@ SPEC CHECKSUMS:
NSString-Helper: 389265918b2a4c5b0d09f0e03c607e8e5e254dd7 NSString-Helper: 389265918b2a4c5b0d09f0e03c607e8e5e254dd7
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3 PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
PNObject: 727e7724717c5c3b4d995b0dfa246897fe4d39de PNObject: 3ae0dbf81fa7b6def670f6fb7636095208b0b071
PureLayout: 4d550abe49a94f24c2808b9b95db9131685fe4cd PureLayout: 4d550abe49a94f24c2808b9b95db9131685fe4cd
RZDataBinding: 6981e90ddaae2f5e02028323b1043f8c31013109 RZDataBinding: 6981e90ddaae2f5e02028323b1043f8c31013109
Specta: 3e1bd89c3517421982dc4d1c992503e48bd5fe66 Specta: 3e1bd89c3517421982dc4d1c992503e48bd5fe66

View File

@ -1,6 +1,6 @@
{ {
"name": "PNObject", "name": "PNObject",
"version": "2.5.1", "version": "2.5.5",
"summary": "PNObject is a simple replica of the more complex ParseObject", "summary": "PNObject is a simple replica of the more complex ParseObject",
"homepage": "https://github.com/giuseppenucifora/PNObject", "homepage": "https://github.com/giuseppenucifora/PNObject",
"license": { "license": {
@ -12,7 +12,7 @@
}, },
"source": { "source": {
"git": "https://github.com/giuseppenucifora/PNObject.git", "git": "https://github.com/giuseppenucifora/PNObject.git",
"tag": "2.5.1" "tag": "2.5.5"
}, },
"platforms": { "platforms": {
"ios": "8.0" "ios": "8.0"

View File

@ -38,7 +38,7 @@ PODS:
- NSString-Helper (1.0.6) - NSString-Helper (1.0.6)
- nv-ios-http-status (0.0.1) - nv-ios-http-status (0.0.1)
- PEAR-FileManager-iOS (1.3.1) - PEAR-FileManager-iOS (1.3.1)
- PNObject (2.5.1): - PNObject (2.5.5):
- AFNetworking - AFNetworking
- CodFis-Helper - CodFis-Helper
- DDDKeychainWrapper - DDDKeychainWrapper
@ -85,7 +85,7 @@ SPEC CHECKSUMS:
NSString-Helper: 389265918b2a4c5b0d09f0e03c607e8e5e254dd7 NSString-Helper: 389265918b2a4c5b0d09f0e03c607e8e5e254dd7
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3 PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
PNObject: 727e7724717c5c3b4d995b0dfa246897fe4d39de PNObject: 3ae0dbf81fa7b6def670f6fb7636095208b0b071
PureLayout: 4d550abe49a94f24c2808b9b95db9131685fe4cd PureLayout: 4d550abe49a94f24c2808b9b95db9131685fe4cd
RZDataBinding: 6981e90ddaae2f5e02028323b1043f8c31013109 RZDataBinding: 6981e90ddaae2f5e02028323b1043f8c31013109
Specta: 3e1bd89c3517421982dc4d1c992503e48bd5fe66 Specta: 3e1bd89c3517421982dc4d1c992503e48bd5fe66

View File

@ -8,7 +8,7 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'PNObject' s.name = 'PNObject'
s.version = '2.5.1' s.version = '2.5.5'
s.summary = 'PNObject is a simple replica of the more complex ParseObject' s.summary = 'PNObject is a simple replica of the more complex ParseObject'

View File

@ -117,7 +117,7 @@ static bool isFirstAccess = YES;
} }
- (BOOL) hasValidEmailAndPasswordData { - (BOOL) hasValidEmailAndPasswordData {
if(self.email && [self.email isValidEmail] && self.password && [self.password isValid]){ if(self.email && [self.email isValidEmail] && self.password && [self.password isKindOfClass:[PNObjcPassword class]] && [self.password isValid]){
return YES; return YES;
} }

View File

@ -17,6 +17,9 @@
extern NSString* _Nonnull const PNObjectEncryptionKey; extern NSString* _Nonnull const PNObjectEncryptionKey;
extern NSString* _Nonnull const PNObjectEncryptionNonce; extern NSString* _Nonnull const PNObjectEncryptionNonce;
extern NSString* _Nonnull const PNObjectServiceClientCredentialIdentifier;
extern NSString* _Nonnull const PNObjectServiceUserCredentialIdentifier;
#pragma mark LocalNotification Keys #pragma mark LocalNotification Keys
extern NSString* _Nonnull const PNObjectLocalNotificationRefreshTokenClientCredentialSuccess; extern NSString* _Nonnull const PNObjectLocalNotificationRefreshTokenClientCredentialSuccess;
@ -246,6 +249,8 @@ typedef NS_ENUM(NSInteger, OAuthMode) {
*/ */
- (BOOL) setCredentialTokenForOauthMode:(OAuthMode) oauthMode; - (BOOL) setCredentialTokenForOauthMode:(OAuthMode) oauthMode;
- (void) loadManagersWithCredentials;
- (AFOAuthCredential * _Nullable) currentOauthClientCredential; - (AFOAuthCredential * _Nullable) currentOauthClientCredential;
- (AFOAuthCredential * _Nullable) currentOauthUserCredential; - (AFOAuthCredential * _Nullable) currentOauthUserCredential;

View File

@ -296,7 +296,9 @@ static bool isFirstAccess = YES;
NSLogDebug(@"%@",[[_configuration objectForKey:_currentEnv] objectForKey:BaseUrl]); NSLogDebug(@"%@",[[_configuration objectForKey:_currentEnv] objectForKey:BaseUrl]);
NSAssert(_currentUserCredenzialEndPointUrl,@"Selected environment generate error. Please check configuration"); NSAssert(_currentUserCredenzialEndPointUrl,@"Selected environment generate error. Please check configuration");
}
- (void) loadManagersWithCredentials {
if (_currentClientCredenzialClientID && _currentClientCredenzialClientSecret) { if (_currentClientCredenzialClientID && _currentClientCredenzialClientSecret) {
[self clientCredentialAuthManager]; [self clientCredentialAuthManager];
} }
@ -308,7 +310,6 @@ static bool isFirstAccess = YES;
[self manager]; [self manager];
} }
- (NSString * _Nonnull) getEnvironment { - (NSString * _Nonnull) getEnvironment {
return _currentEnv; return _currentEnv;
} }

View File

@ -48,6 +48,8 @@ Configure PNObject endpoint client ID, client secret and OAuthModePassword with
[[PNObjectConfig sharedInstance] setEnvironment:EnvironmentStage]; [[PNObjectConfig sharedInstance] setEnvironment:EnvironmentStage];
[[PNObjectConfig sharedInstance] loadManagersWithCredentials];
} }
``` ```
@ -81,6 +83,8 @@ Configure PNObject endpoint client ID, client secret and OAuthModePassword
[[PNObjectConfig sharedInstance] setOauthUserName:@"admin" oauthPassword:@"admin" forEnv:EnvironmentStage]; [[PNObjectConfig sharedInstance] setOauthUserName:@"admin" oauthPassword:@"admin" forEnv:EnvironmentStage];
[[PNObjectConfig sharedInstance] setEnvironment:EnvironmentStage]; [[PNObjectConfig sharedInstance] setEnvironment:EnvironmentStage];
[[PNObjectConfig sharedInstance] loadManagersWithCredentials];
} }
``` ```
### ###
@ -101,6 +105,8 @@ Configure PNObject endpoint client ID, client secret and OAuthModeClientCredenti
[[PNObjectConfig sharedInstance] setClientID:@"xxxxxxxxx" clientSecret:@"xxxxxxxxxxxx" forEnv:EnvironmentProduction]; [[PNObjectConfig sharedInstance] setClientID:@"xxxxxxxxx" clientSecret:@"xxxxxxxxxxxx" forEnv:EnvironmentProduction];
[[PNObjectConfig sharedInstance] setEnvironment:EnvironmentStage]; [[PNObjectConfig sharedInstance] setEnvironment:EnvironmentStage];
[[PNObjectConfig sharedInstance] loadManagersWithCredentials];
} }
``` ```
### ###
@ -120,6 +126,8 @@ Configure PNObject endpoint and using custom PNUser object
[[PNObjectConfig sharedInstance] setClientID:@"xxxxxxxxx" clientSecret:@"xxxxxxxxxxxx" forEnv:EnvironmentProduction]; [[PNObjectConfig sharedInstance] setClientID:@"xxxxxxxxx" clientSecret:@"xxxxxxxxxxxx" forEnv:EnvironmentProduction];
[[PNObjectConfig sharedInstance] setEnvironment:EnvironmentStage]; [[PNObjectConfig sharedInstance] setEnvironment:EnvironmentStage];
[[PNObjectConfig sharedInstance] loadManagersWithCredentials];
} }
``` ```