GIDAuthorizationResponseHandling.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright 2024 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. @class GIDAuthFlow;
  18. @class GIDConfiguration;
  19. @class OIDAuthorizationResponse;
  20. NS_ASSUME_NONNULL_BEGIN
  21. /// A list of potential current flow names.
  22. typedef NS_ENUM(NSInteger, GIDFlowName) {
  23. /// The Sign In flow.
  24. GIDFlowNameSignIn = 0,
  25. /// The Verify flow.
  26. GIDFlowNameVerifyAccountDetail = 1,
  27. };
  28. @protocol GIDAuthorizationResponseHandling
  29. /// Initializes a new instance of the `GIDAuthorizationResponseHandling` class with the provided fields.
  30. ///
  31. /// @param authorizationResponse The authorization response to be processed.
  32. /// @param emmSupport The EMM support version.
  33. /// @param flowName The name of the current flow.
  34. /// @param configuration The configuration.
  35. /// @param error The error thrown if there's no authorization response.
  36. /// @return A new initialized instance of the `GIDAuthorizationResponseHandling` class.
  37. - (instancetype)
  38. initWithAuthorizationResponse:(nullable OIDAuthorizationResponse *)authorizationResponse
  39. emmSupport:(nullable NSString *)emmSupport
  40. flowName:(enum GIDFlowName)flowName
  41. configuration:(nullable GIDConfiguration *)configuration
  42. error:(nullable NSError *)error;
  43. /// Fetches the access token if necessary as part of the auth flow.
  44. ///
  45. /// @param authFlow The auth flow to either fetch tokens or error.
  46. - (void)maybeFetchToken:(GIDAuthFlow *)authFlow;
  47. /// Processes the authorization response and returns an auth flow.
  48. ///
  49. /// @return An instance of `GIDAuthFlow`.
  50. - (GIDAuthFlow *)generateAuthFlowFromAuthorizationResponse;
  51. @end
  52. NS_ASSUME_NONNULL_END