This repository was archived by the owner on Aug 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 128
Expand file tree
/
Copy pathSimpleAuth.h
More file actions
82 lines (61 loc) · 2.73 KB
/
SimpleAuth.h
File metadata and controls
82 lines (61 loc) · 2.73 KB
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
73
74
75
76
77
78
79
80
81
82
//
// SimpleAuth.h
// SimpleAuth
//
// Created by Caleb Davenport on 11/6/13.
// Copyright (c) 2013-2014 Byliner, Inc. All rights reserved.
//
@import Foundation;
#import "SimpleAuthDefines.h"
@interface SimpleAuth : NSObject
/**
Set options used to configure each provider. Things like access tokens and
OAuth redirect URLs should be set here. Every provider should document the
options that it accepts. These options override a provider's default options,
and options passed to +authorize:options:completion: likewise override these.
@return A mutable dictionary whose string keys correspond to provider types
and values are dictionaries that are passed on to a provider during an
authorization operation.
@see +authorize:options:completion:
*/
+ (NSMutableDictionary *)configuration;
/**
Perform authorization with the given provider and all previously configured
and default provider options.
@param completion Called on the main queue when the operation is complete.
@see +authorize:options:completion:
*/
+ (void)authorize:(NSString *)provider completion:(SimpleAuthRequestHandler)completion;
/**
Perform an authorization with the given provider. Options provided here will
be applied on top of any configured or default provider options.
@param completion Called on the main queue when the operation is complete.
@see +configuration
@see +authorize:completion:
*/
+ (void)authorize:(NSString *)provider options:(NSDictionary *)options completion:(SimpleAuthRequestHandler)completion;
/**
Perform re-authorization with the given provider and all previously configured
and default provider options. This is for providers where the token expires and you
want to renew the non expired token.
@param token the unexpired token recieved from the service
@param completion Called on the main queue when the operation is complete.
@see +authorize:options:completion:
*/
+ (void)reAuthorize:(NSString *)provider token:(NSString *)token completion:(SimpleAuthRequestHandler)completion;
/**
Perform re-authorization with the given provider and all previously configured
and default provider options. This is for providers where the token expires and you
want to renew the non expired token.
@param token the unexpired token recieved from the service
@param completion Called on the main queue when the operation is complete.
@see +authorize:options:completion:
*/
+ (void)reAuthorize:(NSString *)type options:(NSDictionary *)options token:(NSString *)token completion:(SimpleAuthRequestHandler)completion;
/**
Determine whether the provider can handle the callback URL or not.
@return A boolean specifying if the provider handles the specified URL.
@param url The callback URL.
*/
+ (BOOL)handleCallback:(NSURL *)url;
@end