- ripristinate - (void) setOauthUserName:(NSString * _Nonnull)oauthUserName oauthPassword:(NSString* _Nonnull) oauthPassword forEnv:(NSString * _Nonnull) environment
This commit is contained in:
parent
cd55374ea8
commit
9266ae3689
@ -33,21 +33,17 @@
|
|||||||
_window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
_window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
||||||
// Override point for customization after application launch.
|
// Override point for customization after application launch.
|
||||||
|
|
||||||
/**
|
|
||||||
[PNObjectConfig initSharedInstanceForEnvironments:@{EnvironmentDevelopment : @{BaseUrl:@"http://pnobject.local/",EndpointPath:@"api/v1/"},
|
[PNObjectConfig initSharedInstanceForEnvironments:@{EnvironmentDevelopment : @{BaseUrl:@"http://pnobject.local/",EndpointPath:@"api/v1/"},
|
||||||
EnvironmentStage : @{BaseUrl:@"https://pnobject.stage.it/",EndpointPath:@"api/v1/"},
|
EnvironmentStage : @{BaseUrl:@"https://pnobject.stage.it/",EndpointPath:@"api/v1/"},
|
||||||
EnvironmentProduction : @{BaseUrl:@"http://pnobject.prod.it/",EndpointPath:@"api/v1/"},
|
EnvironmentProduction : @{BaseUrl:@"http://pnobject.prod.it/",EndpointPath:@"api/v1/"},
|
||||||
} andUserSubclass:[PNUser class]];
|
} andUserSubclass:[PNUser class]];
|
||||||
|
|
||||||
[[PNObjectConfig sharedInstance] setClientID:@"******" clientSecret:@"******" oAuthEndpointAction:@"api/v1/" oauthMode:OAuthModeClientCredential forEnv:EnvironmentStage];
|
|
||||||
[[PNObjectConfig sharedInstance] setClientID:@"******" clientSecret:@"******" oAuthEndpointAction:@"api/v1/" oauthMode:OAuthModePassword forEnv:EnvironmentStage];
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/** Can user special char %@ to autoset EndpointPath to Oauth endpointPath */
|
/** Can user special char %@ to autoset EndpointPath to Oauth endpointPath */
|
||||||
[[PNObjectConfig sharedInstance] setClientID:@"******" clientSecret:@"******" oAuthEndpointAction:@"%@oauth-token" oauthMode:OAuthModeClientCredential forEnv:EnvironmentStage];
|
[[PNObjectConfig sharedInstance] setClientID:@"******" clientSecret:@"******" oAuthEndpointAction:@"%@oauth-token" oauthMode:OAuthModeClientCredential forEnv:EnvironmentStage];
|
||||||
[[PNObjectConfig sharedInstance] setClientID:@"******" clientSecret:@"******" oAuthEndpointAction:@"%@oauth-token" oauthMode:OAuthModePassword forEnv:EnvironmentStage];
|
[[PNObjectConfig sharedInstance] setClientID:@"******" clientSecret:@"******" oAuthEndpointAction:@"%@oauth-token" oauthMode:OAuthModePassword forEnv:EnvironmentStage];
|
||||||
|
|
||||||
|
[[PNObjectConfig sharedInstance] setOauthUserName:@"admin" oauthPassword:@"admin" forEnv:EnvironmentStage];
|
||||||
|
|
||||||
[[PNObjectConfig sharedInstance] setEnvironment:EnvironmentStage];
|
[[PNObjectConfig sharedInstance] setEnvironment:EnvironmentStage];
|
||||||
|
|
||||||
NSLogDebug(@"%@",[[PNObjectConfig sharedInstance] baseUrl]);
|
NSLogDebug(@"%@",[[PNObjectConfig sharedInstance] baseUrl]);
|
||||||
|
|||||||
@ -134,6 +134,8 @@ typedef NS_ENUM(NSInteger, OAuthMode) {
|
|||||||
*/
|
*/
|
||||||
- (void) setClientID:(NSString * _Nonnull) clientID clientSecret:(NSString* _Nonnull) clientSecret oAuthEndpointAction:(NSString* _Nonnull) oAuthEndpointAction oauthMode:(OAuthMode) oauthMode forEnv:(NSString* _Nonnull) environment;
|
- (void) setClientID:(NSString * _Nonnull) clientID clientSecret:(NSString* _Nonnull) clientSecret oAuthEndpointAction:(NSString* _Nonnull) oAuthEndpointAction oauthMode:(OAuthMode) oauthMode forEnv:(NSString* _Nonnull) environment;
|
||||||
|
|
||||||
|
- (void) setOauthUserName:(NSString * _Nonnull)oauthUserName oauthPassword:(NSString* _Nonnull) oauthPassword forEnv:(NSString * _Nonnull) environment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <#Description#>
|
* <#Description#>
|
||||||
*
|
*
|
||||||
|
|||||||
@ -790,6 +790,22 @@ static bool isFirstAccess = YES;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) setOauthUserName:(NSString * _Nonnull)oauthUserName oauthPassword:(NSString* _Nonnull) oauthPassword forEnv:(NSString *) environment {
|
||||||
|
|
||||||
|
if ([_configuration objectForKey:environment]) {
|
||||||
|
|
||||||
|
NSMutableDictionary *currentConfigurationDict = [[NSMutableDictionary alloc] initWithDictionary:[_configuration objectForKey:environment]];
|
||||||
|
[currentConfigurationDict setObject:oauthUserName forKey:Client_Username];
|
||||||
|
[currentConfigurationDict setObject:oauthPassword forKey:Client_Password];
|
||||||
|
|
||||||
|
[_configuration setObject:currentConfigurationDict forKey:environment];
|
||||||
|
|
||||||
|
if (_currentEnv == environment) {
|
||||||
|
[self setEnvironment:environment];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL) setCredentialTokenForOauthMode:(OAuthMode) oauthMode {
|
- (BOOL) setCredentialTokenForOauthMode:(OAuthMode) oauthMode {
|
||||||
switch (oauthMode) {
|
switch (oauthMode) {
|
||||||
case OAuthModeClientCredential:
|
case OAuthModeClientCredential:
|
||||||
|
|||||||
@ -39,10 +39,10 @@ Configure PNObject endpoint client ID, client secret and OAuthModePassword with
|
|||||||
EnvironmentProduction : @{BaseUrl:@"http://pnobject.prod.it/",EndpointPath:@"api/v1/"},
|
EnvironmentProduction : @{BaseUrl:@"http://pnobject.prod.it/",EndpointPath:@"api/v1/"},
|
||||||
} userSubclass:[PNUser class]];
|
} userSubclass:[PNUser class]];
|
||||||
|
|
||||||
[[PNObjectConfig sharedInstance] setClientID:@"xxxxxxxxx" clientSecret:@"xxxxxxxxxxxx" forEnv:EnvironmentStage];
|
|
||||||
[[PNObjectConfig sharedInstance] setClientID:@"xxxxxxxxx" clientSecret:@"xxxxxxxxxxxx" forEnv:EnvironmentProduction];
|
|
||||||
|
|
||||||
|
|
||||||
|
/** Can user special char %@ to autoset EndpointPath to Oauth endpointPath */
|
||||||
|
[[PNObjectConfig sharedInstance] setClientID:@"******" clientSecret:@"******" oAuthEndpointAction:@"%@oauth-token" oauthMode:OAuthModeClientCredential forEnv:EnvironmentStage];
|
||||||
|
[[PNObjectConfig sharedInstance] setClientID:@"******" clientSecret:@"******" oAuthEndpointAction:@"%@oauth-token" oauthMode:OAuthModePassword forEnv:EnvironmentStage];
|
||||||
|
|
||||||
[[PNObjectConfig sharedInstance] setOauthUserName:@"admin" oauthPassword:@"admin" forEnv:EnvironmentStage];
|
[[PNObjectConfig sharedInstance] setOauthUserName:@"admin" oauthPassword:@"admin" forEnv:EnvironmentStage];
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user