GIDAuthorizationFlowProcessor.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright 2023 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 GIDSignInInternalOptions;
  18. @class OIDAuthorizationResponse;
  19. NS_ASSUME_NONNULL_BEGIN
  20. /// The protocol to control the authorization flow.
  21. @protocol GIDAuthorizationFlowProcessor <NSObject>
  22. /// The state of the authorization flow.
  23. @property(nonatomic, readonly, getter=isStarted) BOOL start;
  24. /// Starts the authorization flow.
  25. ///
  26. /// This method sends authorization request to AppAuth `OIDAuthorizationService` and gets back the
  27. /// response or an error.
  28. ///
  29. /// @param options The `GIDSignInInternalOptions` object to provide serverClientID, hostedDomain,
  30. /// clientID, scopes, loginHint and extraParams.
  31. /// @param emmSupport The EMM support info string.
  32. /// @param completion The block that is called on completion asynchronously.
  33. /// authorizationResponse The response from `OIDAuthorizationService`.
  34. /// error The error from `OIDAuthorizationService`.
  35. - (void)startWithOptions:(GIDSignInInternalOptions *)options
  36. emmSupport:(nullable NSString *)emmSupport
  37. completion:(void (^)(OIDAuthorizationResponse *_Nullable authorizationResponse,
  38. NSError *_Nullable error))completion;
  39. /// Handles the custom URL scheme opened by SFSafariViewController and returns control to the
  40. /// client on iOS 10.
  41. ///
  42. /// @param url The redirect URL invoked by the server.
  43. /// @return YES if the passed URL matches the expected redirect URL and was consumed, NO otherwise.
  44. - (BOOL)resumeExternalUserAgentFlowWithURL:(NSURL *)url;
  45. /// Cancels the authorization flow.
  46. - (void)cancelAuthenticationFlow;
  47. @end
  48. NS_ASSUME_NONNULL_END