GIDGoogleUser_Private.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 "GoogleSignIn/Sources/Public/GoogleSignIn/GIDGoogleUser.h"
  17. #ifdef SWIFT_PACKAGE
  18. @import AppAuth;
  19. #else
  20. #import <AppAuth/AppAuth.h>
  21. #endif
  22. @class OIDAuthState;
  23. NS_ASSUME_NONNULL_BEGIN
  24. /// A completion block that takes a `GIDGoogleUser` or an error if the attempt to refresh tokens was unsuccessful.
  25. typedef void (^GIDGoogleUserCompletion)(GIDGoogleUser *_Nullable user, NSError *_Nullable error);
  26. /// Internal methods for the class that are not part of the public API.
  27. @interface GIDGoogleUser () <OIDAuthStateChangeDelegate>
  28. @property(nonatomic, readwrite) GIDToken *accessToken;
  29. @property(nonatomic, readwrite) GIDToken *refreshToken;
  30. @property(nonatomic, readwrite, nullable) GIDToken *idToken;
  31. /// A representation of the state of the OAuth session for this instance.
  32. @property(nonatomic, readonly) OIDAuthState *authState;
  33. #pragma clang diagnostic push
  34. #pragma clang diagnostic ignored "-Wdeprecated-declarations"
  35. @property(nonatomic, readwrite) id<GTMFetcherAuthorizationProtocol> fetcherAuthorizer;
  36. #pragma clang diagnostic pop
  37. #if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
  38. // A string indicating support for Enterprise Mobility Management.
  39. @property(nonatomic, readonly, nullable) NSString *emmSupport;
  40. #endif // TARGET_OS_IOS && !TARGET_OS_MACCATALYST
  41. // Create a object with an auth state, scopes, and profile data.
  42. - (instancetype)initWithAuthState:(OIDAuthState *)authState
  43. profileData:(nullable GIDProfileData *)profileData;
  44. // Update the auth state and profile data.
  45. - (void)updateWithTokenResponse:(OIDTokenResponse *)tokenResponse
  46. authorizationResponse:(OIDAuthorizationResponse *)authorizationResponse
  47. profileData:(nullable GIDProfileData *)profileData;
  48. @end
  49. NS_ASSUME_NONNULL_END