- Update Pod and fix AFOAuth2Manager

This commit is contained in:
Giuseppe Nucifora 2016-02-05 11:42:34 +01:00
parent ea6cb89248
commit bce4347c9d
27 changed files with 1205 additions and 2534 deletions

View File

@ -14,8 +14,6 @@ PODS:
- AFNetworking/Serialization (3.0.4)
- AFNetworking/UIKit (3.0.4):
- AFNetworking/NSURLSession
- AFOAuth2Manager (3.0.0):
- AFNetworking/NSURLSession (~> 3.0)
- CodFis-Helper (0.1.2)
- Expecta (1.0.5)
- Expecta+Snapshots (2.0.0):
@ -30,7 +28,7 @@ PODS:
- NSString-Helper (1.0.2)
- nv-ios-http-status (0.0.1)
- PEAR-FileManager-iOS (1.3.1)
- PNObject (0.3.1):
- PNObject (0.3.2):
- AFNetworking
- CodFis-Helper
- NSDate_Utils
@ -45,7 +43,6 @@ PODS:
DEPENDENCIES:
- AFNetworking
- AFOAuth2Manager (from `https://github.com/AFNetworking/AFOAuth2Manager.git`, branch `3_0_0_branch`)
- CodFis-Helper
- Expecta
- Expecta+Snapshots
@ -60,20 +57,11 @@ DEPENDENCIES:
- UIDevice-Utils
EXTERNAL SOURCES:
AFOAuth2Manager:
:branch: 3_0_0_branch
:git: https://github.com/AFNetworking/AFOAuth2Manager.git
PNObject:
:path: "../"
CHECKOUT OPTIONS:
AFOAuth2Manager:
:commit: b2c665b1d354ed322517cbfed004ec210c193200
:git: https://github.com/AFNetworking/AFOAuth2Manager.git
SPEC CHECKSUMS:
AFNetworking: a0075feb321559dc78d9d85b55d11caa19eabb93
AFOAuth2Manager: 0566da1be64883e339813d411229fdc9a84dab7c
CodFis-Helper: f303810699f22dbcba8fb8c600545ac91fc3ec42
Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe
Expecta+Snapshots: 29b38dd695bc72a0ed2bea833937d78df41943ba
@ -82,11 +70,11 @@ SPEC CHECKSUMS:
NSString-Helper: 0ee74919829a332f9838fa87b28cb2d1d991e92c
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
PNObject: a16e4ed38478ac8a3bedd0739b74fe0ba0e1a60f
PNObject: f1a1126226e7f0dac81111a98e49b8653603f518
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
StrongestPasswordValidator: 554de9038705e18904f0337903dfd3b85a6b271b
UIDevice-Utils: 0beb5f9d2bd256a3efe05c1e43a2a8b8702199c4
PODFILE CHECKSUM: a99ea6f90d6a9ddab0074828d11a973ce39b397e
PODFILE CHECKSUM: 99adfd0e15d4fe00ec0e738a05da2a580764ba73
COCOAPODS: 1.0.0.beta.3

View File

@ -1,36 +0,0 @@
// AFHTTPRequestSerializer+OAuth2.h
//
// Copyright (c) 2012-2014 AFNetworking (http://afnetworking.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <AFNetworking/AFURLRequestSerialization.h>
@class AFOAuthCredential;
@interface AFHTTPRequestSerializer (OAuth2)
/**
Sets the "Authorization" HTTP header set in request objects made by the HTTP client to contain the access token within the OAuth credential. This overwrites any existing value for this header.
@param credential The OAuth2 credential
*/
- (void)setAuthorizationHeaderFieldWithCredential:(AFOAuthCredential *)credential;
@end

View File

@ -1,35 +0,0 @@
// AFHTTPRequestSerializer+OAuth2.m
//
// Copyright (c) 2012-2014 AFNetworking (http://afnetworking.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "AFHTTPRequestSerializer+OAuth2.h"
#import "AFOAuth2Manager.h"
#import "AFOAuthCredential.h"
@implementation AFHTTPRequestSerializer (OAuth2)
- (void)setAuthorizationHeaderFieldWithCredential:(AFOAuthCredential *)credential {
if ([credential.tokenType compare:@"Bearer" options:NSCaseInsensitiveSearch] == NSOrderedSame) {
[self setValue:[NSString stringWithFormat:@"Bearer %@", credential.accessToken] forHTTPHeaderField:@"Authorization"];
}
}
@end

View File

