GIDGoogleUser_Private.h 2.4 KB

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