OIDTokenResponse+Testing.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. #ifdef SWIFT_PACKAGE
  17. @import AppAuth;
  18. #else
  19. #import <AppAuth/OIDTokenResponse.h>
  20. #endif
  21. extern NSString *const kAccessToken;
  22. extern NSTimeInterval const kAccessTokenExpiresIn;
  23. extern NSString *const kRefreshToken;
  24. extern NSString *const kServerAuthCode;
  25. // ID token constants
  26. extern NSString *const kAlg;
  27. extern NSString *const kKid;
  28. extern NSString *const kTyp;
  29. extern NSString *const kUserID;
  30. extern NSString *const kHostedDomain;
  31. extern NSString *const kIssuer;
  32. extern NSString *const kAudience;
  33. extern NSTimeInterval const kIDTokenExpires;
  34. extern NSTimeInterval const kIssuedAt;
  35. extern NSString *const kFatNameKey;
  36. extern NSString *const kFatGivenNameKey;
  37. extern NSString *const kFatFamilyNameKey;
  38. extern NSString *const kFatPictureURLKey;
  39. extern NSString * const kFatName;
  40. extern NSString * const kFatGivenName;
  41. extern NSString * const kFatFamilyName;
  42. extern NSString * const kFatPictureURL;
  43. @interface OIDTokenResponse (Testing)
  44. + (instancetype)testInstance;
  45. + (instancetype)testInstanceWithIDToken:(NSString *)idToken;
  46. + (instancetype)testInstanceWithIDToken:(NSString *)idToken
  47. accessToken:(NSString *)accessToken
  48. expiresIn:(NSNumber *)expiresIn
  49. refreshToken:(NSString *)refreshToken
  50. tokenRequest:(OIDTokenRequest *)tokenRequest;
  51. + (NSString *)idToken;
  52. + (NSString *)fatIDToken;
  53. /**
  54. * @sub The subject of the ID token.
  55. * @exp The interval between 00:00:00 UTC on 1 January 1970 and the expiration date of the ID token.
  56. */
  57. + (NSString *)idTokenWithSub:(NSString *)sub exp:(NSNumber *)exp;
  58. + (NSString *)idTokenWithSub:(NSString *)sub exp:(NSNumber *)exp fat:(BOOL)fat;
  59. @end