@ -1,192 +0,0 @@
// AFOAuth2Manager.h
//
// Copyright (c) 2012-2014 AFNetworking (http://afnetworking.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
#import <Foundation/Foundation.h>
#import "AFOAuthCredential.h"
#import "AFHTTPRequestSerializer+OAuth2.h"
@import AFNetworking;
NS_ASSUME_NONNULL_BEGIN
@interface AFOAuth2Manager : AFHTTPSessionManager
///------------------------------------------
/// @name Accessing OAuth 2 Client Properties
///------------------------------------------
/**
The service provider identifier used to store and retrieve OAuth credentials by `AFOAuthCredential`. Equivalent to the hostname of the client `baseURL`.
*/
@property (readonly, nonatomic, copy) NSString *serviceProviderIdentifier;
/**
The client identifier issued by the authorization server, uniquely representing the registration information provided by the client.
*/
@property (readonly, nonatomic, copy) NSString *clientID;
/**
Whether to encode client credentials in a Base64-encoded HTTP `Authorization` header, as opposed to the request body. Defaults to `YES`.
*/
@property (nonatomic, assign) BOOL useHTTPBasicAuthentication;
///------------------------------------------------
/// @name Creating and Initializing OAuth 2 Managers
///------------------------------------------------
/**
Creates and initializes an `AFOAuth2Manager` object with the specified base URL, client identifier, and secret.
@param url The base URL for the HTTP client. This argument must not be `nil`.
@param clientID The client identifier issued by the authorization server, uniquely representing the registration information provided by the client. This argument must not be `nil`.
@param secret The client secret.
@return The newly-initialized OAuth 2 manager
*/
+ (instancetype)managerWithBaseURL:(NSURL *)url
clientID:(NSString *)clientID
secret:(NSString *)secret;
+ (instancetype)managerWithBaseURL:(NSURL *)url
sessionConfiguration:(nullable NSURLSessionConfiguration *)configuration
clientID:(NSString *)clientID
secret:(NSString *)secret;
/**
Initializes an `AFOAuth2Manager` object with the specified base URL, client identifier, and secret. The communication to to the server will use HTTP basic auth by default (use `-(id)initWithBaseURL:clientID:secret:withBasicAuth:` to change this).
@param url The base URL for the HTTP manager. This argument must not be `nil`.
@param clientID The client identifier issued by the authorization server, uniquely representing the registration information provided by the client. This argument must not be `nil`.
@param secret The client secret.
@return The newly-initialized OAuth 2 client
*/
- (id)initWithBaseURL:(NSURL *)url
clientID:(NSString *)clientID
secret:(NSString *)secret;
- (id)initWithBaseURL:(NSURL *)url
sessionConfiguration:(nullable NSURLSessionConfiguration *)configuration
clientID:(NSString *)clientID
secret:(NSString *)secret;
///---------------------
/// @name Authenticating
///---------------------
/**
Creates and enqueues an `NSURLSessionTask` to authenticate against the server using a specified username and password, with a designated scope.
@param URLString The URL string used to create the request URL.
@param username The username used for authentication
@param password The password used for authentication
@param scope The authorization scope
@param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes a single argument: the OAuth credential returned by the server.
@param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error returned from the server.
*/
- (NSURLSessionTask *)authenticateUsingOAuthWithURLString:(NSString *)URLString
username:(NSString *)username
password:(NSString *)password
scope:(nullable NSString *)scope
success:(void (^)(AFOAuthCredential *credential))success
failure:(void (^)(NSError *error))failure;
/**
Creates and enqueues an `NSURLSessionTask` to authenticate against the server with a designated scope.
@param URLString The URL string used to create the request URL.
@param scope The authorization scope
@param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes a single argument: the OAuth credential returned by the server.
@param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error returned from the server.
*/
- (NSURLSessionTask *)authenticateUsingOAuthWithURLString:(NSString *)URLString
scope:(nullable NSString *)scope
success:(void (^)(AFOAuthCredential *credential))success
failure:(void (^)(NSError *error))failure;
/**
Creates and enqueues an `NSURLSessionTask` to authenticate against the server using the specified refresh token.
@param URLString The URL string used to create the request URL.
@param refreshToken The OAuth refresh token
@param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes a single argument: the OAuth credential returned by the server.
@param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error returned from the server.
*/
- (NSURLSessionTask *)authenticateUsingOAuthWithURLString:(NSString *)URLString
refreshToken:(NSString *)refreshToken
success:(void (^)(AFOAuthCredential *credential))success
failure:(void (^)(NSError *error))failure;
/**
Creates and enqueues an `NSURLSessionTask` to authenticate against the server with an authorization code, redirecting to a specified URI upon successful authentication.
@param URLString The URL string used to create the request URL.
@param code The authorization code
@param uri The URI to redirect to after successful authentication
@param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes a single argument: the OAuth credential returned by the server.
@param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error returned from the server.
*/
- (NSURLSessionTask *)authenticateUsingOAuthWithURLString:(NSString *)URLString
code:(NSString *)code
redirectURI:(NSString *)uri
success:(void (^)(AFOAuthCredential *credential))success
failure:(void (^)(NSError *error))failure;
/**
Creates and enqueues an `NSURLSessionTask` to authenticate against the server with the specified parameters.
@param URLString The URL string used to create the request URL.
@param parameters The parameters to be encoded and set in the request HTTP body.
@param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes a single argument: the OAuth credential returned by the server.
@param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error returned from the server.
*/
- (NSURLSessionTask *)authenticateUsingOAuthWithURLString:(NSString *)URLString
parameters:(NSDictionary *)parameters
success:(void (^)(AFOAuthCredential *credential))success
failure:(void (^)(NSError *error))failure;
@end
///----------------
/// @name Constants
///----------------
/**
## Error Domains
The following error domain is predefined.
- `NSString * const AFOAuth2ErrorDomain`
## OAuth Grant Types
OAuth 2.0 provides several grant types, covering several different use cases. The following grant type string constants are provided:
`kAFOAuthCodeGrantType`: "authorization_code"
`kAFOAuthClientCredentialsGrantType`: "client_credentials"
`kAFOAuthPasswordCredentialsGrantType`: "password"
`kAFOAuthRefreshGrantType`: "refresh_token"
*/
extern NSString * const AFOAuth2ErrorDomain;
extern NSString * const kAFOAuthCodeGrantType;
extern NSString * const kAFOAuthClientCredentialsGrantType;
extern NSString * const kAFOAuthPasswordCredentialsGrantType;
extern NSString * const kAFOAuthRefreshGrantType;
@compatibility_alias AFOAuth2Client AFOAuth2Manager;
@compatibility_alias AFOAuth2RequestOperationManager AFOAuth2Manager;
NS_ASSUME_NONNULL_END

