blob: 65465e9523621ed03f50b2cf44451b159469b000 [file] [log] [blame]
Jorge Canizales594ae572015-08-06 22:08:53 -07001/*
2 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02003 * Copyright 2015 gRPC authors.
Jorge Canizales594ae572015-08-06 22:08:53 -07004 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02005 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
Jorge Canizales594ae572015-08-06 22:08:53 -07008 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02009 * http://www.apache.org/licenses/LICENSE-2.0
Jorge Canizales594ae572015-08-06 22:08:53 -070010 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +020011 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
Jorge Canizales594ae572015-08-06 22:08:53 -070016 *
17 */
18
19#import "GRPCCall.h"
20
Jorge Canizales88c32842015-10-26 10:18:59 -070021/** Helpers for setting and reading headers compatible with OAuth2. */
Jorge Canizales594ae572015-08-06 22:08:53 -070022@interface GRPCCall (OAuth2)
23
Jorge Canizales88c32842015-10-26 10:18:59 -070024/**
Muxi Yan2c88b462016-10-28 10:47:25 -070025 * Setting this property is equivalent to setting "Bearer <passed token>" as the value of the
26 * request header with key "authorization" (the authorization header). Setting it to nil removes the
27 * authorization header from the request.
28 * The value obtained by getting the property is the OAuth2 bearer token if the authorization header
29 * of the request has the form "Bearer <token>", or nil otherwise.
Jorge Canizales88c32842015-10-26 10:18:59 -070030 */
Jorge Canizales721b7a32015-08-07 10:11:16 -070031@property(atomic, copy) NSString *oauth2AccessToken;
Jorge Canizales594ae572015-08-06 22:08:53 -070032
Muxi Yan2c88b462016-10-28 10:47:25 -070033/** Returns the value (if any) of the "www-authenticate" response header (the challenge header). */
Jorge Canizales721b7a32015-08-07 10:11:16 -070034@property(atomic, readonly) NSString *oauth2ChallengeHeader;
Jorge Canizales594ae572015-08-06 22:08:53 -070035
36@end