Skip to content
This repository was archived by the owner on Jan 17, 2023. It is now read-only.

Commit 2aa4ba7

Browse files
committed
Initial compiling checkin
1 parent 10f7e27 commit 2aa4ba7

84 files changed

Lines changed: 26026 additions & 14 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
77
.DS_Store
88
## Build generated
9-
build/
109
DerivedData
1110

1211
## Various settings

AFOAuth2Manager.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
2934F28E1C15D9BE008B8AE4 /* AFOAuthCredential.h in Headers */ = {isa = PBXBuildFile; fileRef = 2934F28C1C15D9BE008B8AE4 /* AFOAuthCredential.h */; };
11+
2934F28F1C15D9BE008B8AE4 /* AFOAuthCredential.m in Sources */ = {isa = PBXBuildFile; fileRef = 2934F28D1C15D9BE008B8AE4 /* AFOAuthCredential.m */; };
1012
29490FD51BE11C5100893BE1 /* AFHTTPRequestSerializer+OAuth2.h in Headers */ = {isa = PBXBuildFile; fileRef = 29490FD11BE11C5100893BE1 /* AFHTTPRequestSerializer+OAuth2.h */; };
1113
29490FD71BE11C5100893BE1 /* AFOAuth2Manager.h in Headers */ = {isa = PBXBuildFile; fileRef = 29490FD31BE11C5100893BE1 /* AFOAuth2Manager.h */; };
1214
29490FDD1BE11CBB00893BE1 /* AFNetworking.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 29490FDC1BE11CBB00893BE1 /* AFNetworking.framework */; };
@@ -15,6 +17,8 @@
1517
/* End PBXBuildFile section */
1618

1719
/* Begin PBXFileReference section */
20+
2934F28C1C15D9BE008B8AE4 /* AFOAuthCredential.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFOAuthCredential.h; sourceTree = "<group>"; };
21+
2934F28D1C15D9BE008B8AE4 /* AFOAuthCredential.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFOAuthCredential.m; sourceTree = "<group>"; };
1822
29490FC51BE11BD700893BE1 /* AFOAuth2Manager.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AFOAuth2Manager.framework; sourceTree = BUILT_PRODUCTS_DIR; };
1923
29490FD11BE11C5100893BE1 /* AFHTTPRequestSerializer+OAuth2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "AFHTTPRequestSerializer+OAuth2.h"; sourceTree = "<group>"; };
2024
29490FD21BE11C5100893BE1 /* AFHTTPRequestSerializer+OAuth2.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "AFHTTPRequestSerializer+OAuth2.m"; sourceTree = "<group>"; };
@@ -66,6 +70,8 @@
6670
29490FD41BE11C5100893BE1 /* AFOAuth2Manager.m */,
6771
29490FDE1BE11D1000893BE1 /* AFOAuth2SessionManager.h */,
6872
29490FDF1BE11D1000893BE1 /* AFOAuth2SessionManager.m */,
73+
2934F28C1C15D9BE008B8AE4 /* AFOAuthCredential.h */,
74+
2934F28D1C15D9BE008B8AE4 /* AFOAuthCredential.m */,
6975
);
7076
path = AFOAuth2Manager;
7177
sourceTree = "<group>";
@@ -86,6 +92,7 @@
8692
isa = PBXHeadersBuildPhase;
8793
buildActionMask = 2147483647;
8894
files = (
95+
2934F28E1C15D9BE008B8AE4 /* AFOAuthCredential.h in Headers */,
8996
29490FE01BE11D1000893BE1 /* AFOAuth2SessionManager.h in Headers */,
9097
29490FD71BE11C5100893BE1 /* AFOAuth2Manager.h in Headers */,
9198
29490FD51BE11C5100893BE1 /* AFHTTPRequestSerializer+OAuth2.h in Headers */,
@@ -160,6 +167,7 @@
160167
buildActionMask = 2147483647;
161168
files = (
162169
29490FE11BE11D1000893BE1 /* AFOAuth2SessionManager.m in Sources */,
170+
2934F28F1C15D9BE008B8AE4 /* AFOAuthCredential.m in Sources */,
163171
);
164172
runOnlyForDeploymentPostprocessing = 0;
165173
};

AFOAuth2Manager.xcodeproj/xcshareddata/xcschemes/AFOAuth2Manager iOS.xcscheme

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<BuildableReference
1616
BuildableIdentifier = "primary"
1717
BlueprintIdentifier = "29490FC41BE11BD700893BE1"
18-
BuildableName = "AFOAuth2Manager iOS.framework"
18+
BuildableName = "AFOAuth2Manager.framework"
1919
BlueprintName = "AFOAuth2Manager iOS"
2020
ReferencedContainer = "container:AFOAuth2Manager.xcodeproj">
2121
</BuildableReference>
@@ -46,7 +46,7 @@
4646
<BuildableReference
4747
BuildableIdentifier = "primary"
4848
BlueprintIdentifier = "29490FC41BE11BD700893BE1"
49-
BuildableName = "AFOAuth2Manager iOS.framework"
49+
BuildableName = "AFOAuth2Manager.framework"
5050
BlueprintName = "AFOAuth2Manager iOS"
5151
ReferencedContainer = "container:AFOAuth2Manager.xcodeproj">
5252
</BuildableReference>
@@ -64,7 +64,7 @@
6464
<BuildableReference
6565
BuildableIdentifier = "primary"
6666
BlueprintIdentifier = "29490FC41BE11BD700893BE1"
67-
BuildableName = "AFOAuth2Manager iOS.framework"
67+
BuildableName = "AFOAuth2Manager.framework"
6868
BlueprintName = "AFOAuth2Manager iOS"
6969
ReferencedContainer = "container:AFOAuth2Manager.xcodeproj">
7070
</BuildableReference>
Lines changed: 129 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,139 @@
1+
// AFOAuth2SessionManager.h
12
//
2-
// AFOAuth2SessionManager.h
3-
// AFOAuth2Manager
3+
// Copyright (c) 2012-2014 AFNetworking (http://afnetworking.com)
44
//
5-
// Created by Kevin Harwood on 10/28/15.
6-
// Copyright © 2015 Alamofire. All rights reserved.
5+
// Permission is hereby granted, free of charge, to any person obtaining a copy
6+
// of this software and associated documentation files (the "Software"), to deal
7+
// in the Software without restriction, including without limitation the rights
8+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
// copies of the Software, and to permit persons to whom the Software is
10+
// furnished to do so, subject to the following conditions:
711
//
12+
// The above copyright notice and this permission notice shall be included in
13+
// all copies or substantial portions of the Software.
14+
//
15+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
// THE SOFTWARE
822