View File

@ -1,275 +0,0 @@
// AFOAuth2Manager.m
//
// Copyright (c) 2012-2014 AFNetworking (http://afnetworking.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
#import "AFOAuth2Manager.h"
#import "AFOAuthCredential.h"
NSString * const kAFOAuthClientCredentialsGrantType = @"client_credentials";
NSString * const kAFOAuthPasswordCredentialsGrantType = @"password";
NSString * const kAFOAuthCodeGrantType = @"authorization_code";
NSString * const kAFOAuthRefreshGrantType = @"refresh_token";
NSString * const AFOAuth2ErrorDomain = @"com.alamofire.networking.oauth2.error";
// See: http://tools.ietf.org/html/rfc6749#section-5.2
static NSError * AFErrorFromRFC6749Section5_2Error(id object) {
if (![object valueForKey:@"error"] || [[object valueForKey:@"error"] isEqual:[NSNull null]]) {
return nil;
}
NSMutableDictionary *mutableUserInfo = [NSMutableDictionary dictionary];
NSString *description = nil;
if ([object valueForKey:@"error_description"]) {
description = [object valueForKey:@"error_description"];
} else {
if ([[object valueForKey:@"error"] isEqualToString:@"invalid_request"]) {
description = NSLocalizedStringFromTable(@"The request is missing a required parameter, includes an unsupported parameter value (other than grant type), repeats a parameter, includes multiple credentials, utilizes more than one mechanism for authenticating the client, or is otherwise malformed.", @"AFOAuth2Manager", @"invalid_request");
} else if ([[object valueForKey:@"error"] isEqualToString:@"invalid_client"]) {
description = NSLocalizedStringFromTable(@"Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authentication method). The authorization server MAY return an HTTP 401 (Unauthorized) status code to indicate which HTTP authentication schemes are supported. If the client attempted to authenticate via the \"Authorization\" request header field, the authorization server MUST respond with an HTTP 401 (Unauthorized) status code and include the \"WWW-Authenticate\" response header field matching the authentication scheme used by the client.", @"AFOAuth2Manager", @"invalid_request");
} else if ([[object valueForKey:@"error"] isEqualToString:@"invalid_grant"]) {
description = NSLocalizedStringFromTable(@"The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.", @"AFOAuth2Manager", @"invalid_request");
} else if ([[object valueForKey:@"error"] isEqualToString:@"unauthorized_client"]) {
description = NSLocalizedStringFromTable(@"The authenticated client is not authorized to use this authorization grant type.", @"AFOAuth2Manager", @"invalid_request");
} else if ([[object valueForKey:@"error"] isEqualToString:@"unsupported_grant_type"]) {
description = NSLocalizedStringFromTable(@"The authorization grant type is not supported by the authorization server.", @"AFOAuth2Manager", @"invalid_request");
}
}
if (description) {
mutableUserInfo[NSLocalizedDescriptionKey] = description;
}
if ([object valueForKey:@"error_uri"]) {
mutableUserInfo[NSLocalizedRecoverySuggestionErrorKey] = [object valueForKey:@"error_uri"];
}
return [NSError errorWithDomain:AFOAuth2ErrorDomain code:-1 userInfo:mutableUserInfo];
}
@interface AFOAuth2Manager()
@property (readwrite, nonatomic, copy) NSString *serviceProviderIdentifier;
@property (readwrite, nonatomic, copy) NSString *clientID;
@property (readwrite, nonatomic, copy) NSString *secret;
@end
@implementation AFOAuth2Manager
+ (instancetype) managerWithBaseURL:(NSURL *)url
clientID:(NSString *)clientID
secret:(NSString *)secret {
return [self managerWithBaseURL:url sessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration] clientID:clientID secret:secret];
}
+ (instancetype) managerWithBaseURL:(NSURL *)url
sessionConfiguration:(NSURLSessionConfiguration *)configuration
clientID:(NSString *)clientID
secret:(NSString *)secret {
return [[self alloc] initWithBaseURL:url sessionConfiguration:configuration clientID:clientID secret:secret];
}
- (id)initWithBaseURL:(NSURL *)url
clientID:(NSString *)clientID
secret:(NSString *)secret {
return [self initWithBaseURL:url sessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration] clientID:clientID secret:secret];
}
- (id)initWithBaseURL:(NSURL *)url
sessionConfiguration:(NSURLSessionConfiguration *)configuration
clientID:(NSString *)clientID
secret:(NSString *)secret {
NSParameterAssert(url);
NSParameterAssert(clientID);
NSParameterAssert(secret);
self = [super initWithBaseURL:url sessionConfiguration:configuration];
if (!self) {
return nil;
}
self.serviceProviderIdentifier = [self.baseURL host];
self.clientID = clientID;
self.secret = secret;
self.useHTTPBasicAuthentication = YES;
[self.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Accept"];
return self;
}
#pragma mark -
- (void)setUseHTTPBasicAuthentication:(BOOL)useHTTPBasicAuthentication {
_useHTTPBasicAuthentication = useHTTPBasicAuthentication;
if (self.useHTTPBasicAuthentication) {
[self.requestSerializer setAuthorizationHeaderFieldWithUsername:self.clientID password:self.secret];
} else {
[self.requestSerializer setValue:nil forHTTPHeaderField:@"Authorization"];
}
}
- (void)setSecret:(NSString *)secret {
if (!secret) {
secret = @"";
}
_secret = secret;
}
#pragma mark -
- (NSURLSessionTask *)authenticateUsingOAuthWithURLString:(NSString *)URLString
username:(NSString *)username
password:(NSString *)password
scope:(NSString *)scope
success:(void (^)(AFOAuthCredential * _Nonnull))success
failure:(void (^)(NSError * _Nonnull))failure {
NSParameterAssert(username);
NSParameterAssert(password);
NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
[parameters setValue:kAFOAuthPasswordCredentialsGrantType forKey:@"grant_type"];
[parameters setValue:username forKey:@"username"];
[parameters setValue:password forKey:@"password"];
if (scope) {
[parameters setValue:scope forKey:@"scope"];
}
return [self authenticateUsingOAuthWithURLString:URLString parameters:parameters success:success failure:failure];
}
- (NSURLSessionTask *)authenticateUsingOAuthWithURLString:(NSString *)URLString
scope:(NSString *)scope
success:(void (^)(AFOAuthCredential * _Nonnull))success
failure:(void (^)(NSError * _Nonnull))failure {
NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
[parameters setValue:kAFOAuthClientCredentialsGrantType forKey:@"grant_type"];
if (scope) {
[parameters setValue:scope forKey:@"scope"];
}
return [self authenticateUsingOAuthWithURLString:URLString parameters:parameters success:success failure:failure];
}
- (NSURLSessionTask *)authenticateUsingOAuthWithURLString:(NSString *)URLString
refreshToken:(NSString *)refreshToken
success:(void (^)(AFOAuthCredential *credential))success
failure:(void (^)(NSError *error))failure
{
NSParameterAssert(refreshToken);
NSDictionary *parameters = @{
@"grant_type": kAFOAuthRefreshGrantType,
@"refresh_token": refreshToken
};
return [self authenticateUsingOAuthWithURLString:URLString parameters:parameters success:success failure:failure];
}
- (NSURLSessionTask *)authenticateUsingOAuthWithURLString:(NSString *)URLString
code:(NSString *)code
redirectURI:(NSString *)uri
success:(void (^)(AFOAuthCredential *credential))success
failure:(void (^)(NSError *error))failure
{
NSParameterAssert(code);
NSParameterAssert(uri);
NSDictionary *parameters = @{
@"grant_type": kAFOAuthCodeGrantType,
@"code": code,
@"redirect_uri": uri
};
return [self authenticateUsingOAuthWithURLString:URLString parameters:parameters success:success failure:failure];
}
- (NSURLSessionTask *)authenticateUsingOAuthWithURLString:(NSString *)URLString
parameters:(NSDictionary *)parameters
success:(void (^)(AFOAuthCredential *credential))success
failure:(void (^)(NSError *error))failure
{
NSMutableDictionary *mutableParameters = [NSMutableDictionary dictionaryWithDictionary:parameters];
if (!self.useHTTPBasicAuthentication) {
mutableParameters[@"client_id"] = self.clientID;
mutableParameters[@"client_secret"] = self.secret;
}
parameters = [NSDictionary dictionaryWithDictionary:mutableParameters];
NSURLSessionTask *task;
task = [self POST:URLString parameters:parameters progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
if (!responseObject) {
if (failure) {
failure(nil);
}
return;
}
if ([responseObject valueForKey:@"error"]) {
if (failure) {
failure(AFErrorFromRFC6749Section5_2Error(responseObject));
}
}
NSString *refreshToken = [responseObject valueForKey:@"refresh_token"];
if (!refreshToken || [refreshToken isEqual:[NSNull null]]) {
refreshToken = [parameters valueForKey:@"refresh_token"];
}
AFOAuthCredential *credential = [AFOAuthCredential credentialWithOAuthToken:[responseObject valueForKey:@"access_token"] tokenType:[responseObject valueForKey:@"token_type"]];
if (refreshToken) { // refreshToken is optional in the OAuth2 spec
[credential setRefreshToken:refreshToken];
}
// Expiration is optional, but recommended in the OAuth2 spec. It not provide, assume distantFuture === never expires
NSDate *expireDate = [NSDate distantFuture];
id expiresIn = [responseObject valueForKey:@"expires_in"];
if (expiresIn && ![expiresIn isEqual:[NSNull null]]) {
expireDate = [NSDate dateWithTimeIntervalSinceNow:[expiresIn doubleValue]];
}
if (expireDate) {
[credential setExpiration:expireDate];
}
if (success) {
success(credential);
}
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
if (failure) {
failure(error);
}
}];
return task;
}
@end

