GIDConfiguration.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright 2021 Google LLC
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. NS_ASSUME_NONNULL_BEGIN
  18. /// This class represents the client configuration provided by the developer.
  19. @interface GIDConfiguration : NSObject <NSCopying, NSSecureCoding>
  20. /// The client ID of the app from the Google Cloud Console.
  21. @property(nonatomic, readonly) NSString *clientID;
  22. /// The client ID of the home server. This will be returned as the `audience` property of the
  23. /// OpenID Connect ID token. For more info on the ID token:
  24. /// https://developers.google.com/identity/sign-in/ios/backend-auth
  25. @property(nonatomic, readonly, nullable) NSString *serverClientID;
  26. /// The Google Apps domain to which users must belong to sign in. To verify, check
  27. /// `GIDGoogleUser`'s `hostedDomain` property.
  28. @property(nonatomic, readonly, nullable) NSString *hostedDomain;
  29. /// The OpenID2 realm of the home server. This allows Google to include the user's OpenID
  30. /// Identifier in the OpenID Connect ID token.
  31. @property(nonatomic, readonly, nullable) NSString *openIDRealm;
  32. /// Unavailable. Please use `initWithClientID:` or one of the other initializers below.
  33. /// :nodoc:
  34. + (instancetype)new NS_UNAVAILABLE;
  35. /// Unavailable. Please use `initWithClientID:` or one of the other initializers below.
  36. /// :nodoc:
  37. - (instancetype)init NS_UNAVAILABLE;
  38. /// Initialize a `GIDConfiguration` object with a client ID.
  39. ///
  40. /// @param clientID The client ID of the app.
  41. /// @return An initilized `GIDConfiguration` instance.
  42. - (instancetype)initWithClientID:(NSString *)clientID;
  43. /// Initialize a `GIDConfiguration` object with a client ID and server client ID.
  44. ///
  45. /// @param clientID The client ID of the app.
  46. /// @param serverClientID The server's client ID.
  47. /// @return An initilized `GIDConfiguration` instance.
  48. - (instancetype)initWithClientID:(NSString *)clientID
  49. serverClientID:(nullable NSString *)serverClientID;
  50. /// Initialize a `GIDConfiguration` object by specifying all available properties.
  51. ///
  52. /// @param clientID The client ID of the app.
  53. /// @param serverClientID The server's client ID.
  54. /// @param hostedDomain The Google Apps domain to be used.
  55. /// @param openIDRealm The OpenID realm to be used.
  56. /// @return An initilized `GIDConfiguration` instance.
  57. - (instancetype)initWithClientID:(NSString *)clientID
  58. serverClientID:(nullable NSString *)serverClientID
  59. hostedDomain:(nullable NSString *)hostedDomain
  60. openIDRealm:(nullable NSString *)openIDRealm NS_DESIGNATED_INITIALIZER;
  61. @end
  62. NS_ASSUME_NONNULL_END