Jorge Canizales | 594ae57 | 2015-08-06 22:08:53 -0700 | [diff] [blame] | 1 | /* |
| 2 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame^] | 3 | * Copyright 2015 gRPC authors. |
Jorge Canizales | 594ae57 | 2015-08-06 22:08:53 -0700 | [diff] [blame] | 4 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame^] | 5 | * 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 Canizales | 594ae57 | 2015-08-06 22:08:53 -0700 | [diff] [blame] | 8 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame^] | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
Jorge Canizales | 594ae57 | 2015-08-06 22:08:53 -0700 | [diff] [blame] | 10 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame^] | 11 | * 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 Canizales | 594ae57 | 2015-08-06 22:08:53 -0700 | [diff] [blame] | 16 | * |
| 17 | */ |
| 18 | |
| 19 | #import "GRPCCall.h" |
| 20 | |
Jorge Canizales | 88c3284 | 2015-10-26 10:18:59 -0700 | [diff] [blame] | 21 | /** Helpers for setting and reading headers compatible with OAuth2. */ |
Jorge Canizales | 594ae57 | 2015-08-06 22:08:53 -0700 | [diff] [blame] | 22 | @interface GRPCCall (OAuth2) |
| 23 | |
Jorge Canizales | 88c3284 | 2015-10-26 10:18:59 -0700 | [diff] [blame] | 24 | /** |
Muxi Yan | 2c88b46 | 2016-10-28 10:47:25 -0700 | [diff] [blame] | 25 | * 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 Canizales | 88c3284 | 2015-10-26 10:18:59 -0700 | [diff] [blame] | 30 | */ |
Jorge Canizales | 721b7a3 | 2015-08-07 10:11:16 -0700 | [diff] [blame] | 31 | @property(atomic, copy) NSString *oauth2AccessToken; |
Jorge Canizales | 594ae57 | 2015-08-06 22:08:53 -0700 | [diff] [blame] | 32 | |
Muxi Yan | 2c88b46 | 2016-10-28 10:47:25 -0700 | [diff] [blame] | 33 | /** Returns the value (if any) of the "www-authenticate" response header (the challenge header). */ |
Jorge Canizales | 721b7a3 | 2015-08-07 10:11:16 -0700 | [diff] [blame] | 34 | @property(atomic, readonly) NSString *oauth2ChallengeHeader; |
Jorge Canizales | 594ae57 | 2015-08-06 22:08:53 -0700 | [diff] [blame] | 35 | |
| 36 | @end |