View File

@ -1,158 +0,0 @@
// AFOAuthCredential.h
//
// Copyright (c) 2012-2014 AFNetworking (http://afnetworking.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/**
`AFOAuthCredential` models the credentials returned from an OAuth server, storing the token type, access & refresh tokens, and whether the token is expired.
OAuth credentials can be stored in the user's keychain, and retrieved on subsequent launches.
*/
@interface AFOAuthCredential : NSObject <NSCoding>
///--------------------------------------
/// @name Accessing Credential Properties
///--------------------------------------
/**
The OAuth access token.
*/
@property (readonly, nonatomic, copy) NSString *accessToken;
/**
The OAuth token type (e.g. "bearer").
*/
@property (readonly, nonatomic, copy) NSString *tokenType;
/**
The OAuth refresh token.
*/
@property (readonly, nonatomic, copy) NSString *refreshToken;
/**
Whether the OAuth credentials are expired.
*/
@property (readonly, nonatomic, assign, getter = isExpired) BOOL expired;
///--------------------------------------------
/// @name Creating and Initializing Credentials
///--------------------------------------------
/**
Create an OAuth credential from a token string, with a specified type.
@param token The OAuth token string.
@param type The OAuth token type.
*/
+ (instancetype)credentialWithOAuthToken:(NSString *)token
tokenType:(NSString *)type;
/**
Initialize an OAuth credential from a token string, with a specified type.
@param token The OAuth token string.
@param type The OAuth token type.
*/
- (id)initWithOAuthToken:(NSString *)token
tokenType:(NSString *)type;
///----------------------------
/// @name Setting Refresh Token
///----------------------------
/**
Set the credential refresh token, without a specific expiration
@param refreshToken The OAuth refresh token.
*/
- (void)setRefreshToken:(NSString *)refreshToken;
/**
Set the expiration on the access token. If no expiration is given by the OAuth2 provider,
you may pass in [NSDate distantFuture]
@param expiration The expiration of the access token. This must not be `nil`.
*/
- (void)setExpiration:(NSDate *)expiration;
/**
Set the credential refresh token, with a specified expiration.
@param refreshToken The OAuth refresh token.
@param expiration The expiration of the access token. This must not be `nil`.
*/
- (void)setRefreshToken:(NSString *)refreshToken
expiration:(NSDate *)expiration;
///-----------------------------------------
/// @name Storing and Retrieving Credentials
///-----------------------------------------
/**
Stores the specified OAuth credential for a given web service identifier in the Keychain.
with the default Keychain Accessibilty of kSecAttrAccessibleWhenUnlocked.
@param credential The OAuth credential to be stored.
@param identifier The service identifier associated with the specified credential.
@return Whether or not the credential was stored in the keychain.
*/
+ (BOOL)storeCredential:(AFOAuthCredential *)credential
withIdentifier:(NSString *)identifier;
/**
Stores the specified OAuth token for a given web service identifier in the Keychain.
@param credential The OAuth credential to be stored.
@param identifier The service identifier associated with the specified token.
@param securityAccessibility The Keychain security accessibility to store the credential with.
@return Whether or not the credential was stored in the keychain.
*/
+ (BOOL)storeCredential:(AFOAuthCredential *)credential
withIdentifier:(NSString *)identifier
withAccessibility:(id)securityAccessibility;
/**
Retrieves the OAuth credential stored with the specified service identifier from the Keychain.
@param identifier The service identifier associated with the specified credential.
@return The retrieved OAuth credential.
*/
+ (nullable AFOAuthCredential *)retrieveCredentialWithIdentifier:(NSString *)identifier;
/**
Deletes the OAuth credential stored with the specified service identifier from the Keychain.
@param identifier The service identifier associated with the specified credential.
@return Whether or not the credential was deleted from the keychain.
*/
+ (BOOL)deleteCredentialWithIdentifier:(NSString *)identifier;
@end
NS_ASSUME_NONNULL_END

