-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMCCSimpleOAuth2.h
72 lines (61 loc) · 2.44 KB
/
MCCSimpleOAuth2.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//
// MCCSimpleOAuth2.h
// OAuth Tester
//
// Created by Scott Little on 4/5/14.
// Copyright (c) 2014 Little Known Software, Inc. All rights reserved.
//
#import <WebKit/WebKit.h>
#import "MCCCommonHeader.h"
typedef NS_ENUM(NSInteger, MCC_PREFIXED_NAME(SimpleOAuthError)) {
MCC_PREFIXED_CONSTANT(SimpleOAuthErrorNoWebView) = 101,
MCC_PREFIXED_CONSTANT(SimpleOAuthErrorRetrievingToken),
MCC_PREFIXED_CONSTANT(SimpleOAuthErrorNavigation)
};
typedef NS_ENUM(NSInteger, MCC_PREFIXED_NAME(SimpleOAuthStorageType)) {
MCC_PREFIXED_CONSTANT(SimpleOAuthStorageTypeDefaults) = 0,
MCC_PREFIXED_CONSTANT(SimpleOAuthStorageTypeKeychain)
};
@class MCC_PREFIXED_NAME(SimpleOAuth2);
extern NSString *const MCC_PREFIXED_CONSTANT(SimpleOAuth2ErrorDomain);
extern NSString *const MCC_PREFIXED_CONSTANT(SimpleOAuth2AuthorizationNotification);
extern NSString *const MCC_PREFIXED_CONSTANT(SimpleOAuth2AuthorizationFailedNotification);
@interface MCC_PREFIXED_NAME(SimpleOAuth2) : NSObject
#ifdef MAC_OS_X_VERSION_10_11
<WebPolicyDelegate>
#endif
@property (strong) NSString *scope;
@property (strong) NSString *accessToken;
@property (strong) IBOutlet WebView *webview;
- (instancetype)initWithClientId:(NSString *)aClientId
clientSecret:(NSString *)aSecret
endpointURL:(NSURL *)anEndpointURL
tokenURL:(NSURL *)aTokenURL
redirectURL:(NSURL *)aRedirectURL
forServiceName:(NSString *)aServiceName
storageType:(MCC_PREFIXED_NAME(SimpleOAuthStorageType))aStorageType
bundleID:(NSString *)aStorageBundleID;
- (instancetype)initWithClientId:(NSString *)aClientId
clientSecret:(NSString *)aSecret
endpointURL:(NSURL *)anEndpointURL
tokenURL:(NSURL *)aTokenURL
redirectURL:(NSURL *)aRedirectURL
forServiceName:(NSString *)aServiceName
storageType:(MCC_PREFIXED_NAME(SimpleOAuthStorageType))aStorageType;
- (instancetype)initWithClientId:(NSString *)aClientId
clientSecret:(NSString *)aSecret
endpointURL:(NSURL *)anEndpointURL
tokenURL:(NSURL *)aTokenURL
redirectURL:(NSURL *)aRedirectURL
forServiceName:(NSString *)aServiceName
bundleID:(NSString *)aStorageBundleID;
- (instancetype)initWithClientId:(NSString *)aClientId
clientSecret:(NSString *)aSecret
endpointURL:(NSURL *)anEndpointURL
tokenURL:(NSURL *)aTokenURL
redirectURL:(NSURL *)aRedirectURL
forServiceName:(NSString *)aServiceName;
- (void)authorize;
- (void)deauthorize;
- (void)forceRenewalNow;
@end