diff options
author | 2017-07-27 18:19:00 -0700 | |
---|---|---|
committer | 2017-07-27 18:19:00 -0700 | |
commit | c95110a721e74bc7bf12cb9376d5997409473c58 (patch) | |
tree | 3a3e033b8d0c766750446846cbb4860d012c461c /src/objective-c/GRPCClient/GRPCCall+OAuth2.h | |
parent | 7dc61e04c916ad0c4472267be8a15d6e4aa0c493 (diff) |
Move OAuth2 provider to GRPCCall+OAuth2
Diffstat (limited to 'src/objective-c/GRPCClient/GRPCCall+OAuth2.h')
-rw-r--r-- | src/objective-c/GRPCClient/GRPCCall+OAuth2.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/objective-c/GRPCClient/GRPCCall+OAuth2.h b/src/objective-c/GRPCClient/GRPCCall+OAuth2.h index 65465e9523..adb1042aa0 100644 --- a/src/objective-c/GRPCClient/GRPCCall+OAuth2.h +++ b/src/objective-c/GRPCClient/GRPCCall+OAuth2.h @@ -18,6 +18,13 @@ #import "GRPCCall.h" +/** + * The protocol of an OAuth2 token object from which GRPCCall can acquire a token. + */ +@protocol GRPCAuthorizationProtocol +- (void)getTokenWithHandler:(void (^)(NSString *token))hander; +@end + /** Helpers for setting and reading headers compatible with OAuth2. */ @interface GRPCCall (OAuth2) @@ -33,4 +40,12 @@ /** Returns the value (if any) of the "www-authenticate" response header (the challenge header). */ @property(atomic, readonly) NSString *oauth2ChallengeHeader; +/** + * The authorization token object to be used when starting the call. If the value is set to nil, no + * oauth authentication will be used. + * + * If tokenProvider exists, it takes precedence over the token set by oauth2AccessToken. + */ +@property(atomic, strong) id<GRPCAuthorizationProtocol> tokenProvider; + @end |