View File

@ -1,184 +0,0 @@
// AFOAuthCredential.m
//
// Copyright (c) 2012-2014 AFNetworking (http://afnetworking.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
#import "AFOAuthCredential.h"
NSString * const kAFOAuth2CredentialServiceName = @"AFOAuthCredentialService";
static NSDictionary * AFKeychainQueryDictionaryWithIdentifier(NSString *identifier) {
NSCParameterAssert(identifier);
return @{
(__bridge id)kSecClass: (__bridge id)kSecClassGenericPassword,
(__bridge id)kSecAttrService: kAFOAuth2CredentialServiceName,
(__bridge id)kSecAttrAccount: identifier
};
}
@interface AFOAuthCredential()
@property (readwrite, nonatomic, copy) NSString *accessToken;
@property (readwrite, nonatomic, copy) NSString *tokenType;
@property (readwrite, nonatomic, copy) NSString *refreshToken;
@property (readwrite, nonatomic, copy) NSDate *expiration;
@end
@implementation AFOAuthCredential
//@dynamic expired;
#pragma mark -
+ (instancetype)credentialWithOAuthToken:(NSString *)token
tokenType:(NSString *)type
{
return [[self alloc] initWithOAuthToken:token tokenType:type];
}
- (id)initWithOAuthToken:(NSString *)token
tokenType:(NSString *)type
{
self = [super init];
if (!self) {
return nil;
}
self.accessToken = token;
self.tokenType = type;
return self;
}
- (NSString *)description {
return [NSString stringWithFormat:@"<%@ accessToken:\"%@\" tokenType:\"%@\" refreshToken:\"%@\" expiration:\"%@\">", [self class], self.accessToken, self.tokenType, self.refreshToken, self.expiration];
}
- (void)setRefreshToken:(NSString *)refreshToken
{
_refreshToken = refreshToken;
}
- (void)setExpiration:(NSDate *)expiration
{
_expiration = expiration;
}
- (void)setRefreshToken:(NSString *)refreshToken
expiration:(NSDate *)expiration
{
NSParameterAssert(refreshToken);
NSParameterAssert(expiration);
self.refreshToken = refreshToken;
self.expiration = expiration;
}
- (BOOL)isExpired {
return [self.expiration compare:[NSDate date]] == NSOrderedAscending;
}
#pragma mark Keychain
+ (BOOL)storeCredential:(AFOAuthCredential *)credential
withIdentifier:(NSString *)identifier
{
id securityAccessibility = nil;
#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 43000) || (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wtautological-compare"
if (&kSecAttrAccessibleWhenUnlocked != NULL) {
securityAccessibility = (__bridge id)kSecAttrAccessibleWhenUnlocked;
}
#pragma clang diagnostic pop
#endif
return [[self class] storeCredential:credential withIdentifier:identifier withAccessibility:securityAccessibility];
}
+ (BOOL)storeCredential:(AFOAuthCredential *)credential
withIdentifier:(NSString *)identifier
withAccessibility:(id)securityAccessibility
{
NSMutableDictionary *queryDictionary = [AFKeychainQueryDictionaryWithIdentifier(identifier) mutableCopy];
NSMutableDictionary *updateDictionary = [NSMutableDictionary dictionary];
updateDictionary[(__bridge id)kSecValueData] = [NSKeyedArchiver archivedDataWithRootObject:credential];
if (securityAccessibility) {
updateDictionary[(__bridge id)kSecAttrAccessible] = securityAccessibility;
}
OSStatus status;
BOOL exists = ([self retrieveCredentialWithIdentifier:identifier] != nil);
if (exists) {
status = SecItemUpdate((__bridge CFDictionaryRef)queryDictionary, (__bridge CFDictionaryRef)updateDictionary);
} else {
[queryDictionary addEntriesFromDictionary:updateDictionary];
status = SecItemAdd((__bridge CFDictionaryRef)queryDictionary, NULL);
}
return (status == errSecSuccess);
}
+ (BOOL)deleteCredentialWithIdentifier:(NSString *)identifier {
NSMutableDictionary *queryDictionary = [AFKeychainQueryDictionaryWithIdentifier(identifier) mutableCopy];
OSStatus status = SecItemDelete((__bridge CFDictionaryRef)queryDictionary);
return (status == errSecSuccess);
}
+ (AFOAuthCredential *)retrieveCredentialWithIdentifier:(NSString *)identifier {
NSMutableDictionary *queryDictionary = [AFKeychainQueryDictionaryWithIdentifier(identifier) mutableCopy];
queryDictionary[(__bridge id)kSecReturnData] = (__bridge id)kCFBooleanTrue;
queryDictionary[(__bridge id)kSecMatchLimit] = (__bridge id)kSecMatchLimitOne;
CFDataRef result = nil;
OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)queryDictionary, (CFTypeRef *)&result);
if (status != errSecSuccess) {
return nil;
}
return [NSKeyedUnarchiver unarchiveObjectWithData:(__bridge_transfer NSData *)result];
}
#pragma mark - NSCoding
- (id)initWithCoder:(NSCoder *)decoder {
self = [super init];
self.accessToken = [decoder decodeObjectForKey:NSStringFromSelector(@selector(accessToken))];
self.tokenType = [decoder decodeObjectForKey:NSStringFromSelector(@selector(tokenType))];
self.refreshToken = [decoder decodeObjectForKey:NSStringFromSelector(@selector(refreshToken))];
self.expiration = [decoder decodeObjectForKey:NSStringFromSelector(@selector(expiration))];
return self;
}
- (void)encodeWithCoder:(NSCoder *)encoder {
[encoder encodeObject:self.accessToken forKey:NSStringFromSelector(@selector(accessToken))];
[encoder encodeObject:self.tokenType forKey:NSStringFromSelector(@selector(tokenType))];
[encoder encodeObject:self.refreshToken forKey:NSStringFromSelector(@selector(refreshToken))];
[encoder encodeObject:self.expiration forKey:NSStringFromSelector(@selector(expiration))];
}
@end