923
#import <UIKit/UIKit.h>
24+
@class AFOAuthCredential;
1025
@import AFNetworking;
1126

27+
NS_ASSUME_NONNULL_BEGIN
28+
1229
@interface AFOAuth2SessionManager : AFHTTPSessionManager
1330

31+
///------------------------------------------
32+
/// @name Accessing OAuth 2 Client Properties
33+
///------------------------------------------
34+
35+
/**
36+
The service provider identifier used to store and retrieve OAuth credentials by `AFOAuthCredential`. Equivalent to the hostname of the client `baseURL`.
37+
*/
38+
@property (readonly, nonatomic, copy) NSString *serviceProviderIdentifier;
39+
40+
/**
41+
The client identifier issued by the authorization server, uniquely representing the registration information provided by the client.
42+
*/
43+
@property (readonly, nonatomic, copy) NSString *clientID;
44+
45+
/**
46+
Whether to encode client credentials in a Base64-encoded HTTP `Authorization` header, as opposed to the request body. Defaults to `YES`.
47+
*/
48+
@property (nonatomic, assign) BOOL useHTTPBasicAuthentication;
49+
50+
///------------------------------------------------
51+
/// @name Creating and Initializing OAuth 2 Managers
52+
///------------------------------------------------
53+
54+
/**
55+
Creates and initializes an `AFOAuth2SessionManager` object with the specified base URL, client identifier, and secret.
56+
57+
@param url The base URL for the HTTP client. This argument must not be `nil`.
58+
@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`.
59+
@param secret The client secret.
60+
61+
@return The newly-initialized OAuth 2 manager
62+
*/
63+
+ (instancetype)managerWithBaseURL:(NSURL *)url
64+
clientID:(NSString *)clientID
65+
secret:(NSString *)secret;
66+
67+
+ (instancetype)managerWithBaseURL:(NSURL *)url
68+
sessionConfiguration:(nullable NSURLSessionConfiguration *)configuration
69+
clientID:(NSString *)clientID
70+
secret:(NSString *)secret;
71+
72+
/**
73+
Initializes an `AFOAuth2SessionManager` 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).
74+
75+
@param url The base URL for the HTTP manager. This argument must not be `nil`.
76+
@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`.
77+
@param secret The client secret.
78+
79+
@return The newly-initialized OAuth 2 client
80+
*/
81+
- (id)initWithBaseURL:(NSURL *)url
82+
clientID:(NSString *)clientID
83+
secret:(NSString *)secret;
84+
85+
- (id)initWithBaseURL:(NSURL *)url
86+
sessionConfiguration:(nullable NSURLSessionConfiguration *)configuration
87+
clientID:(NSString *)clientID
88+
secret:(NSString *)secret;
89+
90+
///---------------------
91+
/// @name Authenticating
92+
///---------------------
93+
94+
/**
95+
Creates and enqueues an `NSURLSessionTask` to authenticate against the server using a specified username and password, with a designated scope.
96+
97+
@param URLString The URL string used to create the request URL.
98+
@param username The username used for authentication
99+
@param password The password used for authentication
100+
@param scope The authorization scope
101+
@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.
102+
@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.
103+
*/
104+
- (NSURLSessionTask *)authenticateUsingOAuthWithURLString:(NSString *)URLString
105+
username:(NSString *)username
106+
password:(NSString *)password
107+
scope:(NSString *)scope
108+
success:(void (^)(AFOAuthCredential *credential))success
109+
failure:(void (^)(NSError *error))failure;
110+
111+
/**
112+
Creates and enqueues an `NSURLSessionTask` to authenticate against the server with a designated scope.
113+
114+
@param URLString The URL string used to create the request URL.
115+
@param scope The authorization scope
116+
@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.
117+
@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.
118+
*/
119+
- (NSURLSessionTask *)authenticateUsingOAuthWithURLString:(NSString *)URLString
120+
scope:(NSString *)scope
121+
success:(void (^)(AFOAuthCredential *credential))success
122+
failure:(void (^)(NSError *error))failure;
123+
124+
/**
125+
Creates and enqueues an `NSURLSessionTask` to authenticate against the server with the specified parameters.
126+
127+
@param URLString The URL string used to create the request URL.
128+
@param parameters The parameters to be encoded and set in the request HTTP body.
129+
@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.
130+
@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.
131+
*/
132+
- (NSURLSessionTask *)authenticateUsingOAuthWithURLString:(NSString *)URLString
133+
parameters:(NSDictionary *)parameters
134+
success:(void (^)(AFOAuthCredential *credential))success
135+
failure:(void (^)(NSError *error))failure;
136+
14137
@end
138+
139+
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)