View File

@ -1,19 +0,0 @@
Copyright (c) 2011-2014 AFNetworking (http://afnetworking.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -1,68 +0,0 @@
# AFOAuth2Manager
AFOAuth2Manager is an extension for [AFNetworking](http://github.com/AFNetworking/AFNetworking/) that simplifies the process of authenticating against an [OAuth 2](https://tools.ietf.org/html/rfc6749) provider.
## Example Usage
### Authentication
```objective-c
NSURL *baseURL = [NSURL URLWithString:@"http://example.com/"];
AFOAuth2Manager *OAuth2Manager =
[[AFOAuth2Manager alloc] initWithBaseURL:baseURL
clientID:kClientID
secret:kClientSecret];
[OAuth2Manager authenticateUsingOAuthWithURLString:@"/oauth/token"
username:@"username"
password:@"password"
scope:@"email"
success:^(AFOAuthCredential *credential) {
NSLog(@"Token: %@", credential.accessToken);
}
failure:^(NSError *error) {
NSLog(@"Error: %@", error);
}];
```
### Authorizing Requests
```objective-c
AFHTTPSessionManager *manager =
[[AFHTTPSessionManager alloc] initWithBaseURL:baseURL];
[manager.requestSerializer setAuthorizationHeaderFieldWithCredential:credential];
[manager GET:@"/path/to/protected/resource"
parameters:nil
progress:nil
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSLog(@"Success: %@", responseObject);
}
failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
NSLog(@"Failure: %@", error);
}];
```
### Storing Credentials
```objective-c
[AFOAuthCredential storeCredential:credential
withIdentifier:serviceProviderIdentifier];
```
### Retrieving Credentials
```objective-c
AFOAuthCredential *credential =
[AFOAuthCredential retrieveCredentialWithIdentifier:serviceProviderIdentifier];
```
## Documentation
Documentation for all releases of AFOAuth2Manager are [available on CocoaDocs](http://cocoadocs.org/docsets/AFOAuth2Manager/).
## License
AFOAuth2Manager is available under the MIT license. See the LICENSE file for more info.

View File

@ -1,31 +0,0 @@
{
"name": "AFOAuth2Manager",
"version": "3.0.0",
"license": "MIT",
"summary": "AFNetworking Extension for OAuth 2 Authentication.",
"homepage": "https://github.com/AFNetworking/AFOAuth2Manager",
"social_media_url": "https://twitter.com/AFNetworking",
"authors": {
"Mattt Thompson": "m@mattt.me"
},
"source": {
"git": "https://github.com/AFNetworking/AFOAuth2Manager.git",
"tag": "3.0.0"
},
"source_files": "AFOAuth2Manager",
"requires_arc": true,
"platforms": {
"ios": "7.0",
"osx": "10.9",
"tvos": "9.0",
"watchos": "2.0"
},
"dependencies": {
"AFNetworking/NSURLSession": [
"~>3.0"
]
},
"ios": {
"frameworks": "Security"
}
}

View File

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

View File

@ -14,8 +14,6 @@ PODS:
- AFNetworking/Serialization (3.0.4)
- AFNetworking/UIKit (3.0.4):
- AFNetworking/NSURLSession
- AFOAuth2Manager (3.0.0):
- AFNetworking/NSURLSession (~> 3.0)
- CodFis-Helper (0.1.2)
- Expecta (1.0.5)
- Expecta+Snapshots (2.0.0):
@ -30,7 +28,7 @@ PODS:
- NSString-Helper (1.0.2)
- nv-ios-http-status (0.0.1)
- PEAR-FileManager-iOS (1.3.1)
- PNObject (0.3.1):
- PNObject (0.3.2):
- AFNetworking
- CodFis-Helper
- NSDate_Utils
@ -45,7 +43,6 @@ PODS:
DEPENDENCIES:
- AFNetworking
- AFOAuth2Manager (from `https://github.com/AFNetworking/AFOAuth2Manager.git`, branch `3_0_0_branch`)
- CodFis-Helper
- Expecta
- Expecta+Snapshots
@ -60,20 +57,11 @@ DEPENDENCIES:
- UIDevice-Utils
EXTERNAL SOURCES:
AFOAuth2Manager:
:branch: 3_0_0_branch
:git: https://github.com/AFNetworking/AFOAuth2Manager.git
PNObject:
:path: "../"
CHECKOUT OPTIONS:
AFOAuth2Manager:
:commit: b2c665b1d354ed322517cbfed004ec210c193200
:git: https://github.com/AFNetworking/AFOAuth2Manager.git
SPEC CHECKSUMS:
AFNetworking: a0075feb321559dc78d9d85b55d11caa19eabb93
AFOAuth2Manager: 0566da1be64883e339813d411229fdc9a84dab7c
CodFis-Helper: f303810699f22dbcba8fb8c600545ac91fc3ec42
Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe
Expecta+Snapshots: 29b38dd695bc72a0ed2bea833937d78df41943ba
@ -82,11 +70,11 @@ SPEC CHECKSUMS:
NSString-Helper: 0ee74919829a332f9838fa87b28cb2d1d991e92c
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
PNObject: a16e4ed38478ac8a3bedd0739b74fe0ba0e1a60f
PNObject: f1a1126226e7f0dac81111a98e49b8653603f518
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
StrongestPasswordValidator: 554de9038705e18904f0337903dfd3b85a6b271b
UIDevice-Utils: 0beb5f9d2bd256a3efe05c1e43a2a8b8702199c4
PODFILE CHECKSUM: a99ea6f90d6a9ddab0074828d11a973ce39b397e
PODFILE CHECKSUM: 99adfd0e15d4fe00ec0e738a05da2a580764ba73
COCOAPODS: 1.0.0.beta.3

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +0,0 @@
#import <Foundation/Foundation.h>
@interface PodsDummy_AFOAuth2Manager : NSObject
@end
@implementation PodsDummy_AFOAuth2Manager
@end

View File

@ -1,4 +0,0 @@
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif

View File

@ -1,9 +0,0 @@
#import <UIKit/UIKit.h>
#import "AFHTTPRequestSerializer+OAuth2.h"
#import "AFOAuth2Manager.h"
#import "AFOAuthCredential.h"
FOUNDATION_EXPORT double AFOAuth2ManagerVersionNumber;
FOUNDATION_EXPORT const unsigned char AFOAuth2ManagerVersionString[];

View File

@ -1,6 +0,0 @@
framework module AFOAuth2Manager {
umbrella header "AFOAuth2Manager-umbrella.h"
export *
module * { export * }
}

View File

@ -1,6 +0,0 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
OTHER_LDFLAGS = -framework "Security"
PODS_ROOT = ${SRCROOT}
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
SKIP_INSTALL = YES

View File

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.3.1</string>
<string>0.3.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@ -13,7 +13,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.3.1</string>
<string>0.3.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@ -24,29 +24,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## AFOAuth2Manager
Copyright (c) 2011-2014 AFNetworking (http://afnetworking.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## CodFis-Helper
Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>

View File

@ -39,33 +39,6 @@ THE SOFTWARE.
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2011-2014 AFNetworking (http://afnetworking.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
</string>
<key>Title</key>
<string>AFOAuth2Manager</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2015 Giuseppe Nucifora &lt;me@giuseppenucifora.com&gt;

View File

@ -85,7 +85,6 @@ strip_invalid_archs() {
if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework "Pods-PNObject_Example/AFNetworking.framework"
install_framework "Pods-PNObject_Example/AFOAuth2Manager.framework"
install_framework "Pods-PNObject_Example/CodFis_Helper.framework"
install_framework "Pods-PNObject_Example/NSDate_Utils.framework"
install_framework "Pods-PNObject_Example/NSString_Helper.framework"
@ -97,7 +96,6 @@ if [[ "$CONFIGURATION" == "Debug" ]]; then
fi
if [[ "$CONFIGURATION" == "Release" ]]; then
install_framework "Pods-PNObject_Example/AFNetworking.framework"
install_framework "Pods-PNObject_Example/AFOAuth2Manager.framework"
install_framework "Pods-PNObject_Example/CodFis_Helper.framework"
install_framework "Pods-PNObject_Example/NSDate_Utils.framework"
install_framework "Pods-PNObject_Example/NSString_Helper.framework"

View File

@ -1,6 +1,6 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/AFNetworking.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/AFOAuth2Manager.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CodFis_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSDate_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSString_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PEAR_FileManager_iOS.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNObject.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIDevice_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/nv_ios_http_status.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "AFNetworking" -framework "AFOAuth2Manager" -framework "CodFis_Helper" -framework "NSDate_Utils" -framework "NSString_Helper" -framework "PEAR_FileManager_iOS" -framework "PNObject" -framework "StrongestPasswordValidator" -framework "UIDevice_Utils" -framework "nv_ios_http_status"
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/AFNetworking.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CodFis_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSDate_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSString_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PEAR_FileManager_iOS.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNObject.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIDevice_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/nv_ios_http_status.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "AFNetworking" -framework "CodFis_Helper" -framework "NSDate_Utils" -framework "NSString_Helper" -framework "PEAR_FileManager_iOS" -framework "PNObject" -framework "StrongestPasswordValidator" -framework "UIDevice_Utils" -framework "nv_ios_http_status"
PODS_FRAMEWORK_BUILD_PATH = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-PNObject_Example"
PODS_ROOT = ${SRCROOT}/Pods

View File

@ -1,6 +1,6 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/AFNetworking.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/AFOAuth2Manager.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CodFis_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSDate_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSString_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PEAR_FileManager_iOS.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNObject.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIDevice_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/nv_ios_http_status.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "AFNetworking" -framework "AFOAuth2Manager" -framework "CodFis_Helper" -framework "NSDate_Utils" -framework "NSString_Helper" -framework "PEAR_FileManager_iOS" -framework "PNObject" -framework "StrongestPasswordValidator" -framework "UIDevice_Utils" -framework "nv_ios_http_status"
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/AFNetworking.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CodFis_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSDate_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSString_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PEAR_FileManager_iOS.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNObject.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIDevice_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/nv_ios_http_status.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "AFNetworking" -framework "CodFis_Helper" -framework "NSDate_Utils" -framework "NSString_Helper" -framework "PEAR_FileManager_iOS" -framework "PNObject" -framework "StrongestPasswordValidator" -framework "UIDevice_Utils" -framework "nv_ios_http_status"
PODS_FRAMEWORK_BUILD_PATH = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-PNObject_Example"
PODS_ROOT = ${SRCROOT}/Pods

View File

@ -9,9 +9,9 @@
#import <Foundation/Foundation.h>
#import <AFNetworking/AFNetworking.h>
#import <AFOAuth2Manager/AFOAuth2Manager.h>
#import <AFOAuth2Manager/AFHTTPRequestSerializer+OAuth2.h>
#import <AFOAuth2Manager/AFOAuthCredential.h>
#import "AFOAuth2Manager.h"
#import "AFHTTPRequestSerializer+OAuth2.h"
#import "AFOAuthCredential.h"
typedef NS_ENUM(NSInteger, Environment) {
Development = 0,