From 36f12d0871b2a63a7b00d0fe160319fff5ba0f6d Mon Sep 17 00:00:00 2001 From: Julien Bodet Date: Tue, 2 Jun 2020 20:57:26 -0400 Subject: [PATCH 01/81] Add badges to README --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5f54c2c39..66405977c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,12 @@ ![AppAuth for iOS and macOS](https://rawgit.com/openid/AppAuth-iOS/master/appauth_lockup.svg) [![Build Status](https://travis-ci.org/openid/AppAuth-iOS.svg?branch=master)](https://travis-ci.org/openid/AppAuth-iOS) -[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) +[![codecov](https://codecov.io/gh/openid/AppAuth-iOS/branch/master/graph/badge.svg)](https://codecov.io/gh/openid/AppAuth-iOS) +[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-brightgreen.svg?style=flat)](https://github.com/Carthage/Carthage) +[![SwiftPM compatible](https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg?style=flat)](https://swift.org/package-manager) +[![Pod Version](https://img.shields.io/cocoapods/v/AppAuth.svg?style=flat)](https://cocoapods.org/pods/AppAuth) +[![Pod License](https://img.shields.io/cocoapods/l/AppAuth.svg?style=flat)](https://github.com/openid/AppAuth-iOS/blob/master/LICENSE) +[![Pod Platform](https://img.shields.io/cocoapods/p/AppAuth.svg?style=flat)](https://cocoapods.org/pods/AppAuth) +[![Catalyst compatible](https://img.shields.io/badge/Catalyst-compatible-brightgreen.svg?style=flat)](https://developer.apple.com/documentation/xcode/creating_a_mac_version_of_your_ipad_app) AppAuth for iOS and macOS is a client SDK for communicating with [OAuth 2.0](https://tools.ietf.org/html/rfc6749) and From df840e881d2f9d80c8af037c6acf9573175ecaff Mon Sep 17 00:00:00 2001 From: Souleiman Benhida Date: Tue, 9 Jun 2020 11:55:28 -0400 Subject: [PATCH 02/81] Make Core, ExternalUserAgent the default subspecs Make ExternalUserAgent subspec depend on Core. Use deployment_target instead of platform. --- AppAuth.podspec | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/AppAuth.podspec b/AppAuth.podspec index 819560619..73ff1c808 100644 --- a/AppAuth.podspec +++ b/AppAuth.podspec @@ -31,7 +31,10 @@ It follows the OAuth 2.0 for Native Apps best current practice # classes of AppAuth with tokens on watchOS and tvOS, but currently the # library won't help you obtain authorization grants on those platforms. - s.platforms = { :ios => "7.0", :osx => "10.9", :watchos => "2.0", :tvos => "9.0" } + s.ios.deployment_target = "7.0" + s.osx.deployment_target = "10.9" + s.watchos.deployment_target = "2.0" + s.tvos.deployment_target = "9.0" s.source = { :git => "https://github.com/openid/AppAuth-iOS.git", :tag => s.version } s.requires_arc = true @@ -44,8 +47,9 @@ It follows the OAuth 2.0 for Native Apps best current practice # Subspec for the full AppAuth library, including platform-dependant external user agents. s.subspec 'ExternalUserAgent' do |externalUserAgent| - - externalUserAgent.source_files = "Source/*.{h,m}", "Source/AppAuthCore/*.{h,m}", "Source/AppAuth/*.{h,m}" + externalUserAgent.dependency 'AppAuth/Core' + + externalUserAgent.source_files = "Source/AppAuth.h", "Source/AppAuth/*.{h,m}" # iOS externalUserAgent.ios.source_files = "Source/AppAuth/iOS/**/*.{h,m}" @@ -55,6 +59,8 @@ It follows the OAuth 2.0 for Native Apps best current practice # macOS externalUserAgent.osx.source_files = "Source/AppAuth/macOS/**/*.{h,m}" - externalUserAgent.osx.deployment_target = '10.9' + externalUserAgent.osx.deployment_target = '10.9' end + + s.default_subspec = 'Core', 'ExternalUserAgent' end From e8d2864225ae8fce4714d44d74a4073e25190686 Mon Sep 17 00:00:00 2001 From: Souleiman Benhida Date: Fri, 10 Jul 2020 14:28:18 -0400 Subject: [PATCH 03/81] Move OIDExternalAgentCustomBrowser into its own subspec and framework Created the EntepriseUserAgent subspec, and AppAuthEnterpriseUserAgent framework target to house this and future external user agents aimed at enterprises. --- AppAuth.podspec | 12 +- AppAuth.xcodeproj/project.pbxproj | 272 +++++++++++++++++- .../AppAuthEnterpriseUserAgent.xcscheme | 67 +++++ .../xcschemes/AppAuth_tvOS.xcscheme | 22 +- Package.swift | 15 +- README.md | 41 ++- Source/AppAuth.h | 1 - Source/AppAuthEnterpriseUserAgent.h | 21 ++ .../OIDExternalUserAgentIOSCustomBrowser.h | 0 .../OIDExternalUserAgentIOSCustomBrowser.m | 0 .../AppAuthEnterpriseUserAgent.h | 59 ++++ .../EnterpriseUserAgentFramework/Info.plist | 26 ++ Source/Framework/AppAuth.h | 1 - 13 files changed, 509 insertions(+), 28 deletions(-) create mode 100644 AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuthEnterpriseUserAgent.xcscheme create mode 100644 Source/AppAuthEnterpriseUserAgent.h rename Source/{AppAuth => AppAuthEnterpriseUserAgent}/iOS/OIDExternalUserAgentIOSCustomBrowser.h (100%) rename Source/{AppAuth => AppAuthEnterpriseUserAgent}/iOS/OIDExternalUserAgentIOSCustomBrowser.m (100%) create mode 100644 Source/EnterpriseUserAgentFramework/AppAuthEnterpriseUserAgent.h create mode 100644 Source/EnterpriseUserAgentFramework/Info.plist diff --git a/AppAuth.podspec b/AppAuth.podspec index 73ff1c808..b34dbe3f1 100644 --- a/AppAuth.podspec +++ b/AppAuth.podspec @@ -41,8 +41,7 @@ It follows the OAuth 2.0 for Native Apps best current practice # Subspec for the core AppAuth library classes only, suitable for extensions. s.subspec 'Core' do |core| - core.source_files = "Source/*.{h,m}", "Source/AppAuthCore/*.{h,m}" - core.exclude_files = "Source/AppAuth.h" + core.source_files = "Source/AppAuthCore.h", "Source/AppAuthCore/*.{h,m}" end # Subspec for the full AppAuth library, including platform-dependant external user agents. @@ -62,5 +61,12 @@ It follows the OAuth 2.0 for Native Apps best current practice externalUserAgent.osx.deployment_target = '10.9' end - s.default_subspec = 'Core', 'ExternalUserAgent' + s.subspec 'EnterpriseUserAgent' do |enterpriseUserAgent| + enterpriseUserAgent.dependency 'AppAuth/Core' + + enterpriseUserAgent.ios.source_files = "Source/AppAuthEnterpriseUserAgent.h", "Source/AppAuthEnterpriseUserAgent/iOS/**/*.{h,m}" + enterpriseUserAgent.ios.deployment_target = "7.0" + end + + s.default_subspecs = 'Core', 'ExternalUserAgent' end diff --git a/AppAuth.xcodeproj/project.pbxproj b/AppAuth.xcodeproj/project.pbxproj index bac5ad53b..058bb712b 100644 --- a/AppAuth.xcodeproj/project.pbxproj +++ b/AppAuth.xcodeproj/project.pbxproj @@ -13,6 +13,67 @@ 06C19E9B22B474A200C19CE1 /* OIDEndSessionResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = CF6431F31F228A980075B6B5 /* OIDEndSessionResponse.m */; }; 06C19E9C22B474A600C19CE1 /* OIDEndSessionRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = CF37C06B1F1FC21A00662E41 /* OIDEndSessionRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; 06C19E9D22B474AD00C19CE1 /* OIDEndSessionRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = CF37C06C1F1FC21A00662E41 /* OIDEndSessionRequest.m */; }; + 2D0BB86C249D5BAF005BA653 /* AppAuthEnterpriseUserAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D0BB86B249D5BAF005BA653 /* AppAuthEnterpriseUserAgent.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B81F249053190005B197 /* OIDExternalUserAgentIOS.m in Sources */ = {isa = PBXBuildFile; fileRef = A6DEABA82018E5B50022AC32 /* OIDExternalUserAgentIOS.m */; }; + 2D91B820249053190005B197 /* OIDExternalUserAgentCatalyst.m in Sources */ = {isa = PBXBuildFile; fileRef = F9A7082D2355ED74004B3E6D /* OIDExternalUserAgentCatalyst.m */; }; + 2D91B821249053190005B197 /* OIDFieldMapping.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741C41C5D8243000EF209 /* OIDFieldMapping.m */; }; + 2D91B822249053190005B197 /* OIDIDToken.m in Sources */ = {isa = PBXBuildFile; fileRef = 34A663271E871DD40060B664 /* OIDIDToken.m */; }; + 2D91B823249053190005B197 /* OIDEndSessionResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = CF6431F31F228A980075B6B5 /* OIDEndSessionResponse.m */; }; + 2D91B824249053190005B197 /* OIDAuthState.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741BB1C5D8243000EF209 /* OIDAuthState.m */; }; + 2D91B825249053190005B197 /* OIDAuthState+IOS.m in Sources */ = {isa = PBXBuildFile; fileRef = F6F60FB01D2BFEFE00325CB3 /* OIDAuthState+IOS.m */; }; + 2D91B826249053190005B197 /* OIDTokenResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741D41C5D8243000EF209 /* OIDTokenResponse.m */; }; + 2D91B827249053190005B197 /* OIDErrorUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741C21C5D8243000EF209 /* OIDErrorUtilities.m */; }; + 2D91B828249053190005B197 /* OIDURLQueryComponent.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741D81C5D8243000EF209 /* OIDURLQueryComponent.m */; }; + 2D91B829249053190005B197 /* OIDAuthorizationRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741B51C5D8243000EF209 /* OIDAuthorizationRequest.m */; }; + 2D91B82A249053190005B197 /* OIDAuthorizationService.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741B91C5D8243000EF209 /* OIDAuthorizationService.m */; }; + 2D91B82B249053190005B197 /* OIDClientMetadataParameters.m in Sources */ = {isa = PBXBuildFile; fileRef = 60140F791DE4276800DA0DC3 /* OIDClientMetadataParameters.m */; }; + 2D91B82C249053190005B197 /* OIDTokenUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741D61C5D8243000EF209 /* OIDTokenUtilities.m */; }; + 2D91B82D249053190005B197 /* OIDServiceDiscovery.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741D01C5D8243000EF209 /* OIDServiceDiscovery.m */; }; + 2D91B82E249053190005B197 /* OIDTokenRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741D21C5D8243000EF209 /* OIDTokenRequest.m */; }; + 2D91B82F249053190005B197 /* OIDExternalUserAgentIOSCustomBrowser.m in Sources */ = {isa = PBXBuildFile; fileRef = 345AE745202D526800738D22 /* OIDExternalUserAgentIOSCustomBrowser.m */; }; + 2D91B830249053190005B197 /* OIDEndSessionRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = CF37C06C1F1FC21A00662E41 /* OIDEndSessionRequest.m */; }; + 2D91B831249053190005B197 /* OIDAuthorizationService+IOS.m in Sources */ = {isa = PBXBuildFile; fileRef = F6F60FB11D2BFEFE00325CB3 /* OIDAuthorizationService+IOS.m */; }; + 2D91B832249053190005B197 /* OIDServiceConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741CE1C5D8243000EF209 /* OIDServiceConfiguration.m */; }; + 2D91B833249053190005B197 /* OIDRegistrationResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 60140F7F1DE4344200DA0DC3 /* OIDRegistrationResponse.m */; }; + 2D91B834249053190005B197 /* OIDURLSessionProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 039697451FA8258D003D1FB2 /* OIDURLSessionProvider.m */; }; + 2D91B835249053190005B197 /* OIDScopes.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741CA1C5D8243000EF209 /* OIDScopes.m */; }; + 2D91B836249053190005B197 /* OIDScopeUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741CC1C5D8243000EF209 /* OIDScopeUtilities.m */; }; + 2D91B837249053190005B197 /* OIDGrantTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741C61C5D8243000EF209 /* OIDGrantTypes.m */; }; + 2D91B838249053190005B197 /* OIDRegistrationRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 60140F7B1DE42E1000DA0DC3 /* OIDRegistrationRequest.m */; }; + 2D91B839249053190005B197 /* OIDResponseTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741C81C5D8243000EF209 /* OIDResponseTypes.m */; }; + 2D91B83A249053190005B197 /* OIDAuthorizationResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741B71C5D8243000EF209 /* OIDAuthorizationResponse.m */; }; + 2D91B83B249053190005B197 /* OIDError.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741C01C5D8243000EF209 /* OIDError.m */; }; + 2D91B83E249053190005B197 /* OIDAuthorizationResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741B61C5D8243000EF209 /* OIDAuthorizationResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B83F249053190005B197 /* OIDScopes.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741C91C5D8243000EF209 /* OIDScopes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B840249053190005B197 /* OIDExternalUserAgentRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = A6DEAB9A2018E4A20022AC32 /* OIDExternalUserAgentRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B841249053190005B197 /* OIDAuthStateChangeDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741BC1C5D8243000EF209 /* OIDAuthStateChangeDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B842249053190005B197 /* OIDExternalUserAgentIOSCustomBrowser.h in Headers */ = {isa = PBXBuildFile; fileRef = 345AE746202D526800738D22 /* OIDExternalUserAgentIOSCustomBrowser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B844249053190005B197 /* OIDExternalUserAgentCatalyst.h in Headers */ = {isa = PBXBuildFile; fileRef = F9A7082C2355ED74004B3E6D /* OIDExternalUserAgentCatalyst.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B845249053190005B197 /* OIDIDToken.h in Headers */ = {isa = PBXBuildFile; fileRef = 34A663261E871DD40060B664 /* OIDIDToken.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B846249053190005B197 /* OIDResponseTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741C71C5D8243000EF209 /* OIDResponseTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B847249053190005B197 /* OIDTokenRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741D11C5D8243000EF209 /* OIDTokenRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B848249053190005B197 /* OIDScopeUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741CB1C5D8243000EF209 /* OIDScopeUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B849249053190005B197 /* OIDTokenResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741D31C5D8243000EF209 /* OIDTokenResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B84A249053190005B197 /* OIDEndSessionResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = CF6431F21F228A980075B6B5 /* OIDEndSessionResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B84B249053190005B197 /* OIDServiceDiscovery.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741CF1C5D8243000EF209 /* OIDServiceDiscovery.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B84C249053190005B197 /* OIDGrantTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741C51C5D8243000EF209 /* OIDGrantTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B84D249053190005B197 /* OIDURLSessionProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 039697441FA8258D003D1FB2 /* OIDURLSessionProvider.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B84E249053190005B197 /* OIDAuthState+IOS.h in Headers */ = {isa = PBXBuildFile; fileRef = F6F60FB51D2BFEFE00325CB3 /* OIDAuthState+IOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B84F249053190005B197 /* OIDRegistrationResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 60140F7E1DE4335200DA0DC3 /* OIDRegistrationResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B850249053190005B197 /* OIDExternalUserAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = A6DEAB982018E4A20022AC32 /* OIDExternalUserAgent.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B851249053190005B197 /* OIDExternalUserAgentSession.h in Headers */ = {isa = PBXBuildFile; fileRef = A6DEAB992018E4A20022AC32 /* OIDExternalUserAgentSession.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B852249053190005B197 /* OIDServiceConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741CD1C5D8243000EF209 /* OIDServiceConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B853249053190005B197 /* OIDAuthStateErrorDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741BD1C5D8243000EF209 /* OIDAuthStateErrorDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B854249053190005B197 /* OIDAuthorizationService.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741B81C5D8243000EF209 /* OIDAuthorizationService.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B855249053190005B197 /* OIDRegistrationRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 60140F7D1DE42E3000DA0DC3 /* OIDRegistrationRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B856249053190005B197 /* OIDEndSessionRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = CF37C06B1F1FC21A00662E41 /* OIDEndSessionRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B857249053190005B197 /* OIDAuthState.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741BA1C5D8243000EF209 /* OIDAuthState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B858249053190005B197 /* OIDErrorUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741C11C5D8243000EF209 /* OIDErrorUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B859249053190005B197 /* OIDAuthorizationService+IOS.h in Headers */ = {isa = PBXBuildFile; fileRef = F6F60FB31D2BFEFE00325CB3 /* OIDAuthorizationService+IOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B85A249053190005B197 /* OIDAuthorizationRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741B41C5D8243000EF209 /* OIDAuthorizationRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B85B249053190005B197 /* OIDTokenUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741D51C5D8243000EF209 /* OIDTokenUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B85C249053190005B197 /* OIDError.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741BF1C5D8243000EF209 /* OIDError.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D91B85D249053190005B197 /* OIDExternalUserAgentIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = A6DEABA92018E5B50022AC32 /* OIDExternalUserAgentIOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; 340DAE571D5821A100EC285B /* OIDAuthorizationService+Mac.m in Sources */ = {isa = PBXBuildFile; fileRef = 340DAE261D581FE700EC285B /* OIDAuthorizationService+Mac.m */; }; 340DAE581D5821A100EC285B /* OIDExternalUserAgentMac.m in Sources */ = {isa = PBXBuildFile; fileRef = 340DAE281D581FE700EC285B /* OIDExternalUserAgentMac.m */; }; 340DAE591D5821A100EC285B /* OIDAuthState+Mac.m in Sources */ = {isa = PBXBuildFile; fileRef = 340DAE2A1D581FE700EC285B /* OIDAuthState+Mac.m */; }; @@ -384,9 +445,6 @@ 343AAB9B1E834A8800F9D36E /* AppAuth.h in Headers */ = {isa = PBXBuildFile; fileRef = 343AAA4D1E8345B600F9D36E /* AppAuth.h */; settings = {ATTRIBUTES = (Public, ); }; }; 343AAB9C1E834A8900F9D36E /* AppAuth.h in Headers */ = {isa = PBXBuildFile; fileRef = 343AAA4D1E8345B600F9D36E /* AppAuth.h */; settings = {ATTRIBUTES = (Public, ); }; }; 343AAB9D1E834A8A00F9D36E /* AppAuth.h in Headers */ = {isa = PBXBuildFile; fileRef = 343AAA4D1E8345B600F9D36E /* AppAuth.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 345AE747202D526900738D22 /* OIDExternalUserAgentIOSCustomBrowser.m in Sources */ = {isa = PBXBuildFile; fileRef = 345AE745202D526800738D22 /* OIDExternalUserAgentIOSCustomBrowser.m */; }; - 345AE748202D526900738D22 /* OIDExternalUserAgentIOSCustomBrowser.m in Sources */ = {isa = PBXBuildFile; fileRef = 345AE745202D526800738D22 /* OIDExternalUserAgentIOSCustomBrowser.m */; }; - 345AE749202D526900738D22 /* OIDExternalUserAgentIOSCustomBrowser.h in Headers */ = {isa = PBXBuildFile; fileRef = 345AE746202D526800738D22 /* OIDExternalUserAgentIOSCustomBrowser.h */; settings = {ATTRIBUTES = (Public, ); }; }; 347423E41E7F3C4000D3E6D6 /* OIDAuthorizationResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741B71C5D8243000EF209 /* OIDAuthorizationResponse.m */; }; 347423FF1E7F4BA000D3E6D6 /* OIDAuthorizationRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741B51C5D8243000EF209 /* OIDAuthorizationRequest.m */; }; 347424001E7F4BA000D3E6D6 /* OIDAuthorizationResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741B71C5D8243000EF209 /* OIDAuthorizationResponse.m */; }; @@ -605,6 +663,10 @@ 039697441FA8258D003D1FB2 /* OIDURLSessionProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDURLSessionProvider.h; sourceTree = ""; }; 039697451FA8258D003D1FB2 /* OIDURLSessionProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OIDURLSessionProvider.m; sourceTree = ""; }; 0396974C1FA827AD003D1FB2 /* OIDURLSessionProviderTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OIDURLSessionProviderTests.m; sourceTree = ""; }; + 2D0BB86A249D5B75005BA653 /* AppAuthEnterpriseUserAgent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppAuthEnterpriseUserAgent.h; sourceTree = ""; }; + 2D0BB86B249D5BAF005BA653 /* AppAuthEnterpriseUserAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppAuthEnterpriseUserAgent.h; sourceTree = ""; }; + 2D91B862249053190005B197 /* AppAuthEnterpriseUserAgent.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AppAuthEnterpriseUserAgent.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 2D91B868249177180005B197 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 340DAE251D581FE700EC285B /* OIDAuthorizationService+Mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "OIDAuthorizationService+Mac.h"; sourceTree = ""; }; 340DAE261D581FE700EC285B /* OIDAuthorizationService+Mac.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "OIDAuthorizationService+Mac.m"; sourceTree = ""; }; 340DAE271D581FE700EC285B /* OIDExternalUserAgentMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDExternalUserAgentMac.h; sourceTree = ""; }; @@ -737,6 +799,13 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 2D91B83C249053190005B197 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 340DAE4B1D58216A00EC285B /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -862,6 +931,32 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 2D47AAD2249988770059B5A4 /* AppAuthEnterpriseUserAgent */ = { + isa = PBXGroup; + children = ( + 2D47AAD3249988B90059B5A4 /* iOS */, + ); + path = AppAuthEnterpriseUserAgent; + sourceTree = ""; + }; + 2D47AAD3249988B90059B5A4 /* iOS */ = { + isa = PBXGroup; + children = ( + 345AE746202D526800738D22 /* OIDExternalUserAgentIOSCustomBrowser.h */, + 345AE745202D526800738D22 /* OIDExternalUserAgentIOSCustomBrowser.m */, + ); + path = iOS; + sourceTree = ""; + }; + 2D91B867249177180005B197 /* EnterpriseUserAgentFramework */ = { + isa = PBXGroup; + children = ( + 2D0BB86B249D5BAF005BA653 /* AppAuthEnterpriseUserAgent.h */, + 2D91B868249177180005B197 /* Info.plist */, + ); + path = EnterpriseUserAgentFramework; + sourceTree = ""; + }; 340DAE241D581FE700EC285B /* macOS */ = { isa = PBXGroup; children = ( @@ -909,6 +1004,7 @@ 343AAACA1E8348AA00F9D36E /* AppAuth_macOSTests.xctest */, 342F42C32177B1FC00574F24 /* AppAuthCore.framework */, 348970972177B3B000ABEED4 /* AppAuthCoreTests.xctest */, + 2D91B862249053190005B197 /* AppAuthEnterpriseUserAgent.framework */, ); name = Products; sourceTree = ""; @@ -916,12 +1012,15 @@ 341741AE1C5D8243000EF209 /* Source */ = { isa = PBXGroup; children = ( + 2D47AAD2249988770059B5A4 /* AppAuthEnterpriseUserAgent */, + 2D91B867249177180005B197 /* EnterpriseUserAgentFramework */, 348970992178F40600ABEED4 /* CoreFramework */, 343AAA4C1E8345B600F9D36E /* Framework */, 8A9B9D5E24561EC40055353E /* AppAuthCore */, 8A9B9D632456227D0055353E /* AppAuth */, 341741AF1C5D8243000EF209 /* AppAuth.h */, 3489709E21791B0C00ABEED4 /* AppAuthCore.h */, + 2D0BB86A249D5B75005BA653 /* AppAuthEnterpriseUserAgent.h */, ); path = Source; sourceTree = ""; @@ -1078,8 +1177,6 @@ children = ( F6F60FB31D2BFEFE00325CB3 /* OIDAuthorizationService+IOS.h */, F6F60FB11D2BFEFE00325CB3 /* OIDAuthorizationService+IOS.m */, - 345AE746202D526800738D22 /* OIDExternalUserAgentIOSCustomBrowser.h */, - 345AE745202D526800738D22 /* OIDExternalUserAgentIOSCustomBrowser.m */, F6F60FB51D2BFEFE00325CB3 /* OIDAuthState+IOS.h */, F6F60FB01D2BFEFE00325CB3 /* OIDAuthState+IOS.m */, A6DEABA92018E5B50022AC32 /* OIDExternalUserAgentIOS.h */, @@ -1093,6 +1190,45 @@ /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ + 2D91B83D249053190005B197 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 2D0BB86C249D5BAF005BA653 /* AppAuthEnterpriseUserAgent.h in Headers */, + 2D91B842249053190005B197 /* OIDExternalUserAgentIOSCustomBrowser.h in Headers */, + 2D91B83E249053190005B197 /* OIDAuthorizationResponse.h in Headers */, + 2D91B83F249053190005B197 /* OIDScopes.h in Headers */, + 2D91B840249053190005B197 /* OIDExternalUserAgentRequest.h in Headers */, + 2D91B841249053190005B197 /* OIDAuthStateChangeDelegate.h in Headers */, + 2D91B845249053190005B197 /* OIDIDToken.h in Headers */, + 2D91B846249053190005B197 /* OIDResponseTypes.h in Headers */, + 2D91B847249053190005B197 /* OIDTokenRequest.h in Headers */, + 2D91B848249053190005B197 /* OIDScopeUtilities.h in Headers */, + 2D91B849249053190005B197 /* OIDTokenResponse.h in Headers */, + 2D91B84A249053190005B197 /* OIDEndSessionResponse.h in Headers */, + 2D91B84B249053190005B197 /* OIDServiceDiscovery.h in Headers */, + 2D91B84C249053190005B197 /* OIDGrantTypes.h in Headers */, + 2D91B84D249053190005B197 /* OIDURLSessionProvider.h in Headers */, + 2D91B84F249053190005B197 /* OIDRegistrationResponse.h in Headers */, + 2D91B850249053190005B197 /* OIDExternalUserAgent.h in Headers */, + 2D91B851249053190005B197 /* OIDExternalUserAgentSession.h in Headers */, + 2D91B852249053190005B197 /* OIDServiceConfiguration.h in Headers */, + 2D91B853249053190005B197 /* OIDAuthStateErrorDelegate.h in Headers */, + 2D91B854249053190005B197 /* OIDAuthorizationService.h in Headers */, + 2D91B855249053190005B197 /* OIDRegistrationRequest.h in Headers */, + 2D91B856249053190005B197 /* OIDEndSessionRequest.h in Headers */, + 2D91B857249053190005B197 /* OIDAuthState.h in Headers */, + 2D91B858249053190005B197 /* OIDErrorUtilities.h in Headers */, + 2D91B85A249053190005B197 /* OIDAuthorizationRequest.h in Headers */, + 2D91B85B249053190005B197 /* OIDTokenUtilities.h in Headers */, + 2D91B85C249053190005B197 /* OIDError.h in Headers */, + 2D91B859249053190005B197 /* OIDAuthorizationService+IOS.h in Headers */, + 2D91B84E249053190005B197 /* OIDAuthState+IOS.h in Headers */, + 2D91B85D249053190005B197 /* OIDExternalUserAgentIOS.h in Headers */, + 2D91B844249053190005B197 /* OIDExternalUserAgentCatalyst.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 340DAE4C1D58216A00EC285B /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -1144,7 +1280,6 @@ 343AAAF31E83499000F9D36E /* OIDScopes.h in Headers */, A6DEAB9F2018E4B00022AC32 /* OIDExternalUserAgentRequest.h in Headers */, 343AAAE81E83499000F9D36E /* OIDAuthStateChangeDelegate.h in Headers */, - 345AE749202D526900738D22 /* OIDExternalUserAgentIOSCustomBrowser.h in Headers */, 343AAA6B1E83465500F9D36E /* AppAuth.h in Headers */, F9A7082E2355ED74004B3E6D /* OIDExternalUserAgentCatalyst.h in Headers */, 34A663291E871DD40060B664 /* OIDIDToken.h in Headers */, @@ -1285,6 +1420,24 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ + 2D91B81D249053190005B197 /* AppAuthEnterpriseUserAgent */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2D91B85F249053190005B197 /* Build configuration list for PBXNativeTarget "AppAuthEnterpriseUserAgent" */; + buildPhases = ( + 2D91B81E249053190005B197 /* Sources */, + 2D91B83C249053190005B197 /* Frameworks */, + 2D91B83D249053190005B197 /* Headers */, + 2D91B85E249053190005B197 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = AppAuthEnterpriseUserAgent; + productName = AppAuth_iOS; + productReference = 2D91B862249053190005B197 /* AppAuthEnterpriseUserAgent.framework */; + productType = "com.apple.product-type.framework"; + }; 340DAE4D1D58216A00EC285B /* AppAuth-macOS */ = { isa = PBXNativeTarget; buildConfigurationList = 340DAE541D58216A00EC285B /* Build configuration list for PBXNativeTarget "AppAuth-macOS" */; @@ -1663,11 +1816,19 @@ 343AAAC91E8348AA00F9D36E /* AppAuth_macOSTests */, 342F42842177B1FC00574F24 /* AppAuthCore */, 3489707D2177B3B000ABEED4 /* AppAuthCoreTests */, + 2D91B81D249053190005B197 /* AppAuthEnterpriseUserAgent */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 2D91B85E249053190005B197 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 341741EE1C5D8283000EF209 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -1755,6 +1916,42 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 2D91B81E249053190005B197 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2D91B82F249053190005B197 /* OIDExternalUserAgentIOSCustomBrowser.m in Sources */, + 2D91B821249053190005B197 /* OIDFieldMapping.m in Sources */, + 2D91B822249053190005B197 /* OIDIDToken.m in Sources */, + 2D91B823249053190005B197 /* OIDEndSessionResponse.m in Sources */, + 2D91B824249053190005B197 /* OIDAuthState.m in Sources */, + 2D91B826249053190005B197 /* OIDTokenResponse.m in Sources */, + 2D91B827249053190005B197 /* OIDErrorUtilities.m in Sources */, + 2D91B828249053190005B197 /* OIDURLQueryComponent.m in Sources */, + 2D91B829249053190005B197 /* OIDAuthorizationRequest.m in Sources */, + 2D91B82A249053190005B197 /* OIDAuthorizationService.m in Sources */, + 2D91B82B249053190005B197 /* OIDClientMetadataParameters.m in Sources */, + 2D91B82C249053190005B197 /* OIDTokenUtilities.m in Sources */, + 2D91B82D249053190005B197 /* OIDServiceDiscovery.m in Sources */, + 2D91B82E249053190005B197 /* OIDTokenRequest.m in Sources */, + 2D91B830249053190005B197 /* OIDEndSessionRequest.m in Sources */, + 2D91B832249053190005B197 /* OIDServiceConfiguration.m in Sources */, + 2D91B833249053190005B197 /* OIDRegistrationResponse.m in Sources */, + 2D91B834249053190005B197 /* OIDURLSessionProvider.m in Sources */, + 2D91B835249053190005B197 /* OIDScopes.m in Sources */, + 2D91B836249053190005B197 /* OIDScopeUtilities.m in Sources */, + 2D91B837249053190005B197 /* OIDGrantTypes.m in Sources */, + 2D91B838249053190005B197 /* OIDRegistrationRequest.m in Sources */, + 2D91B839249053190005B197 /* OIDResponseTypes.m in Sources */, + 2D91B83A249053190005B197 /* OIDAuthorizationResponse.m in Sources */, + 2D91B83B249053190005B197 /* OIDError.m in Sources */, + 2D91B825249053190005B197 /* OIDAuthState+IOS.m in Sources */, + 2D91B831249053190005B197 /* OIDAuthorizationService+IOS.m in Sources */, + 2D91B81F249053190005B197 /* OIDExternalUserAgentIOS.m in Sources */, + 2D91B820249053190005B197 /* OIDExternalUserAgentCatalyst.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 340DAE4A1D58216A00EC285B /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -1812,7 +2009,6 @@ 341741DE1C5D8243000EF209 /* OIDAuthState.m in Sources */, CF37C06E1F1FC21A00662E41 /* OIDEndSessionRequest.m in Sources */, 341741DD1C5D8243000EF209 /* OIDAuthorizationService.m in Sources */, - 345AE747202D526900738D22 /* OIDExternalUserAgentIOSCustomBrowser.m in Sources */, 341741EB1C5D8243000EF209 /* OIDURLQueryComponent.m in Sources */, 341741E11C5D8243000EF209 /* OIDFieldMapping.m in Sources */, 039697461FA8258D003D1FB2 /* OIDURLSessionProvider.m in Sources */, @@ -1980,7 +2176,6 @@ 343AAA931E83478900F9D36E /* OIDTokenUtilities.m in Sources */, 343AAA901E83478900F9D36E /* OIDServiceDiscovery.m in Sources */, 343AAA911E83478900F9D36E /* OIDTokenRequest.m in Sources */, - 345AE748202D526900738D22 /* OIDExternalUserAgentIOSCustomBrowser.m in Sources */, A6DEAB8A2017A7140022AC32 /* OIDEndSessionRequest.m in Sources */, 343AAA6F1E83467D00F9D36E /* OIDAuthorizationService+IOS.m in Sources */, 343AAA8F1E83478900F9D36E /* OIDServiceConfiguration.m in Sources */, @@ -2261,6 +2456,58 @@ /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ + 2D91B860249053190005B197 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CODE_SIGN_IDENTITY = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Source/EnterpriseUserAgentFramework/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = net.openid.AppAuthEnterpriseUserAgent; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SUPPORTS_MACCATALYST = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 2D91B861249053190005B197 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CODE_SIGN_IDENTITY = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Source/EnterpriseUserAgentFramework/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = net.openid.AppAuthEnterpriseUserAgent; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SUPPORTS_MACCATALYST = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; 340DAE551D58216A00EC285B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -2943,6 +3190,15 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 2D91B85F249053190005B197 /* Build configuration list for PBXNativeTarget "AppAuthEnterpriseUserAgent" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2D91B860249053190005B197 /* Debug */, + 2D91B861249053190005B197 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 340DAE541D58216A00EC285B /* Build configuration list for PBXNativeTarget "AppAuth-macOS" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuthEnterpriseUserAgent.xcscheme b/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuthEnterpriseUserAgent.xcscheme new file mode 100644 index 000000000..3c18d8b46 --- /dev/null +++ b/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuthEnterpriseUserAgent.xcscheme @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuth_tvOS.xcscheme b/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuth_tvOS.xcscheme index 47b0457ab..ade3db91f 100644 --- a/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuth_tvOS.xcscheme +++ b/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuth_tvOS.xcscheme @@ -27,6 +27,15 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> + + + + @@ -39,17 +48,6 @@ - - - - - - - - `. This includes all the files included by AppAuth/AppAuthCore, so only this import is necessary. + +##### Swift Package Manager +Include the `AppAuthEnterpriseUserAgent` target alongside any targets you were already using. + +Make sure to import `AppAuthEnterpriseUserAgent.h` in addition to `AppAuth.h` if you are using the full `AppAuth` functionality. + Here's how to configure AppAuth to use a custom browser using the `OIDExternalUserAgentIOSCustomBrowser` user agent: @@ -526,6 +544,9 @@ This is required so that AppAuth can test for the browser and open the app store if it's not installed (the default behavior of this user-agent). You only need to include the URL scheme of the actual browser you intend to use. +Next, make sure to import the correct header file. +If using CocoaPods/Swift Package manager, make sure to import AppAuthEnterpriseUserAgent alongside AppAuth/AppAuthCore. + Objective-C ```objc // performs authentication request @@ -535,7 +556,7 @@ id userAgent = [OIDExternalUserAgentIOSCustomBrowser CustomBrowserChrome]; appDelegate.currentAuthorizationFlow = [OIDAuthState authStateByPresentingAuthorizationRequest:request - externalUserAgent:self + externalUserAgent:userAgent callback:^(OIDAuthState *_Nullable authState, NSError *_Nullable error) { if (authState) { @@ -549,6 +570,24 @@ appDelegate.currentAuthorizationFlow = }]; ``` +Swift +``` +guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { + self.logMessage("Error accessing AppDelegate") + return + } +let userAgent = OIDExternalUserAgentIOSCustomBrowser.customBrowserChrome() +appDelegate.currentAuthorizationFlow = OIDAuthState.authState(byPresenting: request, externalUserAgent: userAgent) { authState, error in + if let authState = authState { + self.setAuthState(authState) + self.logMessage("Got authorization tokens. Access token: \(authState.lastTokenResponse?.accessToken ?? "DEFAULT_TOKEN")") + } else { + self.logMessage("Authorization error: \(error?.localizedDescription ?? "DEFAULT_ERROR")") + self.setAuthState(nil) + } +} +``` + That's it! With those two changes (which you can try on the included sample), AppAuth will use Chrome iOS for the authorization request (and open Chrome in the App Store if it's not installed). diff --git a/Source/AppAuth.h b/Source/AppAuth.h index 4f779df38..0b68463fb 100644 --- a/Source/AppAuth.h +++ b/Source/AppAuth.h @@ -49,7 +49,6 @@ #import "OIDAuthState+IOS.h" #import "OIDAuthorizationService+IOS.h" #import "OIDExternalUserAgentIOS.h" -#import "OIDExternalUserAgentIOSCustomBrowser.h" #import "OIDExternalUserAgentCatalyst.h" #elif TARGET_OS_MAC #import "OIDAuthState+Mac.h" diff --git a/Source/AppAuthEnterpriseUserAgent.h b/Source/AppAuthEnterpriseUserAgent.h new file mode 100644 index 000000000..3bc505418 --- /dev/null +++ b/Source/AppAuthEnterpriseUserAgent.h @@ -0,0 +1,21 @@ +/*! @file AppAuthEnterpriseUserAgent.h + @brief AppAuth iOS SDK + @copyright + Copyright 2020 Google Inc. All Rights Reserved. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#import "AppAuthCore.h" + +#import "OIDExternalUserAgentIOSCustomBrowser.h" diff --git a/Source/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.h b/Source/AppAuthEnterpriseUserAgent/iOS/OIDExternalUserAgentIOSCustomBrowser.h similarity index 100% rename from Source/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.h rename to Source/AppAuthEnterpriseUserAgent/iOS/OIDExternalUserAgentIOSCustomBrowser.h diff --git a/Source/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.m b/Source/AppAuthEnterpriseUserAgent/iOS/OIDExternalUserAgentIOSCustomBrowser.m similarity index 100% rename from Source/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.m rename to Source/AppAuthEnterpriseUserAgent/iOS/OIDExternalUserAgentIOSCustomBrowser.m diff --git a/Source/EnterpriseUserAgentFramework/AppAuthEnterpriseUserAgent.h b/Source/EnterpriseUserAgentFramework/AppAuthEnterpriseUserAgent.h new file mode 100644 index 000000000..70c152deb --- /dev/null +++ b/Source/EnterpriseUserAgentFramework/AppAuthEnterpriseUserAgent.h @@ -0,0 +1,59 @@ +/*! @file AppAuthEnterpriseUserAgentEnterpriseUserAgent.h + @brief AppAuthEnterpriseUserAgent iOS SDK + @copyright + Copyright 2020 Google Inc. All Rights Reserved. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#import + +//! Project version number for AppAuthEnterpriseUserAgentEnterpriseUserAgentFramework. +FOUNDATION_EXPORT double AppAuthEnterpriseUserAgentEnterpriseUserAgentVersionNumber; + +//! Project version string for AppAuthEnterpriseUserAgentEnterpriseUserAgentFramework. +FOUNDATION_EXPORT const unsigned char AppAuthEnterpriseUserAgentEnterpriseUserAgentVersionString[]; + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + +#import +#import +#import +#import "AppAuthEnterpriseUserAgent/OIDExternalUserAgentCatalyst.h" + +#import diff --git a/Source/EnterpriseUserAgentFramework/Info.plist b/Source/EnterpriseUserAgentFramework/Info.plist new file mode 100644 index 000000000..fdd42e8ac --- /dev/null +++ b/Source/EnterpriseUserAgentFramework/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSHumanReadableCopyright + Copyright © 2020 The AppAuth Authors + NSPrincipalClass + + + diff --git a/Source/Framework/AppAuth.h b/Source/Framework/AppAuth.h index 4c76aeb2c..d53ed1347 100644 --- a/Source/Framework/AppAuth.h +++ b/Source/Framework/AppAuth.h @@ -57,7 +57,6 @@ FOUNDATION_EXPORT const unsigned char AppAuthVersionString[]; #import #import #import -#import #import "AppAuth/OIDExternalUserAgentCatalyst.h" #elif TARGET_OS_MAC #import From 80ea9b5b7b670b8d77ff545d50ea894f6afe6c85 Mon Sep 17 00:00:00 2001 From: Souleiman Benhida Date: Fri, 10 Jul 2020 16:13:02 -0400 Subject: [PATCH 04/81] Replace itms-apps with https --- .../iOS/OIDExternalUserAgentIOSCustomBrowser.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/AppAuthEnterpriseUserAgent/iOS/OIDExternalUserAgentIOSCustomBrowser.m b/Source/AppAuthEnterpriseUserAgent/iOS/OIDExternalUserAgentIOSCustomBrowser.m index 51d2e56cf..be5dc820c 100644 --- a/Source/AppAuthEnterpriseUserAgent/iOS/OIDExternalUserAgentIOSCustomBrowser.m +++ b/Source/AppAuthEnterpriseUserAgent/iOS/OIDExternalUserAgentIOSCustomBrowser.m @@ -39,7 +39,7 @@ + (instancetype)CustomBrowserChrome { // Chrome iOS documentation: https://developer.chrome.com/multidevice/ios/links OIDCustomBrowserURLTransformation transform = [[self class] URLTransformationSchemeSubstitutionHTTPS:@"googlechromes" HTTP:@"googlechrome"]; NSURL *appStoreURL = - [NSURL URLWithString:@"itms-apps://itunes.apple.com/us/app/chrome/id535886823"]; + [NSURL URLWithString:@"https://itunes.apple.com/us/app/chrome/id535886823"]; return [[[self class] alloc] initWithURLTransformation:transform canOpenURLScheme:@"googlechromes" appStoreURL:appStoreURL]; @@ -50,7 +50,7 @@ + (instancetype)CustomBrowserFirefox { OIDCustomBrowserURLTransformation transform = [[self class] URLTransformationSchemeConcatPrefix:@"firefox://open-url?url="]; NSURL *appStoreURL = - [NSURL URLWithString:@"itms-apps://itunes.apple.com/us/app/firefox-web-browser/id989804926"]; + [NSURL URLWithString:@"https://itunes.apple.com/us/app/firefox-web-browser/id989804926"]; return [[[self class] alloc] initWithURLTransformation:transform canOpenURLScheme:@"firefox" appStoreURL:appStoreURL]; @@ -60,7 +60,7 @@ + (instancetype)CustomBrowserOpera { OIDCustomBrowserURLTransformation transform = [[self class] URLTransformationSchemeSubstitutionHTTPS:@"opera-https" HTTP:@"opera-http"]; NSURL *appStoreURL = - [NSURL URLWithString:@"itms-apps://itunes.apple.com/us/app/opera-mini-web-browser/id363729560"]; + [NSURL URLWithString:@"https://itunes.apple.com/us/app/opera-mini-web-browser/id363729560"]; return [[[self class] alloc] initWithURLTransformation:transform canOpenURLScheme:@"opera-https" appStoreURL:appStoreURL]; From 7232d6efc94f9160360f3345890ed906b873c68c Mon Sep 17 00:00:00 2001 From: Peter Andrews Date: Thu, 16 Jul 2020 23:42:11 -0700 Subject: [PATCH 05/81] Exclude unit test files from code coverage analysis. --- .codecov.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .codecov.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 000000000..45de502e0 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,2 @@ +ignore: + - "UnitTests" From 9d04840f4cdb99005dc9f54d054d5526534d1354 Mon Sep 17 00:00:00 2001 From: William Denniss Date: Tue, 2 Jun 2020 15:35:56 -0700 Subject: [PATCH 06/81] Import TV authorization flow from GTMAppAuth - Code is from tree https://github.com/google/GTMAppAuth/tree/10d138eb05ad299fd6260741e7b92b0090db0963 - I contributed this code originally to GTMAppAuth on Dec 6, 2016 https://github.com/google/GTMAppAuth/commit/2eb382fd62c727026e3816db51e6c6da4105ebb5 --- Source/AppAuthTV/GTMAppAuth.h | 21 ++ Source/AppAuthTV/GTMTVAuthorizationRequest.h | 57 ++++ Source/AppAuthTV/GTMTVAuthorizationRequest.m | 125 +++++++++ Source/AppAuthTV/GTMTVAuthorizationResponse.h | 96 +++++++ Source/AppAuthTV/GTMTVAuthorizationResponse.m | 164 +++++++++++ Source/AppAuthTV/GTMTVAuthorizationService.h | 82 ++++++ Source/AppAuthTV/GTMTVAuthorizationService.m | 259 ++++++++++++++++++ Source/AppAuthTV/GTMTVServiceConfiguration.h | 65 +++++ Source/AppAuthTV/GTMTVServiceConfiguration.m | 100 +++++++ 9 files changed, 969 insertions(+) create mode 100644 Source/AppAuthTV/GTMAppAuth.h create mode 100644 Source/AppAuthTV/GTMTVAuthorizationRequest.h create mode 100644 Source/AppAuthTV/GTMTVAuthorizationRequest.m create mode 100644 Source/AppAuthTV/GTMTVAuthorizationResponse.h create mode 100644 Source/AppAuthTV/GTMTVAuthorizationResponse.m create mode 100644 Source/AppAuthTV/GTMTVAuthorizationService.h create mode 100644 Source/AppAuthTV/GTMTVAuthorizationService.m create mode 100644 Source/AppAuthTV/GTMTVServiceConfiguration.h create mode 100644 Source/AppAuthTV/GTMTVServiceConfiguration.m diff --git a/Source/AppAuthTV/GTMAppAuth.h b/Source/AppAuthTV/GTMAppAuth.h new file mode 100644 index 000000000..b018d6fc4 --- /dev/null +++ b/Source/AppAuthTV/GTMAppAuth.h @@ -0,0 +1,21 @@ +/*! @file GTMAppAuth.h + @brief GTMAppAuth SDK + @copyright + Copyright 2016 Google Inc. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "GTMTVAuthorizationRequest.h" +#import "GTMTVAuthorizationResponse.h" +#import "GTMTVAuthorizationService.h" diff --git a/Source/AppAuthTV/GTMTVAuthorizationRequest.h b/Source/AppAuthTV/GTMTVAuthorizationRequest.h new file mode 100644 index 000000000..84334f0a2 --- /dev/null +++ b/Source/AppAuthTV/GTMTVAuthorizationRequest.h @@ -0,0 +1,57 @@ +/*! @file GTMTVAuthorizationRequest.h + @brief GTMAppAuth SDK + @copyright + Copyright 2016 Google Inc. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import + +#ifndef GTMAPPAUTH_USER_IMPORTS +#import +#else // GTMAPPAUTH_USER_IMPORTS +#import "AppAuthCore.h" +#endif // GTMAPPAUTH_USER_IMPORTS + +@class GTMTVServiceConfiguration; + +NS_ASSUME_NONNULL_BEGIN + +/*! @brief Represents a TV and limited input device authorization request. + @see https://developers.google.com/identity/protocols/OAuth2ForDevices + */ +@interface GTMTVAuthorizationRequest : OIDAuthorizationRequest + +/*! @brief Creates a TV authorization request with opinionated defaults + @param configuration The service's configuration. + @param clientID The client identifier. + @param clientSecret The client secret. + @param scopes An array of scopes to combine into a single scope string per the OAuth2 spec. + @param additionalParameters The client's additional authorization parameters. + */ +- (instancetype) + initWithConfiguration:(GTMTVServiceConfiguration *)configuration + clientId:(NSString *)clientID + clientSecret:(NSString *)clientSecret + scopes:(nullable NSArray *)scopes + additionalParameters:(nullable NSDictionary *)additionalParameters; + +/*! @brief Constructs an @c NSURLRequest representing the TV authorization request. + @return An @c NSURLRequest representing the TV authorization request. + */ +- (NSURLRequest *)URLRequest; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Source/AppAuthTV/GTMTVAuthorizationRequest.m b/Source/AppAuthTV/GTMTVAuthorizationRequest.m new file mode 100644 index 000000000..7b1e69791 --- /dev/null +++ b/Source/AppAuthTV/GTMTVAuthorizationRequest.m @@ -0,0 +1,125 @@ +/*! @file GTMTVAuthorizationRequest.m + @brief GTMAppAuth SDK + @copyright + Copyright 2016 Google Inc. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "GTMTVAuthorizationRequest.h" + +#ifndef GTMAPPAUTH_USER_IMPORTS +#import +#import +#else // GTMAPPAUTH_USER_IMPORTS +#import "AppAuthCore.h" +#import "OIDURLQueryComponent.h" +#endif // GTMAPPAUTH_USER_IMPORTS +#import "GTMTVServiceConfiguration.h" + +@implementation GTMTVAuthorizationRequest + +- (instancetype) + initWithConfiguration:(GTMTVServiceConfiguration *)configuration + clientId:(NSString *)clientID + clientSecret:(nullable NSString *)clientSecret + scope:(nullable NSString *)scope + redirectURL:(NSURL *)redirectURL + responseType:(NSString *)responseType + state:(nullable NSString *)state + nonce:(nullable NSString *)nonce + codeVerifier:(nullable NSString *)codeVerifier + codeChallenge:(nullable NSString *)codeChallenge + codeChallengeMethod:(nullable NSString *)codeChallengeMethod + additionalParameters:(nullable NSDictionary *)additionalParameters { + + if (![configuration isKindOfClass:[GTMTVServiceConfiguration class]]) { + NSAssert([configuration isKindOfClass:[GTMTVServiceConfiguration class]], + @"configuration parameter must be of type GTMTVServiceConfiguration, encountered %@", + NSStringFromClass([configuration class])); + return nil; + } + + return [super initWithConfiguration:configuration + clientId:clientID + clientSecret:clientSecret + scope:scope + redirectURL:redirectURL + responseType:responseType + state:state + nonce:nonce + codeVerifier:codeVerifier + codeChallenge:codeChallenge + codeChallengeMethod:codeChallengeMethod + additionalParameters:additionalParameters]; +} + +- (instancetype) + initWithConfiguration:(GTMTVServiceConfiguration *)configuration + clientId:(NSString *)clientID + clientSecret:(NSString *)clientSecret + scopes:(nullable NSArray *)scopes + additionalParameters:(nullable NSDictionary *)additionalParameters { + return [self initWithConfiguration:configuration + clientId:clientID + clientSecret:clientSecret + scopes:scopes + redirectURL:[[NSURL alloc] init] + responseType:OIDResponseTypeCode + additionalParameters:additionalParameters]; +} + +#pragma mark - NSObject overrides + +- (NSString *)description { + return [NSString stringWithFormat:@"<%@: %p, request: %@>", + NSStringFromClass([self class]), + self, + self.authorizationRequestURL]; +} + +#pragma mark - + +- (NSURLRequest *)URLRequest { + OIDURLQueryComponent *query = [[OIDURLQueryComponent alloc] init]; + + // Required parameters. + [query addParameter:@"client_id" value:self.clientID]; + + if (self.additionalParameters) { + // Add any additional parameters the client has specified. + [query addParameters:(NSDictionary *)self.additionalParameters]; + } + + if (self.scope) { + [query addParameter:@"scope" value:(NSString *)self.scope]; + } + + static NSString *const kHTTPPost = @"POST"; + static NSString *const kHTTPContentTypeHeaderKey = @"Content-Type"; + static NSString *const kHTTPContentTypeHeaderValue = + @"application/x-www-form-urlencoded; charset=UTF-8"; + + GTMTVServiceConfiguration *tvConfiguration = (GTMTVServiceConfiguration *)self.configuration; + + NSMutableURLRequest *URLRequest = + [[NSURLRequest requestWithURL:tvConfiguration.TVAuthorizationEndpoint] mutableCopy]; + URLRequest.HTTPMethod = kHTTPPost; + [URLRequest setValue:kHTTPContentTypeHeaderValue forHTTPHeaderField:kHTTPContentTypeHeaderKey]; + NSString *bodyString = [query URLEncodedParameters]; + NSData *body = [bodyString dataUsingEncoding:NSUTF8StringEncoding]; + URLRequest.HTTPBody = body; + return URLRequest; +} + +@end diff --git a/Source/AppAuthTV/GTMTVAuthorizationResponse.h b/Source/AppAuthTV/GTMTVAuthorizationResponse.h new file mode 100644 index 000000000..d5987f2a0 --- /dev/null +++ b/Source/AppAuthTV/GTMTVAuthorizationResponse.h @@ -0,0 +1,96 @@ +/*! @file GTMTVAuthorizationResponse.h + @brief GTMAppAuth SDK + @copyright + Copyright 2016 Google Inc. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import + +#ifndef GTMAPPAUTH_USER_IMPORTS +#import +#else // GTMAPPAUTH_USER_IMPORTS +#import "AppAuthCore.h" +#endif // GTMAPPAUTH_USER_IMPORTS + +@class GTMTVAuthorizationRequest; +@class OIDTokenRequest; + +NS_ASSUME_NONNULL_BEGIN + +/*! @brief The @c grant_type value for the the TV authorization flow. + @see https://developers.google.com/identity/protocols/OAuth2ForDevices + */ +extern NSString *const GTMTVDeviceTokenGrantType; + +/*! @brief Represents the response to a TV authorization request. + @see https://developers.google.com/identity/protocols/OAuth2ForDevices + */ +@interface GTMTVAuthorizationResponse : OIDAuthorizationResponse + +/*! @brief The verification URL that should be displayed to the user instructing them to visit the + URL and enter the code. + @remarks verification_url + */ +@property(nonatomic, readonly, nullable) NSString *verificationURL; + +/*! @brief The code that should be displayed to the user which they enter at the @c verificationURL. + @remarks user_code + */ +@property(nonatomic, readonly, nullable) NSString *userCode; + +/*! @brief The device code grant used to poll the token endpoint. Rather than using this directly, + use the provided @c tokenPollRequest method to create the token request. + @remarks device_code + */ +@property(nonatomic, readonly, nullable) NSString *deviceCode; + +/*! @brief The interval at which the token endpoint should be polled with the @c deviceCode. + @remarks interval + */ +@property(nonatomic, readonly, nullable) NSNumber *interval; + +/*! @brief The date at which the user can no longer authorize this request. + @remarks expires_in + */ +@property(nonatomic, readonly, nullable) NSDate *expirationDate; + +/*! @brief Designated initializer. + @param request The serviced request. + @param parameters The decoded parameters returned from the Authorization Server. + @remarks Known parameters are extracted from the @c parameters parameter and the normative + properties are populated. Non-normative parameters are placed in the + @c #additionalParameters dictionary. + */ +- (instancetype)initWithRequest:(GTMTVAuthorizationRequest *)request + parameters:(NSDictionary *> *)parameters + NS_DESIGNATED_INITIALIZER; + +/*! @brief Creates a token request suitable for polling the token endpoint with the @c deviceCode. + @return A @c OIDTokenRequest suitable for polling the token endpoint. + @see https://developers.google.com/identity/protocols/OAuth2ForDevices + */ +- (nullable OIDTokenRequest *)tokenPollRequest; + +/*! @brief Creates a token request suitable for polling the token endpoint with the @c deviceCode. + @param additionalParameters Additional parameters for the token request. + @return A @c OIDTokenRequest suitable for polling the token endpoint. + @see https://developers.google.com/identity/protocols/OAuth2ForDevices + */ +- (nullable OIDTokenRequest *)tokenPollRequestWithAdditionalParameters: + (nullable NSDictionary *)additionalParameters; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Source/AppAuthTV/GTMTVAuthorizationResponse.m b/Source/AppAuthTV/GTMTVAuthorizationResponse.m new file mode 100644 index 000000000..556d3f282 --- /dev/null +++ b/Source/AppAuthTV/GTMTVAuthorizationResponse.m @@ -0,0 +1,164 @@ +/*! @file GTMTVAuthorizationResponse.m + @brief GTMAppAuth SDK + @copyright + Copyright 2016 Google Inc. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "GTMTVAuthorizationResponse.h" + +#import "GTMTVAuthorizationRequest.h" +#ifndef GTMAPPAUTH_USER_IMPORTS +#import +#import +#import +#else // GTMAPPAUTH_USER_IMPORTS +#import "AppAuthCore.h" +#import "OIDDefines.h" +#import "OIDFieldMapping.h" +#endif // GTMAPPAUTH_USER_IMPORTS + + +NSString *const GTMTVDeviceTokenGrantType = @"http://oauth.net/grant_type/device/1.0"; + +/*! @brief The key for the @c verificationURL property in the incoming parameters and for + @c NSSecureCoding. + */ +static NSString *const kVerificationURLKey = @"verification_url"; + +/*! @brief The key for the @c userCode property in the incoming parameters and for + @c NSSecureCoding. + */ +static NSString *const kUserCodeKey = @"user_code"; + +/*! @brief The key for the @c deviceCode property in the incoming parameters and for + @c NSSecureCoding. + */ +static NSString *const kDeviceCodeKey = @"device_code"; + +/*! @brief The key for the @c expirationDate property in the incoming parameters and for + @c NSSecureCoding. + */ +static NSString *const kExpiresInKey = @"expires_in"; + +/*! @brief The key for the @c interval property in the incoming parameters and for + @c NSSecureCoding. + */ +static NSString *const kIntervalKey = @"interval"; + +/*! @brief Key used to encode the @c additionalParameters property for @c NSSecureCoding + */ +static NSString *const kAdditionalParametersKey = @"additionalParameters"; + +/*! @brief Key used to encode the @c request property for @c NSSecureCoding + */ +static NSString *const kRequestKey = @"request"; + +@implementation GTMTVAuthorizationResponse + +@synthesize verificationURL = _verificationURL; +@synthesize userCode = _userCode; +@synthesize deviceCode = _deviceCode; +@synthesize interval = _interval; +@synthesize expirationDate = _expirationDate; + +/*! @brief Returns a mapping of incoming parameters to instance variables. + @return A mapping of incoming parameters to instance variables. + */ ++ (NSDictionary *)fieldMap { + static NSMutableDictionary *fieldMap; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + fieldMap = [NSMutableDictionary dictionary]; + fieldMap[kVerificationURLKey] = + [[OIDFieldMapping alloc] initWithName:@"_verificationURL" type:[NSString class]]; + fieldMap[kUserCodeKey] = + [[OIDFieldMapping alloc] initWithName:@"_userCode" type:[NSString class]]; + fieldMap[kDeviceCodeKey] = + [[OIDFieldMapping alloc] initWithName:@"_deviceCode" type:[NSString class]]; + fieldMap[kExpiresInKey] = + [[OIDFieldMapping alloc] initWithName:@"_expirationDate" + type:[NSDate class] + conversion:^id _Nullable(NSObject *_Nullable value) { + if (![value isKindOfClass:[NSNumber class]]) { + return value; + } + NSNumber *valueAsNumber = (NSNumber *)value; + return [NSDate dateWithTimeIntervalSinceNow:[valueAsNumber longLongValue]]; + }]; + fieldMap[kIntervalKey] = + [[OIDFieldMapping alloc] initWithName:@"_interval" type:[NSNumber class]]; + }); + return fieldMap; +} + +#pragma mark - Initializers + +- (instancetype)initWithRequest:(GTMTVAuthorizationRequest *)request + parameters:(NSDictionary *> *)parameters { + self = [super initWithRequest:request parameters:parameters]; + return self; +} + +#pragma mark - NSCopying + +- (instancetype)copyWithZone:(nullable NSZone *)zone { + // The documentation for NSCopying specifically advises us to return a reference to the original + // instance in the case where instances are immutable (as ours is): + // "Implement NSCopying by retaining the original instead of creating a new copy when the class + // and its contents are immutable." + return self; +} + +#pragma mark - NSObject overrides + +- (NSString *)description { + return [NSString stringWithFormat:@"<%@: %p, verificationURL: %@, userCode: \"%@\", deviceCode: " + "\"%@\", interval: %@, expirationDate: %@, " + "additionalParameters: %@, " + "request: %@>", + NSStringFromClass([self class]), + self, + _verificationURL, + _userCode, + _deviceCode, + _interval, + _expirationDate, + self.additionalParameters, + self.request]; +} + +#pragma mark - + +- (OIDTokenRequest *)tokenPollRequest { + return [self tokenPollRequestWithAdditionalParameters:nil]; +} + +- (OIDTokenRequest *)tokenPollRequestWithAdditionalParameters: + (NSDictionary *)additionalParameters { + OIDTokenRequest *pollRequest = + [[OIDTokenRequest alloc] initWithConfiguration:self.request.configuration + grantType:GTMTVDeviceTokenGrantType + authorizationCode:_deviceCode + redirectURL:[[NSURL alloc] init] + clientID:self.request.clientID + clientSecret:self.request.clientSecret + scopes:nil + refreshToken:nil + codeVerifier:nil + additionalParameters:nil]; + return pollRequest; +} + +@end diff --git a/Source/AppAuthTV/GTMTVAuthorizationService.h b/Source/AppAuthTV/GTMTVAuthorizationService.h new file mode 100644 index 000000000..620372a12 --- /dev/null +++ b/Source/AppAuthTV/GTMTVAuthorizationService.h @@ -0,0 +1,82 @@ +/*! @file GTMTVAuthorizationService.h + @brief GTMAppAuth SDK + @copyright + Copyright 2016 Google Inc. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +@class GTMAppAuthFetcherAuthorization; +@class GTMTVAuthorizationRequest; +@class GTMTVAuthorizationResponse; +@class GTMTVServiceConfiguration; + +/*! @brief The block that is called when the TV authorization has initialized. + @param response The authorization response, or nil if there was an error. Display + @c GTMTVAuthorizationResponse.userCode and @c GTMTVAuthorizationResponse.verificationURL to + the user so they can action the request. + @param error The error if an error occurred. + */ +typedef void (^GTMTVAuthorizationInitialization)(GTMTVAuthorizationResponse *_Nullable response, + NSError *_Nullable error); + +/*! @brief The block that is called when the TV authorization has completed. + @param authorization The @c GTMAppAuthFetcherAuthorization which you can use to authorize + API calls, or nil if there was an error. + @param error The error if an error occurred. + */ +typedef void (^GTMTVAuthorizationCompletion) + (GTMAppAuthFetcherAuthorization *_Nullable authorization, + NSError *_Nullable error); + +/*! @brief Block returned when authorization is initialized to that will cancel the pending + authorization when executed. Has no effect if called twice or after the authorization + concluded. + */ +typedef void (^GTMTVAuthorizationCancelBlock)(void); + +/*! @brief Performs authorization flows designed for TVs and other limited input devices. + */ +@interface GTMTVAuthorizationService : NSObject + +#if !GTM_APPAUTH_SKIP_GOOGLE_SUPPORT +/*! @brief Convenience method to return the TV authorization URL for Google. + @return TV authorization URL for Google. + */ ++ (GTMTVServiceConfiguration *)TVConfigurationForGoogle; +#endif // !GTM_APPAUTH_SKIP_GOOGLE_SUPPORT + +/*! @brief Starts a TV authorization flow with the given request and polls for a response. + @param request The TV authorization request to initiate. + @param initialization Block that is called with the initial authorization response. Unlike other + OAuth authorization responses, the TV authorization response doesn't contain the + authorization as the user has yet to grant it. Rather, it contains the information that you + show to the user in order for them to authorize the request on another device. + @param completion Block that is called on the success or failure of the authorization. If the + user approves the request, you will get a @c GTMAppAuthFetherAuthorization that you can use + to authenticate API calls, otherwis eyou will get an error. + @return A block which you can execute if you need to cancel the ongoing authorization. Has no + effect if called twice, or called after the authorization concludes. + @see https://developers.google.com/identity/protocols/OAuth2ForDevices + */ ++ (GTMTVAuthorizationCancelBlock)authorizeTVRequest:(GTMTVAuthorizationRequest *)request + initializaiton:(GTMTVAuthorizationInitialization)initialization + completion:(GTMTVAuthorizationCompletion)completion; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Source/AppAuthTV/GTMTVAuthorizationService.m b/Source/AppAuthTV/GTMTVAuthorizationService.m new file mode 100644 index 000000000..64957f578 --- /dev/null +++ b/Source/AppAuthTV/GTMTVAuthorizationService.m @@ -0,0 +1,259 @@ +/*! @file GTMAppAuthFetcherAuthorization.m + @brief GTMAppAuth SDK + @copyright + Copyright 2016 Google Inc. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "GTMTVAuthorizationService.h" + +#ifndef GTMAPPAUTH_USER_IMPORTS +#import +#import +#import +#else // GTMAPPAUTH_USER_IMPORTS +#import "AppAuthCore.h" +#import "OIDDefines.h" +#import "OIDURLQueryComponent.h" +#endif // GTMAPPAUTH_USER_IMPORTS + +#import "GTMAppAuthFetcherAuthorization.h" +#import "GTMTVAuthorizationRequest.h" +#import "GTMTVAuthorizationResponse.h" +#import "GTMTVServiceConfiguration.h" + +/*! @brief Google's device authorization endpoint. + */ +NSString *const kGoogleDeviceAuthorizationEndpoint = + @"https://accounts.google.com/o/oauth2/device/code"; + +/*! @brief The authorization pending error code. + @see https://developers.google.com/identity/protocols/OAuth2ForDevices + */ +NSString *const kErrorCodeAuthorizationPending = @"authorization_pending"; + +/*! @brief The slow down error code. + @see https://developers.google.com/identity/protocols/OAuth2ForDevices + */ +NSString *const kErrorCodeSlowDown = @"slow_down"; + +@implementation GTMTVAuthorizationService + +#pragma mark - Initializers + +#if !GTM_APPAUTH_SKIP_GOOGLE_SUPPORT ++ (GTMTVServiceConfiguration *)TVConfigurationForGoogle { + NSURL *authorizationEndpoint = + [NSURL URLWithString:@"https://accounts.google.com/o/oauth2/v2/auth"]; + NSURL *tokenEndpoint = + [NSURL URLWithString:@"https://www.googleapis.com/oauth2/v4/token"]; + NSURL *TVAuthorizationEndpoint = + [NSURL URLWithString:kGoogleDeviceAuthorizationEndpoint]; + + GTMTVServiceConfiguration *configuration = + [[GTMTVServiceConfiguration alloc] initWithAuthorizationEndpoint:authorizationEndpoint + TVAuthorizationEndpoint:TVAuthorizationEndpoint + tokenEndpoint:tokenEndpoint]; + return configuration; +} +#endif // !GTM_APPAUTH_SKIP_GOOGLE_SUPPORT + ++ (GTMTVAuthorizationCancelBlock)authorizeTVRequest:(GTMTVAuthorizationRequest *)request + initializaiton:(GTMTVAuthorizationInitialization)initialization + completion:(GTMTVAuthorizationCompletion)completion { + // Block level variable that can be used to cancel the polling. + __block BOOL pollRunning = YES; + + // Block that will be returned allowign the caller to cancel the polling. + GTMTVAuthorizationCancelBlock cancelBlock = ^{ + if (pollRunning) { + dispatch_async(dispatch_get_main_queue(), ^{ + NSError *cancelError = + [OIDErrorUtilities errorWithCode:OIDErrorCodeProgramCanceledAuthorizationFlow + underlyingError:nil + description:@"Authorization cancelled"]; + completion(nil, cancelError); + }); + } + pollRunning = NO; + }; + + // Performs the initial authorization reqeust. + NSURLRequest *URLRequest = [request URLRequest]; + NSURLSession *session = [NSURLSession sharedSession]; + [[session dataTaskWithRequest:URLRequest + completionHandler:^(NSData *_Nullable data, + NSURLResponse *_Nullable response, + NSError *_Nullable error) { + if (error) { + // A network error or server error occurred. + NSError *returnedError = + [OIDErrorUtilities errorWithCode:OIDErrorCodeNetworkError + underlyingError:error + description:nil]; + dispatch_async(dispatch_get_main_queue(), ^{ + initialization(nil, returnedError); + }); + return; + } + + NSHTTPURLResponse *HTTPURLResponse = (NSHTTPURLResponse *)response; + + if (HTTPURLResponse.statusCode != 200) { + // A server error occurred. + NSError *serverError = + [OIDErrorUtilities HTTPErrorWithHTTPResponse:HTTPURLResponse data:data]; + + // HTTP 400 may indicate an RFC6749 Section 5.2 error response, checks for that + if (HTTPURLResponse.statusCode == 400) { + NSError *jsonDeserializationError; + NSDictionary *> *json = + [NSJSONSerialization JSONObjectWithData:(NSData *)data + options:0 + error:&jsonDeserializationError]; + + // if the HTTP 400 response parses as JSON and has an 'error' key, it's an OAuth error + // these errors are special as they indicate a problem with the authorization grant + if (json[OIDOAuthErrorFieldError]) { + NSError *oauthError = + [OIDErrorUtilities OAuthErrorWithDomain:OIDOAuthTokenErrorDomain + OAuthResponse:json + underlyingError:serverError]; + dispatch_async(dispatch_get_main_queue(), ^{ + initialization(nil, oauthError); + }); + return; + } + } + + // not an OAuth error, just a generic server error + NSError *returnedError = + [OIDErrorUtilities errorWithCode:OIDErrorCodeServerError + underlyingError:serverError + description:nil]; + dispatch_async(dispatch_get_main_queue(), ^{ + initialization(nil, returnedError); + }); + return; + } + + NSError *jsonDeserializationError; + NSDictionary *> *json = + [NSJSONSerialization JSONObjectWithData:(NSData *)data + options:0 + error:&jsonDeserializationError]; + if (jsonDeserializationError) { + // A problem occurred deserializing the response/JSON. + NSError *returnedError = + [OIDErrorUtilities errorWithCode:OIDErrorCodeJSONDeserializationError + underlyingError:jsonDeserializationError + description:nil]; + dispatch_async(dispatch_get_main_queue(), ^{ + initialization(nil, returnedError); + }); + return; + } + + // Parses the authorization response. + GTMTVAuthorizationResponse *TVAuthorizationResponse = + [[GTMTVAuthorizationResponse alloc] initWithRequest:request parameters:json]; + if (!TVAuthorizationResponse) { + // A problem occurred constructing the token response from the JSON. + NSError *returnedError = + [OIDErrorUtilities errorWithCode:OIDErrorCodeTokenResponseConstructionError + underlyingError:jsonDeserializationError + description:nil]; + dispatch_async(dispatch_get_main_queue(), ^{ + initialization(nil, returnedError); + }); + return; + } + + // Calls the initialization block to signal that we received a TV authorization response. + dispatch_async(dispatch_get_main_queue(), ^() { + initialization(TVAuthorizationResponse, nil); + }); + + // Creates the token request that will be used to poll the token endpoint. + OIDTokenRequest *pollRequest = [TVAuthorizationResponse tokenPollRequest]; + + // Starting polling interval (may be increased if a slow down message is received). + __block NSTimeInterval interval = [TVAuthorizationResponse.interval doubleValue]; + + // Polls the token endpoint until the authorization completes or expires. + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + do { + // Sleeps for polling interval. + [NSThread sleepForTimeInterval:interval]; + + if (!pollRunning) { + break; + } + + // Polls token endpoint. + [OIDAuthorizationService performTokenRequest:pollRequest + callback:^(OIDTokenResponse *_Nullable tokenResponse, + NSError *_Nullable tokenError) { + if (!pollRunning) { + return; + } + dispatch_async(dispatch_get_main_queue(), ^() { + if (tokenResponse) { + // Success response. + pollRunning = NO; + dispatch_async(dispatch_get_main_queue(), ^{ + OIDAuthState *authState = + [[OIDAuthState alloc] initWithAuthorizationResponse:TVAuthorizationResponse + tokenResponse:tokenResponse]; + GTMAppAuthFetcherAuthorization *authorization = + [[GTMAppAuthFetcherAuthorization alloc] initWithAuthState:authState]; + completion(authorization, nil); + }); + } else { + if (tokenError.domain == OIDOAuthTokenErrorDomain) { + // OAuth token errors inspected for device flow specific errors. + NSString *errorCode = + tokenError.userInfo[OIDOAuthErrorResponseErrorKey][OIDOAuthErrorFieldError]; + if ([errorCode isEqual:kErrorCodeAuthorizationPending]) { + // authorization_pending is an expected response. + return; + } else if ([errorCode isEqual:kErrorCodeSlowDown]) { + // Increase interval by 20%, enforce a lower bound of 5s. + interval *= 1.20; + interval = MAX(5.0, interval); + } else { + // Unhandled token error, considered fatal. + pollRunning = NO; + dispatch_async(dispatch_get_main_queue(), ^{ + completion(nil, tokenError); + }); + } + } else { + // All other errors considered fatal. + pollRunning = NO; + dispatch_async(dispatch_get_main_queue(), ^{ + completion(nil, tokenError); + }); + } + } + }); + }]; + } while ([TVAuthorizationResponse.expirationDate timeIntervalSinceNow] > 0 && pollRunning); + }); + }] resume]; + + return cancelBlock; +} + +@end diff --git a/Source/AppAuthTV/GTMTVServiceConfiguration.h b/Source/AppAuthTV/GTMTVServiceConfiguration.h new file mode 100644 index 000000000..70e748241 --- /dev/null +++ b/Source/AppAuthTV/GTMTVServiceConfiguration.h @@ -0,0 +1,65 @@ +/*! @file GTMTVServiceConfiguration.h + @brief GTMAppAuth SDK + @copyright + Copyright 2016 Google Inc. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#ifndef GTMAPPAUTH_USER_IMPORTS +#import +#else // GTMAPPAUTH_USER_IMPORTS +#import "AppAuthCore.h" +#endif // GTMAPPAUTH_USER_IMPORTS + +NS_ASSUME_NONNULL_BEGIN + +/*! @brief Configuration for authorizing the user with the @c GTMTVAuthorizationService. + */ +@interface GTMTVServiceConfiguration : OIDServiceConfiguration + +/*! @brief The TV authorization endpoint URI. + */ +@property(nonatomic, readonly) NSURL *TVAuthorizationEndpoint; + +/*! @internal + @brief Unavailable. Please use + @c initWithAuthorizationEndpoint:TVAuthorizationEndpoint:tokenEndpoint: + */ +- (instancetype)init NS_UNAVAILABLE; + +/*! @internal + @brief Unavailable. Please use + @c initWithAuthorizationEndpoint:TVAuthorizationEndpoint:tokenEndpoint: + */ +- (instancetype)initWithAuthorizationEndpoint:(NSURL *)authorizationEndpoint + tokenEndpoint:(NSURL *)tokenEndpoint NS_UNAVAILABLE; + +/*! @internal + @brief Unavailable. Please use + @c initWithAuthorizationEndpoint:TVAuthorizationEndpoint:tokenEndpoint: + */ +- (instancetype)initWithDiscoveryDocument:(OIDServiceDiscovery *)discoveryDocument NS_UNAVAILABLE; + +/*! @brief Designated initializer. + @param authorizationEndpoint The authorization endpoint URI. + @param TVAuthorizationEndpoint The TV authorization endpoint URI. + @param tokenEndpoint The token exchange and refresh endpoint URI. + */ +- (instancetype)initWithAuthorizationEndpoint:(NSURL *)authorizationEndpoint + TVAuthorizationEndpoint:(NSURL *)TVAuthorizationEndpoint + tokenEndpoint:(NSURL *)tokenEndpoint NS_DESIGNATED_INITIALIZER; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Source/AppAuthTV/GTMTVServiceConfiguration.m b/Source/AppAuthTV/GTMTVServiceConfiguration.m new file mode 100644 index 000000000..8d7fabdf4 --- /dev/null +++ b/Source/AppAuthTV/GTMTVServiceConfiguration.m @@ -0,0 +1,100 @@ +/*! @file GTMTVServiceConfiguration.m + @brief GTMAppAuth SDK + @copyright + Copyright 2016 Google Inc. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "GTMTVServiceConfiguration.h" + +#ifndef GTMAPPAUTH_USER_IMPORTS +#import +#import +#else // GTMAPPAUTH_USER_IMPORTS +#import "AppAuthCore.h" +#import "OIDDefines.h" +#endif // GTMAPPAUTH_USER_IMPORTS + +/*! @brief The key for the @c TVAuthorizationEndpoint property. + */ +static NSString *const kTVAuthorizationEndpointKey = @"TVAuthorizationEndpoint"; + +NS_ASSUME_NONNULL_BEGIN + +@interface GTMTVServiceConfiguration () + +/*! @brief Designated initializer. + @param aDecoder NSCoder to unserialize the object from. + */ +- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER; + +@end + +@implementation GTMTVServiceConfiguration + +@synthesize TVAuthorizationEndpoint = _TVAuthorizationEndpoint; + +- (instancetype)init + OID_UNAVAILABLE_USE_INITIALIZER( + @selector(initWithAuthorizationEndpoint:TVAuthorizationEndpoint:tokenEndpoint:)); + +- (instancetype)initWithAuthorizationEndpoint:(NSURL *)authorizationEndpoint + tokenEndpoint:(NSURL *)tokenEndpoint + OID_UNAVAILABLE_USE_INITIALIZER( + @selector(initWithAuthorizationEndpoint:TVAuthorizationEndpoint:tokenEndpoint:)); + +- (instancetype)initWithAuthorizationEndpoint:(NSURL *)authorizationEndpoint + TVAuthorizationEndpoint:(NSURL *)TVAuthorizationEndpoint + tokenEndpoint:(NSURL *)tokenEndpoint { + self = [super initWithAuthorizationEndpoint:authorizationEndpoint tokenEndpoint:tokenEndpoint]; + if (self) { + _TVAuthorizationEndpoint = [TVAuthorizationEndpoint copy]; + } + return self; +} + +#pragma mark - NSSecureCoding + ++ (BOOL)supportsSecureCoding { + return YES; +} + +- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder { + self = [super initWithCoder:aDecoder]; + if (self) { + NSURL *TVAuthorizationEndpoint = [aDecoder decodeObjectOfClass:[NSURL class] + forKey:kTVAuthorizationEndpointKey]; + _TVAuthorizationEndpoint = TVAuthorizationEndpoint; + } + return self; +} + +- (void)encodeWithCoder:(NSCoder *)aCoder { + [super encodeWithCoder:aCoder]; + [aCoder encodeObject:_TVAuthorizationEndpoint forKey:kTVAuthorizationEndpointKey]; +} + +#pragma mark - description + +- (NSString *)description { + return [NSString stringWithFormat:@"<%@: %p, TVAuthorizationEndpoint: %@ tokenEndpoint: %@>", + NSStringFromClass([self class]), + self, + _TVAuthorizationEndpoint, + self.tokenEndpoint]; +} + +@end + +NS_ASSUME_NONNULL_END From da0be7a354d13c7330aa28d7dafd00dd79a8ccee Mon Sep 17 00:00:00 2001 From: William Denniss Date: Tue, 2 Jun 2020 16:10:03 -0700 Subject: [PATCH 07/81] Modify TV authorization logic for AppAuth - Add beginnings of 'AppAuthTV' Pod subspec - Remove dependency on `GTMAppAuthFetcherAuthorization` - Remove GTMAPPAUTH_USER_IMPORTS code - Verified with `pod lib lint` --- AppAuth.podspec | 8 ++++++- Source/AppAuthTV/AppAuthTV.h | 22 +++++++++++++++++++ Source/AppAuthTV/GTMTVAuthorizationRequest.h | 4 ---- Source/AppAuthTV/GTMTVAuthorizationRequest.m | 5 ----- Source/AppAuthTV/GTMTVAuthorizationResponse.h | 4 ---- Source/AppAuthTV/GTMTVAuthorizationResponse.m | 6 ----- Source/AppAuthTV/GTMTVAuthorizationService.h | 6 ++--- Source/AppAuthTV/GTMTVAuthorizationService.m | 13 ++--------- Source/AppAuthTV/GTMTVServiceConfiguration.h | 4 ---- Source/AppAuthTV/GTMTVServiceConfiguration.m | 5 ----- 10 files changed, 34 insertions(+), 43 deletions(-) create mode 100644 Source/AppAuthTV/AppAuthTV.h diff --git a/AppAuth.podspec b/AppAuth.podspec index b34dbe3f1..c34fc79f3 100644 --- a/AppAuth.podspec +++ b/AppAuth.podspec @@ -67,6 +67,12 @@ It follows the OAuth 2.0 for Native Apps best current practice enterpriseUserAgent.ios.source_files = "Source/AppAuthEnterpriseUserAgent.h", "Source/AppAuthEnterpriseUserAgent/iOS/**/*.{h,m}" enterpriseUserAgent.ios.deployment_target = "7.0" end - + + # Subspec for the full AppAuth library, including platform-dependant external user agents. + s.subspec 'TV' do |tv| + tv.source_files = "Source/AppAuthTV/*.{h,m}" + tv.dependency 'AppAuth/Core' + end + s.default_subspecs = 'Core', 'ExternalUserAgent' end diff --git a/Source/AppAuthTV/AppAuthTV.h b/Source/AppAuthTV/AppAuthTV.h new file mode 100644 index 000000000..32a6d8581 --- /dev/null +++ b/Source/AppAuthTV/AppAuthTV.h @@ -0,0 +1,22 @@ +/*! @file AppAuthTV.h + @brief GTMAppAuth SDK + @copyright + Copyright 2016 Google Inc. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "GTMTVAuthorizationRequest.h" +#import "GTMTVAuthorizationResponse.h" +#import "GTMTVAuthorizationService.h" +#import "GTMTVServiceConfiguration.h" \ No newline at end of file diff --git a/Source/AppAuthTV/GTMTVAuthorizationRequest.h b/Source/AppAuthTV/GTMTVAuthorizationRequest.h index 84334f0a2..032c05488 100644 --- a/Source/AppAuthTV/GTMTVAuthorizationRequest.h +++ b/Source/AppAuthTV/GTMTVAuthorizationRequest.h @@ -18,11 +18,7 @@ #import -#ifndef GTMAPPAUTH_USER_IMPORTS -#import -#else // GTMAPPAUTH_USER_IMPORTS #import "AppAuthCore.h" -#endif // GTMAPPAUTH_USER_IMPORTS @class GTMTVServiceConfiguration; diff --git a/Source/AppAuthTV/GTMTVAuthorizationRequest.m b/Source/AppAuthTV/GTMTVAuthorizationRequest.m index 7b1e69791..f47d80aac 100644 --- a/Source/AppAuthTV/GTMTVAuthorizationRequest.m +++ b/Source/AppAuthTV/GTMTVAuthorizationRequest.m @@ -18,13 +18,8 @@ #import "GTMTVAuthorizationRequest.h" -#ifndef GTMAPPAUTH_USER_IMPORTS -#import -#import -#else // GTMAPPAUTH_USER_IMPORTS #import "AppAuthCore.h" #import "OIDURLQueryComponent.h" -#endif // GTMAPPAUTH_USER_IMPORTS #import "GTMTVServiceConfiguration.h" @implementation GTMTVAuthorizationRequest diff --git a/Source/AppAuthTV/GTMTVAuthorizationResponse.h b/Source/AppAuthTV/GTMTVAuthorizationResponse.h index d5987f2a0..ce1365f4f 100644 --- a/Source/AppAuthTV/GTMTVAuthorizationResponse.h +++ b/Source/AppAuthTV/GTMTVAuthorizationResponse.h @@ -18,11 +18,7 @@ #import -#ifndef GTMAPPAUTH_USER_IMPORTS -#import -#else // GTMAPPAUTH_USER_IMPORTS #import "AppAuthCore.h" -#endif // GTMAPPAUTH_USER_IMPORTS @class GTMTVAuthorizationRequest; @class OIDTokenRequest; diff --git a/Source/AppAuthTV/GTMTVAuthorizationResponse.m b/Source/AppAuthTV/GTMTVAuthorizationResponse.m index 556d3f282..bee285fc4 100644 --- a/Source/AppAuthTV/GTMTVAuthorizationResponse.m +++ b/Source/AppAuthTV/GTMTVAuthorizationResponse.m @@ -19,15 +19,9 @@ #import "GTMTVAuthorizationResponse.h" #import "GTMTVAuthorizationRequest.h" -#ifndef GTMAPPAUTH_USER_IMPORTS -#import -#import -#import -#else // GTMAPPAUTH_USER_IMPORTS #import "AppAuthCore.h" #import "OIDDefines.h" #import "OIDFieldMapping.h" -#endif // GTMAPPAUTH_USER_IMPORTS NSString *const GTMTVDeviceTokenGrantType = @"http://oauth.net/grant_type/device/1.0"; diff --git a/Source/AppAuthTV/GTMTVAuthorizationService.h b/Source/AppAuthTV/GTMTVAuthorizationService.h index 620372a12..a37d4aa4e 100644 --- a/Source/AppAuthTV/GTMTVAuthorizationService.h +++ b/Source/AppAuthTV/GTMTVAuthorizationService.h @@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN -@class GTMAppAuthFetcherAuthorization; +@class OIDAuthState; @class GTMTVAuthorizationRequest; @class GTMTVAuthorizationResponse; @class GTMTVServiceConfiguration; @@ -35,12 +35,12 @@ typedef void (^GTMTVAuthorizationInitialization)(GTMTVAuthorizationResponse *_Nu NSError *_Nullable error); /*! @brief The block that is called when the TV authorization has completed. - @param authorization The @c GTMAppAuthFetcherAuthorization which you can use to authorize + @param authorization The @c OIDAuthState which you can use to authorize API calls, or nil if there was an error. @param error The error if an error occurred. */ typedef void (^GTMTVAuthorizationCompletion) - (GTMAppAuthFetcherAuthorization *_Nullable authorization, + (OIDAuthState *_Nullable authorization, NSError *_Nullable error); /*! @brief Block returned when authorization is initialized to that will cancel the pending diff --git a/Source/AppAuthTV/GTMTVAuthorizationService.m b/Source/AppAuthTV/GTMTVAuthorizationService.m index 64957f578..5160d0305 100644 --- a/Source/AppAuthTV/GTMTVAuthorizationService.m +++ b/Source/AppAuthTV/GTMTVAuthorizationService.m @@ -1,4 +1,4 @@ -/*! @file GTMAppAuthFetcherAuthorization.m +/*! @file GTMTVAuthorizationService.m @brief GTMAppAuth SDK @copyright Copyright 2016 Google Inc. @@ -18,17 +18,10 @@ #import "GTMTVAuthorizationService.h" -#ifndef GTMAPPAUTH_USER_IMPORTS -#import -#import -#import -#else // GTMAPPAUTH_USER_IMPORTS #import "AppAuthCore.h" #import "OIDDefines.h" #import "OIDURLQueryComponent.h" -#endif // GTMAPPAUTH_USER_IMPORTS -#import "GTMAppAuthFetcherAuthorization.h" #import "GTMTVAuthorizationRequest.h" #import "GTMTVAuthorizationResponse.h" #import "GTMTVServiceConfiguration.h" @@ -216,9 +209,7 @@ + (GTMTVAuthorizationCancelBlock)authorizeTVRequest:(GTMTVAuthorizationRequest * OIDAuthState *authState = [[OIDAuthState alloc] initWithAuthorizationResponse:TVAuthorizationResponse tokenResponse:tokenResponse]; - GTMAppAuthFetcherAuthorization *authorization = - [[GTMAppAuthFetcherAuthorization alloc] initWithAuthState:authState]; - completion(authorization, nil); + completion(authState, nil); }); } else { if (tokenError.domain == OIDOAuthTokenErrorDomain) { diff --git a/Source/AppAuthTV/GTMTVServiceConfiguration.h b/Source/AppAuthTV/GTMTVServiceConfiguration.h index 70e748241..7fb6babfd 100644 --- a/Source/AppAuthTV/GTMTVServiceConfiguration.h +++ b/Source/AppAuthTV/GTMTVServiceConfiguration.h @@ -16,11 +16,7 @@ limitations under the License. */ -#ifndef GTMAPPAUTH_USER_IMPORTS -#import -#else // GTMAPPAUTH_USER_IMPORTS #import "AppAuthCore.h" -#endif // GTMAPPAUTH_USER_IMPORTS NS_ASSUME_NONNULL_BEGIN diff --git a/Source/AppAuthTV/GTMTVServiceConfiguration.m b/Source/AppAuthTV/GTMTVServiceConfiguration.m index 8d7fabdf4..e6493292c 100644 --- a/Source/AppAuthTV/GTMTVServiceConfiguration.m +++ b/Source/AppAuthTV/GTMTVServiceConfiguration.m @@ -18,13 +18,8 @@ #import "GTMTVServiceConfiguration.h" -#ifndef GTMAPPAUTH_USER_IMPORTS -#import -#import -#else // GTMAPPAUTH_USER_IMPORTS #import "AppAuthCore.h" #import "OIDDefines.h" -#endif // GTMAPPAUTH_USER_IMPORTS /*! @brief The key for the @c TVAuthorizationEndpoint property. */ From 72d874bb3059e20960b6aca39727285620e6f76f Mon Sep 17 00:00:00 2001 From: Souleiman Benhida Date: Wed, 15 Jul 2020 19:48:41 -0400 Subject: [PATCH 08/81] Rename GTM to OID, remove extra headers * Rename OID to GTM, remove extra header * Remove TVConfigurationForGoogle, update copyright headers * Return OIDAuthState instead of GTMAppAuthFetcherAuthorization * Add AppAuthTV to Xcode targets, fix NSObject description method bug * Add files to AppAuthTV target * Remove property synthesize * Add AppAuthTVTests target, pointing to UnitTests/UnitTestsInfo.plist and included in AppAuthTV scheme. Reorder imports * Update min tvOS version and identifier for AppAuthTV target * Correct capitalization in AppAuthTV identifier * Update reference URLs, references to Google removed * Remove non-functioning AppAuthTVTests target (tests coming in future PR) * Fix indent spacing in OIDTVServiceConfiguration --- AppAuth.xcodeproj/project.pbxproj | 294 ++++++++++++++++++ .../xcshareddata/xcschemes/AppAuthTV.xcscheme | 81 +++++ Package.swift | 11 +- Source/{AppAuthTV => }/AppAuthTV.h | 12 +- Source/AppAuthTV/GTMAppAuth.h | 21 -- ...nRequest.h => OIDTVAuthorizationRequest.h} | 14 +- ...nRequest.m => OIDTVAuthorizationRequest.m} | 27 +- ...esponse.h => OIDTVAuthorizationResponse.h} | 22 +- ...esponse.m => OIDTVAuthorizationResponse.m} | 26 +- ...nService.h => OIDTVAuthorizationService.h} | 39 +-- ...nService.m => OIDTVAuthorizationService.m} | 56 ++-- ...guration.h => OIDTVServiceConfiguration.h} | 10 +- ...guration.m => OIDTVServiceConfiguration.m} | 21 +- Source/TVFramework/AppAuthTV.h | 57 ++++ Source/TVFramework/Info.plist | 22 ++ 15 files changed, 558 insertions(+), 155 deletions(-) create mode 100644 AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuthTV.xcscheme rename Source/{AppAuthTV => }/AppAuthTV.h (75%) delete mode 100644 Source/AppAuthTV/GTMAppAuth.h rename Source/AppAuthTV/{GTMTVAuthorizationRequest.h => OIDTVAuthorizationRequest.h} (84%) rename Source/AppAuthTV/{GTMTVAuthorizationRequest.m => OIDTVAuthorizationRequest.m} (86%) rename Source/AppAuthTV/{GTMTVAuthorizationResponse.h => OIDTVAuthorizationResponse.h} (83%) rename Source/AppAuthTV/{GTMTVAuthorizationResponse.m => OIDTVAuthorizationResponse.m} (89%) rename Source/AppAuthTV/{GTMTVAuthorizationService.h => OIDTVAuthorizationService.h} (69%) rename Source/AppAuthTV/{GTMTVAuthorizationService.m => OIDTVAuthorizationService.m} (82%) rename Source/AppAuthTV/{GTMTVServiceConfiguration.h => OIDTVServiceConfiguration.h} (88%) rename Source/AppAuthTV/{GTMTVServiceConfiguration.m => OIDTVServiceConfiguration.m} (86%) create mode 100644 Source/TVFramework/AppAuthTV.h create mode 100644 Source/TVFramework/Info.plist diff --git a/AppAuth.xcodeproj/project.pbxproj b/AppAuth.xcodeproj/project.pbxproj index 058bb712b..11b222444 100644 --- a/AppAuth.xcodeproj/project.pbxproj +++ b/AppAuth.xcodeproj/project.pbxproj @@ -14,6 +14,10 @@ 06C19E9C22B474A600C19CE1 /* OIDEndSessionRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = CF37C06B1F1FC21A00662E41 /* OIDEndSessionRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; 06C19E9D22B474AD00C19CE1 /* OIDEndSessionRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = CF37C06C1F1FC21A00662E41 /* OIDEndSessionRequest.m */; }; 2D0BB86C249D5BAF005BA653 /* AppAuthEnterpriseUserAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D0BB86B249D5BAF005BA653 /* AppAuthEnterpriseUserAgent.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D47AAE1249A87020059B5A4 /* OIDTVAuthorizationResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D47AAD8249A87010059B5A4 /* OIDTVAuthorizationResponse.m */; }; + 2D47AAE4249A87020059B5A4 /* OIDTVServiceConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D47AADA249A87010059B5A4 /* OIDTVServiceConfiguration.m */; }; + 2D47AAE8249A87020059B5A4 /* OIDTVAuthorizationRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D47AADD249A87010059B5A4 /* OIDTVAuthorizationRequest.m */; }; + 2D47AAEC249A87020059B5A4 /* OIDTVAuthorizationService.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D47AAE0249A87020059B5A4 /* OIDTVAuthorizationService.m */; }; 2D91B81F249053190005B197 /* OIDExternalUserAgentIOS.m in Sources */ = {isa = PBXBuildFile; fileRef = A6DEABA82018E5B50022AC32 /* OIDExternalUserAgentIOS.m */; }; 2D91B820249053190005B197 /* OIDExternalUserAgentCatalyst.m in Sources */ = {isa = PBXBuildFile; fileRef = F9A7082D2355ED74004B3E6D /* OIDExternalUserAgentCatalyst.m */; }; 2D91B821249053190005B197 /* OIDFieldMapping.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741C41C5D8243000EF209 /* OIDFieldMapping.m */; }; @@ -74,6 +78,65 @@ 2D91B85B249053190005B197 /* OIDTokenUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741D51C5D8243000EF209 /* OIDTokenUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; }; 2D91B85C249053190005B197 /* OIDError.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741BF1C5D8243000EF209 /* OIDError.h */; settings = {ATTRIBUTES = (Public, ); }; }; 2D91B85D249053190005B197 /* OIDExternalUserAgentIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = A6DEABA92018E5B50022AC32 /* OIDExternalUserAgentIOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D9385DE24B3861E009A12D7 /* AppAuthTV.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D9385B924B37CAD009A12D7 /* AppAuthTV.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D9385DF24B38646009A12D7 /* OIDTVAuthorizationRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D47AAD9249A87010059B5A4 /* OIDTVAuthorizationRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D9385E024B38658009A12D7 /* OIDTVAuthorizationResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D47AADC249A87010059B5A4 /* OIDTVAuthorizationResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D9385E124B3865E009A12D7 /* OIDTVAuthorizationService.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D47AADF249A87020059B5A4 /* OIDTVAuthorizationService.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D9385E224B38669009A12D7 /* OIDTVServiceConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D47AADE249A87020059B5A4 /* OIDTVServiceConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93861924B38803009A12D7 /* OIDAuthorizationRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741B51C5D8243000EF209 /* OIDAuthorizationRequest.m */; }; + 2D93861A24B3880B009A12D7 /* OIDAuthorizationRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741B41C5D8243000EF209 /* OIDAuthorizationRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93861B24B38810009A12D7 /* OIDAuthorizationResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741B61C5D8243000EF209 /* OIDAuthorizationResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93861C24B38812009A12D7 /* OIDAuthorizationResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741B71C5D8243000EF209 /* OIDAuthorizationResponse.m */; }; + 2D93861D24B38815009A12D7 /* OIDAuthorizationService.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741B81C5D8243000EF209 /* OIDAuthorizationService.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93861E24B3881B009A12D7 /* OIDAuthorizationService.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741B91C5D8243000EF209 /* OIDAuthorizationService.m */; }; + 2D93861F24B3881B009A12D7 /* OIDAuthState.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741BA1C5D8243000EF209 /* OIDAuthState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93862024B3881B009A12D7 /* OIDAuthState.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741BB1C5D8243000EF209 /* OIDAuthState.m */; }; + 2D93862124B3881B009A12D7 /* OIDAuthStateChangeDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741BC1C5D8243000EF209 /* OIDAuthStateChangeDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93862224B3881C009A12D7 /* OIDAuthStateErrorDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741BD1C5D8243000EF209 /* OIDAuthStateErrorDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93862424B3881C009A12D7 /* OIDClientMetadataParameters.m in Sources */ = {isa = PBXBuildFile; fileRef = 60140F791DE4276800DA0DC3 /* OIDClientMetadataParameters.m */; }; + 2D93862624B3881C009A12D7 /* OIDError.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741BF1C5D8243000EF209 /* OIDError.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93862724B3881C009A12D7 /* OIDError.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741C01C5D8243000EF209 /* OIDError.m */; }; + 2D93862824B3881C009A12D7 /* OIDErrorUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741C11C5D8243000EF209 /* OIDErrorUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93862924B3881C009A12D7 /* OIDErrorUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741C21C5D8243000EF209 /* OIDErrorUtilities.m */; }; + 2D93862A24B3881C009A12D7 /* OIDExternalUserAgentSession.h in Headers */ = {isa = PBXBuildFile; fileRef = A6DEAB992018E4A20022AC32 /* OIDExternalUserAgentSession.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93862B24B38825009A12D7 /* OIDExternalUserAgentRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = A6DEAB9A2018E4A20022AC32 /* OIDExternalUserAgentRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93862C24B38826009A12D7 /* OIDExternalUserAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = A6DEAB982018E4A20022AC32 /* OIDExternalUserAgent.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93862E24B38826009A12D7 /* OIDFieldMapping.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741C41C5D8243000EF209 /* OIDFieldMapping.m */; }; + 2D93862F24B38826009A12D7 /* OIDEndSessionResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = CF6431F21F228A980075B6B5 /* OIDEndSessionResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93863024B38826009A12D7 /* OIDEndSessionResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = CF6431F31F228A980075B6B5 /* OIDEndSessionResponse.m */; }; + 2D93863124B38826009A12D7 /* OIDEndSessionRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = CF37C06B1F1FC21A00662E41 /* OIDEndSessionRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93863224B38826009A12D7 /* OIDEndSessionRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = CF37C06C1F1FC21A00662E41 /* OIDEndSessionRequest.m */; }; + 2D93863324B38826009A12D7 /* OIDRegistrationResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 60140F7E1DE4335200DA0DC3 /* OIDRegistrationResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93863424B38826009A12D7 /* OIDRegistrationResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 60140F7F1DE4344200DA0DC3 /* OIDRegistrationResponse.m */; }; + 2D93863524B38827009A12D7 /* OIDRegistrationRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 60140F7D1DE42E3000DA0DC3 /* OIDRegistrationRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93863624B38827009A12D7 /* OIDRegistrationRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 60140F7B1DE42E1000DA0DC3 /* OIDRegistrationRequest.m */; }; + 2D93863724B38827009A12D7 /* OIDGrantTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741C51C5D8243000EF209 /* OIDGrantTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93863824B38827009A12D7 /* OIDGrantTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741C61C5D8243000EF209 /* OIDGrantTypes.m */; }; + 2D93863924B38827009A12D7 /* OIDIDToken.h in Headers */ = {isa = PBXBuildFile; fileRef = 34A663261E871DD40060B664 /* OIDIDToken.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93863A24B38827009A12D7 /* OIDIDToken.m in Sources */ = {isa = PBXBuildFile; fileRef = 34A663271E871DD40060B664 /* OIDIDToken.m */; }; + 2D93863B24B38827009A12D7 /* OIDResponseTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741C71C5D8243000EF209 /* OIDResponseTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93863C24B38827009A12D7 /* OIDResponseTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741C81C5D8243000EF209 /* OIDResponseTypes.m */; }; + 2D93863D24B38827009A12D7 /* OIDScopes.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741C91C5D8243000EF209 /* OIDScopes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93863E24B38827009A12D7 /* OIDScopes.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741CA1C5D8243000EF209 /* OIDScopes.m */; }; + 2D93863F24B38828009A12D7 /* OIDScopeUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741CB1C5D8243000EF209 /* OIDScopeUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93864024B38828009A12D7 /* OIDScopeUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741CC1C5D8243000EF209 /* OIDScopeUtilities.m */; }; + 2D93864124B38828009A12D7 /* OIDServiceConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741CD1C5D8243000EF209 /* OIDServiceConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93864224B38828009A12D7 /* OIDServiceConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741CE1C5D8243000EF209 /* OIDServiceConfiguration.m */; }; + 2D93864324B38828009A12D7 /* OIDServiceDiscovery.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741CF1C5D8243000EF209 /* OIDServiceDiscovery.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93864424B38828009A12D7 /* OIDServiceDiscovery.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741D01C5D8243000EF209 /* OIDServiceDiscovery.m */; }; + 2D93864524B38828009A12D7 /* OIDTokenRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741D11C5D8243000EF209 /* OIDTokenRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93864624B38828009A12D7 /* OIDTokenRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741D21C5D8243000EF209 /* OIDTokenRequest.m */; }; + 2D93864724B38828009A12D7 /* OIDTokenResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741D31C5D8243000EF209 /* OIDTokenResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93864824B38828009A12D7 /* OIDTokenResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741D41C5D8243000EF209 /* OIDTokenResponse.m */; }; + 2D93864924B38828009A12D7 /* OIDTokenUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741D51C5D8243000EF209 /* OIDTokenUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93864A24B38829009A12D7 /* OIDTokenUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741D61C5D8243000EF209 /* OIDTokenUtilities.m */; }; + 2D93864C24B38829009A12D7 /* OIDURLQueryComponent.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741D81C5D8243000EF209 /* OIDURLQueryComponent.m */; }; + 2D93864D24B38829009A12D7 /* OIDURLSessionProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 039697441FA8258D003D1FB2 /* OIDURLSessionProvider.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D93864E24B38829009A12D7 /* OIDURLSessionProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 039697451FA8258D003D1FB2 /* OIDURLSessionProvider.m */; }; + 2D93864F24B38840009A12D7 /* OIDTVAuthorizationRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D47AADD249A87010059B5A4 /* OIDTVAuthorizationRequest.m */; }; + 2D93865024B38840009A12D7 /* OIDTVAuthorizationResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D47AAD8249A87010059B5A4 /* OIDTVAuthorizationResponse.m */; }; + 2D93865124B38840009A12D7 /* OIDTVAuthorizationService.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D47AAE0249A87020059B5A4 /* OIDTVAuthorizationService.m */; }; + 2D93865224B38840009A12D7 /* OIDTVServiceConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D47AADA249A87010059B5A4 /* OIDTVServiceConfiguration.m */; }; 340DAE571D5821A100EC285B /* OIDAuthorizationService+Mac.m in Sources */ = {isa = PBXBuildFile; fileRef = 340DAE261D581FE700EC285B /* OIDAuthorizationService+Mac.m */; }; 340DAE581D5821A100EC285B /* OIDExternalUserAgentMac.m in Sources */ = {isa = PBXBuildFile; fileRef = 340DAE281D581FE700EC285B /* OIDExternalUserAgentMac.m */; }; 340DAE591D5821A100EC285B /* OIDAuthState+Mac.m in Sources */ = {isa = PBXBuildFile; fileRef = 340DAE2A1D581FE700EC285B /* OIDAuthState+Mac.m */; }; @@ -665,8 +728,20 @@ 0396974C1FA827AD003D1FB2 /* OIDURLSessionProviderTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OIDURLSessionProviderTests.m; sourceTree = ""; }; 2D0BB86A249D5B75005BA653 /* AppAuthEnterpriseUserAgent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppAuthEnterpriseUserAgent.h; sourceTree = ""; }; 2D0BB86B249D5BAF005BA653 /* AppAuthEnterpriseUserAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppAuthEnterpriseUserAgent.h; sourceTree = ""; }; + 2D47AAD8249A87010059B5A4 /* OIDTVAuthorizationResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OIDTVAuthorizationResponse.m; sourceTree = ""; }; + 2D47AAD9249A87010059B5A4 /* OIDTVAuthorizationRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDTVAuthorizationRequest.h; sourceTree = ""; }; + 2D47AADA249A87010059B5A4 /* OIDTVServiceConfiguration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OIDTVServiceConfiguration.m; sourceTree = ""; }; + 2D47AADB249A87010059B5A4 /* AppAuthTV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppAuthTV.h; sourceTree = ""; }; + 2D47AADC249A87010059B5A4 /* OIDTVAuthorizationResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDTVAuthorizationResponse.h; sourceTree = ""; }; + 2D47AADD249A87010059B5A4 /* OIDTVAuthorizationRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OIDTVAuthorizationRequest.m; sourceTree = ""; }; + 2D47AADE249A87020059B5A4 /* OIDTVServiceConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDTVServiceConfiguration.h; sourceTree = ""; }; + 2D47AADF249A87020059B5A4 /* OIDTVAuthorizationService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDTVAuthorizationService.h; sourceTree = ""; }; + 2D47AAE0249A87020059B5A4 /* OIDTVAuthorizationService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OIDTVAuthorizationService.m; sourceTree = ""; }; 2D91B862249053190005B197 /* AppAuthEnterpriseUserAgent.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AppAuthEnterpriseUserAgent.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 2D91B868249177180005B197 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 2D9385B724B37CAD009A12D7 /* AppAuthTV.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AppAuthTV.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 2D9385B924B37CAD009A12D7 /* AppAuthTV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppAuthTV.h; sourceTree = ""; }; + 2D9385BA24B37CAD009A12D7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 340DAE251D581FE700EC285B /* OIDAuthorizationService+Mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "OIDAuthorizationService+Mac.h"; sourceTree = ""; }; 340DAE261D581FE700EC285B /* OIDAuthorizationService+Mac.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "OIDAuthorizationService+Mac.m"; sourceTree = ""; }; 340DAE271D581FE700EC285B /* OIDExternalUserAgentMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDExternalUserAgentMac.h; sourceTree = ""; }; @@ -806,6 +881,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 2D9385B424B37CAD009A12D7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 340DAE4B1D58216A00EC285B /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -948,6 +1030,21 @@ path = iOS; sourceTree = ""; }; + 2D47AAD7249A86E30059B5A4 /* AppAuthTV */ = { + isa = PBXGroup; + children = ( + 2D47AAD9249A87010059B5A4 /* OIDTVAuthorizationRequest.h */, + 2D47AADD249A87010059B5A4 /* OIDTVAuthorizationRequest.m */, + 2D47AADC249A87010059B5A4 /* OIDTVAuthorizationResponse.h */, + 2D47AAD8249A87010059B5A4 /* OIDTVAuthorizationResponse.m */, + 2D47AADF249A87020059B5A4 /* OIDTVAuthorizationService.h */, + 2D47AAE0249A87020059B5A4 /* OIDTVAuthorizationService.m */, + 2D47AADE249A87020059B5A4 /* OIDTVServiceConfiguration.h */, + 2D47AADA249A87010059B5A4 /* OIDTVServiceConfiguration.m */, + ); + path = AppAuthTV; + sourceTree = ""; + }; 2D91B867249177180005B197 /* EnterpriseUserAgentFramework */ = { isa = PBXGroup; children = ( @@ -957,6 +1054,15 @@ path = EnterpriseUserAgentFramework; sourceTree = ""; }; + 2D9385B824B37CAD009A12D7 /* TVFramework */ = { + isa = PBXGroup; + children = ( + 2D9385B924B37CAD009A12D7 /* AppAuthTV.h */, + 2D9385BA24B37CAD009A12D7 /* Info.plist */, + ); + path = TVFramework; + sourceTree = ""; + }; 340DAE241D581FE700EC285B /* macOS */ = { isa = PBXGroup; children = ( @@ -1004,6 +1110,7 @@ 343AAACA1E8348AA00F9D36E /* AppAuth_macOSTests.xctest */, 342F42C32177B1FC00574F24 /* AppAuthCore.framework */, 348970972177B3B000ABEED4 /* AppAuthCoreTests.xctest */, + 2D9385B724B37CAD009A12D7 /* AppAuthTV.framework */, 2D91B862249053190005B197 /* AppAuthEnterpriseUserAgent.framework */, ); name = Products; @@ -1016,10 +1123,13 @@ 2D91B867249177180005B197 /* EnterpriseUserAgentFramework */, 348970992178F40600ABEED4 /* CoreFramework */, 343AAA4C1E8345B600F9D36E /* Framework */, + 2D9385B824B37CAD009A12D7 /* TVFramework */, 8A9B9D5E24561EC40055353E /* AppAuthCore */, 8A9B9D632456227D0055353E /* AppAuth */, + 2D47AAD7249A86E30059B5A4 /* AppAuthTV */, 341741AF1C5D8243000EF209 /* AppAuth.h */, 3489709E21791B0C00ABEED4 /* AppAuthCore.h */, + 2D47AADB249A87010059B5A4 /* AppAuthTV.h */, 2D0BB86A249D5B75005BA653 /* AppAuthEnterpriseUserAgent.h */, ); path = Source; @@ -1229,6 +1339,44 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 2D9385B224B37CAD009A12D7 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 2D93861B24B38810009A12D7 /* OIDAuthorizationResponse.h in Headers */, + 2D93861F24B3881B009A12D7 /* OIDAuthState.h in Headers */, + 2D93863724B38827009A12D7 /* OIDGrantTypes.h in Headers */, + 2D93862F24B38826009A12D7 /* OIDEndSessionResponse.h in Headers */, + 2D93863924B38827009A12D7 /* OIDIDToken.h in Headers */, + 2D93862824B3881C009A12D7 /* OIDErrorUtilities.h in Headers */, + 2D93863124B38826009A12D7 /* OIDEndSessionRequest.h in Headers */, + 2D93863D24B38827009A12D7 /* OIDScopes.h in Headers */, + 2D93864124B38828009A12D7 /* OIDServiceConfiguration.h in Headers */, + 2D93862124B3881B009A12D7 /* OIDAuthStateChangeDelegate.h in Headers */, + 2D93862A24B3881C009A12D7 /* OIDExternalUserAgentSession.h in Headers */, + 2D93863324B38826009A12D7 /* OIDRegistrationResponse.h in Headers */, + 2D93864324B38828009A12D7 /* OIDServiceDiscovery.h in Headers */, + 2D93862624B3881C009A12D7 /* OIDError.h in Headers */, + 2D93864524B38828009A12D7 /* OIDTokenRequest.h in Headers */, + 2D93864724B38828009A12D7 /* OIDTokenResponse.h in Headers */, + 2D93864924B38828009A12D7 /* OIDTokenUtilities.h in Headers */, + 2D93862C24B38826009A12D7 /* OIDExternalUserAgent.h in Headers */, + 2D93863F24B38828009A12D7 /* OIDScopeUtilities.h in Headers */, + 2D93863B24B38827009A12D7 /* OIDResponseTypes.h in Headers */, + 2D93862224B3881C009A12D7 /* OIDAuthStateErrorDelegate.h in Headers */, + 2D93864D24B38829009A12D7 /* OIDURLSessionProvider.h in Headers */, + 2D93863524B38827009A12D7 /* OIDRegistrationRequest.h in Headers */, + 2D93861D24B38815009A12D7 /* OIDAuthorizationService.h in Headers */, + 2D93862B24B38825009A12D7 /* OIDExternalUserAgentRequest.h in Headers */, + 2D93861A24B3880B009A12D7 /* OIDAuthorizationRequest.h in Headers */, + 2D9385DE24B3861E009A12D7 /* AppAuthTV.h in Headers */, + 2D9385DF24B38646009A12D7 /* OIDTVAuthorizationRequest.h in Headers */, + 2D9385E124B3865E009A12D7 /* OIDTVAuthorizationService.h in Headers */, + 2D9385E024B38658009A12D7 /* OIDTVAuthorizationResponse.h in Headers */, + 2D9385E224B38669009A12D7 /* OIDTVServiceConfiguration.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 340DAE4C1D58216A00EC285B /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -1438,6 +1586,24 @@ productReference = 2D91B862249053190005B197 /* AppAuthEnterpriseUserAgent.framework */; productType = "com.apple.product-type.framework"; }; + 2D9385B624B37CAD009A12D7 /* AppAuthTV */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2D9385C824B37CAD009A12D7 /* Build configuration list for PBXNativeTarget "AppAuthTV" */; + buildPhases = ( + 2D9385B224B37CAD009A12D7 /* Headers */, + 2D9385B324B37CAD009A12D7 /* Sources */, + 2D9385B424B37CAD009A12D7 /* Frameworks */, + 2D9385B524B37CAD009A12D7 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = AppAuthTV; + productName = AppAuthTV; + productReference = 2D9385B724B37CAD009A12D7 /* AppAuthTV.framework */; + productType = "com.apple.product-type.framework"; + }; 340DAE4D1D58216A00EC285B /* AppAuth-macOS */ = { isa = PBXNativeTarget; buildConfigurationList = 340DAE541D58216A00EC285B /* Build configuration list for PBXNativeTarget "AppAuth-macOS" */; @@ -1731,6 +1897,11 @@ LastUpgradeCheck = 1000; ORGANIZATIONNAME = "OpenID Foundation"; TargetAttributes = { + 2D9385B624B37CAD009A12D7 = { + CreatedOnToolsVersion = 11.5; + DevelopmentTeam = AUX79W8H33; + ProvisioningStyle = Automatic; + }; 340DAE4D1D58216A00EC285B = { CreatedOnToolsVersion = 7.3.1; }; @@ -1816,6 +1987,7 @@ 343AAAC91E8348AA00F9D36E /* AppAuth_macOSTests */, 342F42842177B1FC00574F24 /* AppAuthCore */, 3489707D2177B3B000ABEED4 /* AppAuthCoreTests */, + 2D9385B624B37CAD009A12D7 /* AppAuthTV */, 2D91B81D249053190005B197 /* AppAuthEnterpriseUserAgent */, ); }; @@ -1829,6 +2001,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 2D9385B524B37CAD009A12D7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 341741EE1C5D8283000EF209 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -1952,6 +2131,41 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 2D9385B324B37CAD009A12D7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2D93862E24B38826009A12D7 /* OIDFieldMapping.m in Sources */, + 2D93864024B38828009A12D7 /* OIDScopeUtilities.m in Sources */, + 2D93862024B3881B009A12D7 /* OIDAuthState.m in Sources */, + 2D93861924B38803009A12D7 /* OIDAuthorizationRequest.m in Sources */, + 2D93863824B38827009A12D7 /* OIDGrantTypes.m in Sources */, + 2D93864824B38828009A12D7 /* OIDTokenResponse.m in Sources */, + 2D93863624B38827009A12D7 /* OIDRegistrationRequest.m in Sources */, + 2D93863224B38826009A12D7 /* OIDEndSessionRequest.m in Sources */, + 2D93864424B38828009A12D7 /* OIDServiceDiscovery.m in Sources */, + 2D93861C24B38812009A12D7 /* OIDAuthorizationResponse.m in Sources */, + 2D93863A24B38827009A12D7 /* OIDIDToken.m in Sources */, + 2D93864F24B38840009A12D7 /* OIDTVAuthorizationRequest.m in Sources */, + 2D93864624B38828009A12D7 /* OIDTokenRequest.m in Sources */, + 2D93865024B38840009A12D7 /* OIDTVAuthorizationResponse.m in Sources */, + 2D93864224B38828009A12D7 /* OIDServiceConfiguration.m in Sources */, + 2D93864A24B38829009A12D7 /* OIDTokenUtilities.m in Sources */, + 2D93862724B3881C009A12D7 /* OIDError.m in Sources */, + 2D93862424B3881C009A12D7 /* OIDClientMetadataParameters.m in Sources */, + 2D93864E24B38829009A12D7 /* OIDURLSessionProvider.m in Sources */, + 2D93864C24B38829009A12D7 /* OIDURLQueryComponent.m in Sources */, + 2D93863024B38826009A12D7 /* OIDEndSessionResponse.m in Sources */, + 2D93865224B38840009A12D7 /* OIDTVServiceConfiguration.m in Sources */, + 2D93861E24B3881B009A12D7 /* OIDAuthorizationService.m in Sources */, + 2D93863C24B38827009A12D7 /* OIDResponseTypes.m in Sources */, + 2D93863424B38826009A12D7 /* OIDRegistrationResponse.m in Sources */, + 2D93862924B3881C009A12D7 /* OIDErrorUtilities.m in Sources */, + 2D93865124B38840009A12D7 /* OIDTVAuthorizationService.m in Sources */, + 2D93863E24B38827009A12D7 /* OIDScopes.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 340DAE4A1D58216A00EC285B /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -2112,6 +2326,7 @@ 341310D31E6F944D00D5DEE5 /* OIDError.m in Sources */, 341310DE1E6F944D00D5DEE5 /* OIDTokenRequest.m in Sources */, 341310DF1E6F944D00D5DEE5 /* OIDTokenResponse.m in Sources */, + 2D47AAEC249A87020059B5A4 /* OIDTVAuthorizationService.m in Sources */, A6DEAB842017A7040022AC32 /* OIDEndSessionResponse.m in Sources */, 341310DC1E6F944D00D5DEE5 /* OIDServiceConfiguration.m in Sources */, 341310BF1E6F943C00D5DEE5 /* OIDClientMetadataParameters.m in Sources */, @@ -2120,8 +2335,11 @@ 341310D91E6F944D00D5DEE5 /* OIDResponseTypes.m in Sources */, 341310E11E6F944D00D5DEE5 /* OIDURLQueryComponent.m in Sources */, CF37C0701F1FC21A00662E41 /* OIDEndSessionRequest.m in Sources */, + 2D47AAE1249A87020059B5A4 /* OIDTVAuthorizationResponse.m in Sources */, 341310D41E6F944D00D5DEE5 /* OIDErrorUtilities.m in Sources */, 341310D81E6F944D00D5DEE5 /* OIDGrantTypes.m in Sources */, + 2D47AAE4249A87020059B5A4 /* OIDTVServiceConfiguration.m in Sources */, + 2D47AAE8249A87020059B5A4 /* OIDTVAuthorizationRequest.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2508,6 +2726,73 @@ }; name = Release; }; + 2D9385C924B37CAD009A12D7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = AUX79W8H33; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = "$(SRCROOT)/Source/TVFramework/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = net.openid.AppAuthTV; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = appletvos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 2D9385CA24B37CAD009A12D7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = AUX79W8H33; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = "$(SRCROOT)/Source/TVFramework/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = net.openid.AppAuthTV; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = appletvos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; 340DAE551D58216A00EC285B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -3199,6 +3484,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 2D9385C824B37CAD009A12D7 /* Build configuration list for PBXNativeTarget "AppAuthTV" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2D9385C924B37CAD009A12D7 /* Debug */, + 2D9385CA24B37CAD009A12D7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 340DAE541D58216A00EC285B /* Build configuration list for PBXNativeTarget "AppAuth-macOS" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuthTV.xcscheme b/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuthTV.xcscheme new file mode 100644 index 000000000..821dc33b5 --- /dev/null +++ b/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuthTV.xcscheme @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Package.swift b/Package.swift index e6a198173..da4c1da8b 100644 --- a/Package.swift +++ b/Package.swift @@ -37,7 +37,10 @@ let package = Package( targets: ["AppAuth"]), .library( name: "AppAuthEnterpriseUserAgent", - targets: ["AppAuthEnterpriseUserAgent"]) + targets: ["AppAuthEnterpriseUserAgent"]), + .library( + name: "AppAuthTV", + targets: ["AppAuthTV"]) ], dependencies: [], targets: [ @@ -68,6 +71,12 @@ let package = Package( .headerSearchPath("iOS"), ] ), + .target( + name: "AppAuthTV", + dependencies: ["AppAuthCore"], + path: "Source/AppAuthTV", + publicHeadersPath: "" + ), .testTarget( name: "AppAuthCoreTests", dependencies: ["AppAuthCore"], diff --git a/Source/AppAuthTV/AppAuthTV.h b/Source/AppAuthTV.h similarity index 75% rename from Source/AppAuthTV/AppAuthTV.h rename to Source/AppAuthTV.h index 32a6d8581..3768c6c14 100644 --- a/Source/AppAuthTV/AppAuthTV.h +++ b/Source/AppAuthTV.h @@ -1,7 +1,7 @@ /*! @file AppAuthTV.h - @brief GTMAppAuth SDK + @brief AppAuthTV SDK @copyright - Copyright 2016 Google Inc. + Copyright 2020 Google Inc. @copydetails Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ limitations under the License. */ -#import "GTMTVAuthorizationRequest.h" -#import "GTMTVAuthorizationResponse.h" -#import "GTMTVAuthorizationService.h" -#import "GTMTVServiceConfiguration.h" \ No newline at end of file +#import "OIDTVAuthorizationRequest.h" +#import "OIDTVAuthorizationResponse.h" +#import "OIDTVAuthorizationService.h" +#import "OIDTVServiceConfiguration.h" diff --git a/Source/AppAuthTV/GTMAppAuth.h b/Source/AppAuthTV/GTMAppAuth.h deleted file mode 100644 index b018d6fc4..000000000 --- a/Source/AppAuthTV/GTMAppAuth.h +++ /dev/null @@ -1,21 +0,0 @@ -/*! @file GTMAppAuth.h - @brief GTMAppAuth SDK - @copyright - Copyright 2016 Google Inc. - @copydetails - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ - -#import "GTMTVAuthorizationRequest.h" -#import "GTMTVAuthorizationResponse.h" -#import "GTMTVAuthorizationService.h" diff --git a/Source/AppAuthTV/GTMTVAuthorizationRequest.h b/Source/AppAuthTV/OIDTVAuthorizationRequest.h similarity index 84% rename from Source/AppAuthTV/GTMTVAuthorizationRequest.h rename to Source/AppAuthTV/OIDTVAuthorizationRequest.h index 032c05488..2496948f1 100644 --- a/Source/AppAuthTV/GTMTVAuthorizationRequest.h +++ b/Source/AppAuthTV/OIDTVAuthorizationRequest.h @@ -1,5 +1,5 @@ -/*! @file GTMTVAuthorizationRequest.h - @brief GTMAppAuth SDK +/*! @file OIDTVAuthorizationRequest.h + @brief AppAuth iOS SDK @copyright Copyright 2016 Google Inc. @copydetails @@ -18,16 +18,16 @@ #import -#import "AppAuthCore.h" +#import "OIDAuthorizationRequest.h" -@class GTMTVServiceConfiguration; +@class OIDTVServiceConfiguration; NS_ASSUME_NONNULL_BEGIN /*! @brief Represents a TV and limited input device authorization request. - @see https://developers.google.com/identity/protocols/OAuth2ForDevices + @see https://tools.ietf.org/html/rfc8628#section-3.1 */ -@interface GTMTVAuthorizationRequest : OIDAuthorizationRequest +@interface OIDTVAuthorizationRequest : OIDAuthorizationRequest /*! @brief Creates a TV authorization request with opinionated defaults @param configuration The service's configuration. @@ -37,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN @param additionalParameters The client's additional authorization parameters. */ - (instancetype) - initWithConfiguration:(GTMTVServiceConfiguration *)configuration + initWithConfiguration:(OIDTVServiceConfiguration *)configuration clientId:(NSString *)clientID clientSecret:(NSString *)clientSecret scopes:(nullable NSArray *)scopes diff --git a/Source/AppAuthTV/GTMTVAuthorizationRequest.m b/Source/AppAuthTV/OIDTVAuthorizationRequest.m similarity index 86% rename from Source/AppAuthTV/GTMTVAuthorizationRequest.m rename to Source/AppAuthTV/OIDTVAuthorizationRequest.m index f47d80aac..4afae8cd8 100644 --- a/Source/AppAuthTV/GTMTVAuthorizationRequest.m +++ b/Source/AppAuthTV/OIDTVAuthorizationRequest.m @@ -1,5 +1,5 @@ -/*! @file GTMTVAuthorizationRequest.m - @brief GTMAppAuth SDK +/*! @file OIDTVAuthorizationRequest.m + @brief AppAuth iOS SDK @copyright Copyright 2016 Google Inc. @copydetails @@ -15,17 +15,14 @@ See the License for the specific language governing permissions and limitations under the License. */ - -#import "GTMTVAuthorizationRequest.h" - -#import "AppAuthCore.h" +#import "OIDTVAuthorizationRequest.h" +#import "OIDTVServiceConfiguration.h" #import "OIDURLQueryComponent.h" -#import "GTMTVServiceConfiguration.h" -@implementation GTMTVAuthorizationRequest +@implementation OIDTVAuthorizationRequest - (instancetype) - initWithConfiguration:(GTMTVServiceConfiguration *)configuration + initWithConfiguration:(OIDTVServiceConfiguration *)configuration clientId:(NSString *)clientID clientSecret:(nullable NSString *)clientSecret scope:(nullable NSString *)scope @@ -38,9 +35,9 @@ @implementation GTMTVAuthorizationRequest codeChallengeMethod:(nullable NSString *)codeChallengeMethod additionalParameters:(nullable NSDictionary *)additionalParameters { - if (![configuration isKindOfClass:[GTMTVServiceConfiguration class]]) { - NSAssert([configuration isKindOfClass:[GTMTVServiceConfiguration class]], - @"configuration parameter must be of type GTMTVServiceConfiguration, encountered %@", + if (![configuration isKindOfClass:[OIDTVServiceConfiguration class]]) { + NSAssert([configuration isKindOfClass:[OIDTVServiceConfiguration class]], + @"configuration parameter must be of type OIDTVServiceConfiguration, encountered %@", NSStringFromClass([configuration class])); return nil; } @@ -60,7 +57,7 @@ @implementation GTMTVAuthorizationRequest } - (instancetype) - initWithConfiguration:(GTMTVServiceConfiguration *)configuration + initWithConfiguration:(OIDTVServiceConfiguration *)configuration clientId:(NSString *)clientID clientSecret:(NSString *)clientSecret scopes:(nullable NSArray *)scopes @@ -79,7 +76,7 @@ @implementation GTMTVAuthorizationRequest - (NSString *)description { return [NSString stringWithFormat:@"<%@: %p, request: %@>", NSStringFromClass([self class]), - self, + (void *)self, self.authorizationRequestURL]; } @@ -105,7 +102,7 @@ - (NSURLRequest *)URLRequest { static NSString *const kHTTPContentTypeHeaderValue = @"application/x-www-form-urlencoded; charset=UTF-8"; - GTMTVServiceConfiguration *tvConfiguration = (GTMTVServiceConfiguration *)self.configuration; + OIDTVServiceConfiguration *tvConfiguration = (OIDTVServiceConfiguration *)self.configuration; NSMutableURLRequest *URLRequest = [[NSURLRequest requestWithURL:tvConfiguration.TVAuthorizationEndpoint] mutableCopy]; diff --git a/Source/AppAuthTV/GTMTVAuthorizationResponse.h b/Source/AppAuthTV/OIDTVAuthorizationResponse.h similarity index 83% rename from Source/AppAuthTV/GTMTVAuthorizationResponse.h rename to Source/AppAuthTV/OIDTVAuthorizationResponse.h index ce1365f4f..cb4793c59 100644 --- a/Source/AppAuthTV/GTMTVAuthorizationResponse.h +++ b/Source/AppAuthTV/OIDTVAuthorizationResponse.h @@ -1,5 +1,5 @@ -/*! @file GTMTVAuthorizationResponse.h - @brief GTMAppAuth SDK +/*! @file OIDTVAuthorizationResponse.h + @brief AppAuth iOS SDK @copyright Copyright 2016 Google Inc. @copydetails @@ -18,22 +18,22 @@ #import -#import "AppAuthCore.h" +#import "OIDAuthorizationResponse.h" -@class GTMTVAuthorizationRequest; +@class OIDTVAuthorizationRequest; @class OIDTokenRequest; NS_ASSUME_NONNULL_BEGIN /*! @brief The @c grant_type value for the the TV authorization flow. - @see https://developers.google.com/identity/protocols/OAuth2ForDevices + @see https://tools.ietf.org/html/rfc8628#section-3.4 */ -extern NSString *const GTMTVDeviceTokenGrantType; +extern NSString *const OIDTVDeviceTokenGrantType; /*! @brief Represents the response to a TV authorization request. - @see https://developers.google.com/identity/protocols/OAuth2ForDevices + @see https://tools.ietf.org/html/rfc8628#section-3.5 */ -@interface GTMTVAuthorizationResponse : OIDAuthorizationResponse +@interface OIDTVAuthorizationResponse : OIDAuthorizationResponse /*! @brief The verification URL that should be displayed to the user instructing them to visit the URL and enter the code. @@ -69,20 +69,20 @@ extern NSString *const GTMTVDeviceTokenGrantType; properties are populated. Non-normative parameters are placed in the @c #additionalParameters dictionary. */ -- (instancetype)initWithRequest:(GTMTVAuthorizationRequest *)request +- (instancetype)initWithRequest:(OIDTVAuthorizationRequest *)request parameters:(NSDictionary *> *)parameters NS_DESIGNATED_INITIALIZER; /*! @brief Creates a token request suitable for polling the token endpoint with the @c deviceCode. @return A @c OIDTokenRequest suitable for polling the token endpoint. - @see https://developers.google.com/identity/protocols/OAuth2ForDevices + @see https://tools.ietf.org/html/rfc8628#section-3.4 */ - (nullable OIDTokenRequest *)tokenPollRequest; /*! @brief Creates a token request suitable for polling the token endpoint with the @c deviceCode. @param additionalParameters Additional parameters for the token request. @return A @c OIDTokenRequest suitable for polling the token endpoint. - @see https://developers.google.com/identity/protocols/OAuth2ForDevices + @see https://tools.ietf.org/html/rfc8628#section-3.4 */ - (nullable OIDTokenRequest *)tokenPollRequestWithAdditionalParameters: (nullable NSDictionary *)additionalParameters; diff --git a/Source/AppAuthTV/GTMTVAuthorizationResponse.m b/Source/AppAuthTV/OIDTVAuthorizationResponse.m similarity index 89% rename from Source/AppAuthTV/GTMTVAuthorizationResponse.m rename to Source/AppAuthTV/OIDTVAuthorizationResponse.m index bee285fc4..6a0110baa 100644 --- a/Source/AppAuthTV/GTMTVAuthorizationResponse.m +++ b/Source/AppAuthTV/OIDTVAuthorizationResponse.m @@ -1,5 +1,5 @@ -/*! @file GTMTVAuthorizationResponse.m - @brief GTMAppAuth SDK +/*! @file OIDTVAuthorizationResponse.m + @brief AppAuth iOS SDK @copyright Copyright 2016 Google Inc. @copydetails @@ -16,15 +16,15 @@ limitations under the License. */ -#import "GTMTVAuthorizationResponse.h" +#import "OIDTVAuthorizationResponse.h" -#import "GTMTVAuthorizationRequest.h" -#import "AppAuthCore.h" #import "OIDDefines.h" #import "OIDFieldMapping.h" +#import "OIDTokenRequest.h" +#import "OIDTVAuthorizationRequest.h" -NSString *const GTMTVDeviceTokenGrantType = @"http://oauth.net/grant_type/device/1.0"; +NSString *const OIDTVDeviceTokenGrantType = @"http://oauth.net/grant_type/device/1.0"; /*! @brief The key for the @c verificationURL property in the incoming parameters and for @c NSSecureCoding. @@ -59,13 +59,7 @@ */ static NSString *const kRequestKey = @"request"; -@implementation GTMTVAuthorizationResponse - -@synthesize verificationURL = _verificationURL; -@synthesize userCode = _userCode; -@synthesize deviceCode = _deviceCode; -@synthesize interval = _interval; -@synthesize expirationDate = _expirationDate; +@implementation OIDTVAuthorizationResponse /*! @brief Returns a mapping of incoming parameters to instance variables. @return A mapping of incoming parameters to instance variables. @@ -99,7 +93,7 @@ @implementation GTMTVAuthorizationResponse #pragma mark - Initializers -- (instancetype)initWithRequest:(GTMTVAuthorizationRequest *)request +- (instancetype)initWithRequest:(OIDTVAuthorizationRequest *)request parameters:(NSDictionary *> *)parameters { self = [super initWithRequest:request parameters:parameters]; return self; @@ -123,7 +117,7 @@ - (NSString *)description { "additionalParameters: %@, " "request: %@>", NSStringFromClass([self class]), - self, + (void *)self, _verificationURL, _userCode, _deviceCode, @@ -143,7 +137,7 @@ - (OIDTokenRequest *)tokenPollRequestWithAdditionalParameters: (NSDictionary *)additionalParameters { OIDTokenRequest *pollRequest = [[OIDTokenRequest alloc] initWithConfiguration:self.request.configuration - grantType:GTMTVDeviceTokenGrantType + grantType:OIDTVDeviceTokenGrantType authorizationCode:_deviceCode redirectURL:[[NSURL alloc] init] clientID:self.request.clientID diff --git a/Source/AppAuthTV/GTMTVAuthorizationService.h b/Source/AppAuthTV/OIDTVAuthorizationService.h similarity index 69% rename from Source/AppAuthTV/GTMTVAuthorizationService.h rename to Source/AppAuthTV/OIDTVAuthorizationService.h index a37d4aa4e..14027bc09 100644 --- a/Source/AppAuthTV/GTMTVAuthorizationService.h +++ b/Source/AppAuthTV/OIDTVAuthorizationService.h @@ -1,5 +1,5 @@ -/*! @file GTMTVAuthorizationService.h - @brief GTMAppAuth SDK +/*! @file OIDTVAuthorizationService.h + @brief AppAuth iOS SDK @copyright Copyright 2016 Google Inc. @copydetails @@ -21,17 +21,17 @@ NS_ASSUME_NONNULL_BEGIN @class OIDAuthState; -@class GTMTVAuthorizationRequest; -@class GTMTVAuthorizationResponse; -@class GTMTVServiceConfiguration; +@class OIDTVAuthorizationRequest; +@class OIDTVAuthorizationResponse; +@class OIDTVServiceConfiguration; /*! @brief The block that is called when the TV authorization has initialized. @param response The authorization response, or nil if there was an error. Display - @c GTMTVAuthorizationResponse.userCode and @c GTMTVAuthorizationResponse.verificationURL to + @c OIDTVAuthorizationResponse.userCode and @c OIDTVAuthorizationResponse.verificationURL to the user so they can action the request. @param error The error if an error occurred. */ -typedef void (^GTMTVAuthorizationInitialization)(GTMTVAuthorizationResponse *_Nullable response, +typedef void (^OIDTVAuthorizationInitialization)(OIDTVAuthorizationResponse *_Nullable response, NSError *_Nullable error); /*! @brief The block that is called when the TV authorization has completed. @@ -39,26 +39,19 @@ typedef void (^GTMTVAuthorizationInitialization)(GTMTVAuthorizationResponse *_Nu API calls, or nil if there was an error. @param error The error if an error occurred. */ -typedef void (^GTMTVAuthorizationCompletion) +typedef void (^OIDTVAuthorizationCompletion) (OIDAuthState *_Nullable authorization, NSError *_Nullable error); -/*! @brief Block returned when authorization is initialized to that will cancel the pending +/*! @brief Block returned when authorization is initialized that will cancel the pending authorization when executed. Has no effect if called twice or after the authorization concluded. */ -typedef void (^GTMTVAuthorizationCancelBlock)(void); +typedef void (^OIDTVAuthorizationCancelBlock)(void); /*! @brief Performs authorization flows designed for TVs and other limited input devices. */ -@interface GTMTVAuthorizationService : NSObject - -#if !GTM_APPAUTH_SKIP_GOOGLE_SUPPORT -/*! @brief Convenience method to return the TV authorization URL for Google. - @return TV authorization URL for Google. - */ -+ (GTMTVServiceConfiguration *)TVConfigurationForGoogle; -#endif // !GTM_APPAUTH_SKIP_GOOGLE_SUPPORT +@interface OIDTVAuthorizationService : NSObject /*! @brief Starts a TV authorization flow with the given request and polls for a response. @param request The TV authorization request to initiate. @@ -67,15 +60,15 @@ typedef void (^GTMTVAuthorizationCancelBlock)(void); authorization as the user has yet to grant it. Rather, it contains the information that you show to the user in order for them to authorize the request on another device. @param completion Block that is called on the success or failure of the authorization. If the - user approves the request, you will get a @c GTMAppAuthFetherAuthorization that you can use + user approves the request, you will get a @c OIDAuthState that you can use to authenticate API calls, otherwis eyou will get an error. @return A block which you can execute if you need to cancel the ongoing authorization. Has no effect if called twice, or called after the authorization concludes. - @see https://developers.google.com/identity/protocols/OAuth2ForDevices + @see https://tools.ietf.org/html/rfc8628 */ -+ (GTMTVAuthorizationCancelBlock)authorizeTVRequest:(GTMTVAuthorizationRequest *)request - initializaiton:(GTMTVAuthorizationInitialization)initialization - completion:(GTMTVAuthorizationCompletion)completion; ++ (OIDTVAuthorizationCancelBlock)authorizeTVRequest:(OIDTVAuthorizationRequest *)request + initialization:(OIDTVAuthorizationInitialization)initialization + completion:(OIDTVAuthorizationCompletion)completion; @end diff --git a/Source/AppAuthTV/GTMTVAuthorizationService.m b/Source/AppAuthTV/OIDTVAuthorizationService.m similarity index 82% rename from Source/AppAuthTV/GTMTVAuthorizationService.m rename to Source/AppAuthTV/OIDTVAuthorizationService.m index 5160d0305..fed16a938 100644 --- a/Source/AppAuthTV/GTMTVAuthorizationService.m +++ b/Source/AppAuthTV/OIDTVAuthorizationService.m @@ -1,5 +1,5 @@ -/*! @file GTMTVAuthorizationService.m - @brief GTMAppAuth SDK +/*! @file OIDTVAuthorizationService.m + @brief AppAuth iOS SDK @copyright Copyright 2016 Google Inc. @copydetails @@ -16,60 +16,40 @@ limitations under the License. */ -#import "GTMTVAuthorizationService.h" +#import "OIDTVAuthorizationService.h" -#import "AppAuthCore.h" +#import "OIDAuthorizationService.h" +#import "OIDAuthState.h" #import "OIDDefines.h" +#import "OIDErrorUtilities.h" #import "OIDURLQueryComponent.h" -#import "GTMTVAuthorizationRequest.h" -#import "GTMTVAuthorizationResponse.h" -#import "GTMTVServiceConfiguration.h" - -/*! @brief Google's device authorization endpoint. - */ -NSString *const kGoogleDeviceAuthorizationEndpoint = - @"https://accounts.google.com/o/oauth2/device/code"; +#import "OIDTVAuthorizationRequest.h" +#import "OIDTVAuthorizationResponse.h" +#import "OIDTVServiceConfiguration.h" /*! @brief The authorization pending error code. - @see https://developers.google.com/identity/protocols/OAuth2ForDevices + @see https://tools.ietf.org/html/rfc8628#section-3.5 */ NSString *const kErrorCodeAuthorizationPending = @"authorization_pending"; /*! @brief The slow down error code. - @see https://developers.google.com/identity/protocols/OAuth2ForDevices + @see https://tools.ietf.org/html/rfc8628#section-3.5 */ NSString *const kErrorCodeSlowDown = @"slow_down"; -@implementation GTMTVAuthorizationService +@implementation OIDTVAuthorizationService #pragma mark - Initializers -#if !GTM_APPAUTH_SKIP_GOOGLE_SUPPORT -+ (GTMTVServiceConfiguration *)TVConfigurationForGoogle { - NSURL *authorizationEndpoint = - [NSURL URLWithString:@"https://accounts.google.com/o/oauth2/v2/auth"]; - NSURL *tokenEndpoint = - [NSURL URLWithString:@"https://www.googleapis.com/oauth2/v4/token"]; - NSURL *TVAuthorizationEndpoint = - [NSURL URLWithString:kGoogleDeviceAuthorizationEndpoint]; - - GTMTVServiceConfiguration *configuration = - [[GTMTVServiceConfiguration alloc] initWithAuthorizationEndpoint:authorizationEndpoint - TVAuthorizationEndpoint:TVAuthorizationEndpoint - tokenEndpoint:tokenEndpoint]; - return configuration; -} -#endif // !GTM_APPAUTH_SKIP_GOOGLE_SUPPORT - -+ (GTMTVAuthorizationCancelBlock)authorizeTVRequest:(GTMTVAuthorizationRequest *)request - initializaiton:(GTMTVAuthorizationInitialization)initialization - completion:(GTMTVAuthorizationCompletion)completion { ++ (OIDTVAuthorizationCancelBlock)authorizeTVRequest:(OIDTVAuthorizationRequest *)request + initialization:(OIDTVAuthorizationInitialization)initialization + completion:(OIDTVAuthorizationCompletion)completion { // Block level variable that can be used to cancel the polling. __block BOOL pollRunning = YES; // Block that will be returned allowign the caller to cancel the polling. - GTMTVAuthorizationCancelBlock cancelBlock = ^{ + OIDTVAuthorizationCancelBlock cancelBlock = ^{ if (pollRunning) { dispatch_async(dispatch_get_main_queue(), ^{ NSError *cancelError = @@ -159,8 +139,8 @@ + (GTMTVAuthorizationCancelBlock)authorizeTVRequest:(GTMTVAuthorizationRequest * } // Parses the authorization response. - GTMTVAuthorizationResponse *TVAuthorizationResponse = - [[GTMTVAuthorizationResponse alloc] initWithRequest:request parameters:json]; + OIDTVAuthorizationResponse *TVAuthorizationResponse = + [[OIDTVAuthorizationResponse alloc] initWithRequest:request parameters:json]; if (!TVAuthorizationResponse) { // A problem occurred constructing the token response from the JSON. NSError *returnedError = diff --git a/Source/AppAuthTV/GTMTVServiceConfiguration.h b/Source/AppAuthTV/OIDTVServiceConfiguration.h similarity index 88% rename from Source/AppAuthTV/GTMTVServiceConfiguration.h rename to Source/AppAuthTV/OIDTVServiceConfiguration.h index 7fb6babfd..2b6b29093 100644 --- a/Source/AppAuthTV/GTMTVServiceConfiguration.h +++ b/Source/AppAuthTV/OIDTVServiceConfiguration.h @@ -1,5 +1,5 @@ -/*! @file GTMTVServiceConfiguration.h - @brief GTMAppAuth SDK +/*! @file OIDTVServiceConfiguration.h + @brief AppAuth iOS SDK @copyright Copyright 2016 Google Inc. @copydetails @@ -16,13 +16,13 @@ limitations under the License. */ -#import "AppAuthCore.h" +#import "OIDServiceConfiguration.h" NS_ASSUME_NONNULL_BEGIN -/*! @brief Configuration for authorizing the user with the @c GTMTVAuthorizationService. +/*! @brief Configuration for authorizing the user with the @c OIDTVAuthorizationService. */ -@interface GTMTVServiceConfiguration : OIDServiceConfiguration +@interface OIDTVServiceConfiguration : OIDServiceConfiguration /*! @brief The TV authorization endpoint URI. */ diff --git a/Source/AppAuthTV/GTMTVServiceConfiguration.m b/Source/AppAuthTV/OIDTVServiceConfiguration.m similarity index 86% rename from Source/AppAuthTV/GTMTVServiceConfiguration.m rename to Source/AppAuthTV/OIDTVServiceConfiguration.m index e6493292c..edd53962c 100644 --- a/Source/AppAuthTV/GTMTVServiceConfiguration.m +++ b/Source/AppAuthTV/OIDTVServiceConfiguration.m @@ -1,5 +1,5 @@ -/*! @file GTMTVServiceConfiguration.m - @brief GTMAppAuth SDK +/*! @file OIDTVServiceConfiguration.m + @brief AppAuth iOS SDK @copyright Copyright 2016 Google Inc. @copydetails @@ -16,9 +16,8 @@ limitations under the License. */ -#import "GTMTVServiceConfiguration.h" +#import "OIDTVServiceConfiguration.h" -#import "AppAuthCore.h" #import "OIDDefines.h" /*! @brief The key for the @c TVAuthorizationEndpoint property. @@ -27,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN -@interface GTMTVServiceConfiguration () +@interface OIDTVServiceConfiguration () /*! @brief Designated initializer. @param aDecoder NSCoder to unserialize the object from. @@ -36,18 +35,16 @@ - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIAL @end -@implementation GTMTVServiceConfiguration - -@synthesize TVAuthorizationEndpoint = _TVAuthorizationEndpoint; +@implementation OIDTVServiceConfiguration - (instancetype)init OID_UNAVAILABLE_USE_INITIALIZER( - @selector(initWithAuthorizationEndpoint:TVAuthorizationEndpoint:tokenEndpoint:)); + @selector(initWithAuthorizationEndpoint:TVAuthorizationEndpoint:tokenEndpoint:)) - (instancetype)initWithAuthorizationEndpoint:(NSURL *)authorizationEndpoint - tokenEndpoint:(NSURL *)tokenEndpoint + tokenEndpoint:(NSURL *)tokenEndpoint OID_UNAVAILABLE_USE_INITIALIZER( - @selector(initWithAuthorizationEndpoint:TVAuthorizationEndpoint:tokenEndpoint:)); + @selector(initWithAuthorizationEndpoint:TVAuthorizationEndpoint:tokenEndpoint:)) - (instancetype)initWithAuthorizationEndpoint:(NSURL *)authorizationEndpoint TVAuthorizationEndpoint:(NSURL *)TVAuthorizationEndpoint @@ -85,7 +82,7 @@ - (void)encodeWithCoder:(NSCoder *)aCoder { - (NSString *)description { return [NSString stringWithFormat:@"<%@: %p, TVAuthorizationEndpoint: %@ tokenEndpoint: %@>", NSStringFromClass([self class]), - self, + (void *)self, _TVAuthorizationEndpoint, self.tokenEndpoint]; } diff --git a/Source/TVFramework/AppAuthTV.h b/Source/TVFramework/AppAuthTV.h new file mode 100644 index 000000000..ab3c1e604 --- /dev/null +++ b/Source/TVFramework/AppAuthTV.h @@ -0,0 +1,57 @@ +/*! @file AppAuthTV.h + @brief AppAuthTV SDK + @copyright + Copyright 2020 Google Inc. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#import + +//! Project version number for AppAuthTV. +FOUNDATION_EXPORT double AppAuthTVVersionNumber; + +//! Project version string for AppAuthTV. +FOUNDATION_EXPORT const unsigned char AppAuthTVVersionString[]; + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + +#import +#import +#import +#import diff --git a/Source/TVFramework/Info.plist b/Source/TVFramework/Info.plist new file mode 100644 index 000000000..9bcb24442 --- /dev/null +++ b/Source/TVFramework/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + + From 8248ccb557efdde674306f5aa238a36f2a15054c Mon Sep 17 00:00:00 2001 From: Souleiman Benhida Date: Wed, 22 Jul 2020 15:36:53 -0400 Subject: [PATCH 09/81] Add AppAuthTV tests * OIDTVAuthorizationRequest tests * Add tests to AppAuthTVScheme * add AppAuthTV to .travis.yml --- .travis.yml | 1 + AppAuth.xcodeproj/project.pbxproj | 144 +++++++++ .../xcshareddata/xcschemes/AppAuthTV.xcscheme | 12 +- Package.swift | 9 +- .../OIDTVAuthorizationRequestTests.h | 60 ++++ .../OIDTVAuthorizationRequestTests.m | 290 ++++++++++++++++++ 6 files changed, 513 insertions(+), 3 deletions(-) create mode 100644 UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.h create mode 100644 UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.m diff --git a/.travis.yml b/.travis.yml index 288293628..4adfa0042 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,7 @@ jobs: - SCHEME=AppAuth_macOS DESTINATION="'platform=macOS,arch=x86_64'" SDK=macosx10.15 - SCHEME=AppAuth-tvOS DESTINATION="'platform=tvOS Simulator,name=Apple TV,OS=13.0'" SDK=appletvsimulator13.0 - SCHEME=AppAuth_tvOS DESTINATION="'platform=tvOS Simulator,name=Apple TV,OS=13.0'" SDK=appletvsimulator13.0 + - SCHEME=AppAuthTV DESTINATION="'platform=tvOS Simulator,name=Apple TV,OS=13.0'" SDK=appletvsimulator13.0 before_script: - sudo gem install xcpretty script: diff --git a/AppAuth.xcodeproj/project.pbxproj b/AppAuth.xcodeproj/project.pbxproj index 11b222444..ca5c21628 100644 --- a/AppAuth.xcodeproj/project.pbxproj +++ b/AppAuth.xcodeproj/project.pbxproj @@ -18,6 +18,24 @@ 2D47AAE4249A87020059B5A4 /* OIDTVServiceConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D47AADA249A87010059B5A4 /* OIDTVServiceConfiguration.m */; }; 2D47AAE8249A87020059B5A4 /* OIDTVAuthorizationRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D47AADD249A87010059B5A4 /* OIDTVAuthorizationRequest.m */; }; 2D47AAEC249A87020059B5A4 /* OIDTVAuthorizationService.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D47AAE0249A87020059B5A4 /* OIDTVAuthorizationService.m */; }; + 2D8111FA24C0FD4C00984DA7 /* AppAuthTV.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D9385B724B37CAD009A12D7 /* AppAuthTV.framework */; }; + 2D81120424C1036700984DA7 /* OIDTVAuthorizationRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D81120024C1036700984DA7 /* OIDTVAuthorizationRequestTests.m */; }; + 2D81120624C103C800984DA7 /* OIDAuthorizationRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 341742011C5D82D3000EF209 /* OIDAuthorizationRequestTests.m */; }; + 2D81120724C103CC00984DA7 /* OIDAuthorizationResponseTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 341742031C5D82D3000EF209 /* OIDAuthorizationResponseTests.m */; }; + 2D81120824C103F200984DA7 /* OIDAuthStateTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 341742051C5D82D3000EF209 /* OIDAuthStateTests.m */; }; + 2D81120924C103F200984DA7 /* OIDGrantTypesTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 341742061C5D82D3000EF209 /* OIDGrantTypesTests.m */; }; + 2D81120A24C103F200984DA7 /* OIDResponseTypesTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 341742071C5D82D3000EF209 /* OIDResponseTypesTests.m */; }; + 2D81120C24C103F300984DA7 /* OIDScopesTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 341742081C5D82D3000EF209 /* OIDScopesTests.m */; }; + 2D81120D24C103F300984DA7 /* OIDServiceConfigurationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3417420A1C5D82D3000EF209 /* OIDServiceConfigurationTests.m */; }; + 2D81120E24C103F300984DA7 /* OIDServiceDiscoveryTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3417420C1C5D82D3000EF209 /* OIDServiceDiscoveryTests.m */; }; + 2D81120F24C103F300984DA7 /* OIDTokenRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3417420E1C5D82D3000EF209 /* OIDTokenRequestTests.m */; }; + 2D81121024C103F300984DA7 /* OIDTokenResponseTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 341742101C5D82D3000EF209 /* OIDTokenResponseTests.m */; }; + 2D81121124C103F300984DA7 /* OIDTokenUtilitiesTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A5EEF1FD20CF07760044F470 /* OIDTokenUtilitiesTests.m */; }; + 2D81121224C103F300984DA7 /* OIDURLQueryComponentTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 341742121C5D82D3000EF209 /* OIDURLQueryComponentTests.m */; }; + 2D81121324C103F300984DA7 /* OIDURLQueryComponentTestsIOS7.m in Sources */ = {isa = PBXBuildFile; fileRef = 341742131C5D82D3000EF209 /* OIDURLQueryComponentTestsIOS7.m */; }; + 2D81121424C103F300984DA7 /* OIDRegistrationRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 60140F821DE43BAF00DA0DC3 /* OIDRegistrationRequestTests.m */; }; + 2D81121524C103F300984DA7 /* OIDRegistrationResponseTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 60140F851DE43CC700DA0DC3 /* OIDRegistrationResponseTests.m */; }; + 2D81121624C103F300984DA7 /* OIDRPProfileCode.m in Sources */ = {isa = PBXBuildFile; fileRef = 34A6638A1E8865090060B664 /* OIDRPProfileCode.m */; }; 2D91B81F249053190005B197 /* OIDExternalUserAgentIOS.m in Sources */ = {isa = PBXBuildFile; fileRef = A6DEABA82018E5B50022AC32 /* OIDExternalUserAgentIOS.m */; }; 2D91B820249053190005B197 /* OIDExternalUserAgentCatalyst.m in Sources */ = {isa = PBXBuildFile; fileRef = F9A7082D2355ED74004B3E6D /* OIDExternalUserAgentCatalyst.m */; }; 2D91B821249053190005B197 /* OIDFieldMapping.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741C41C5D8243000EF209 /* OIDFieldMapping.m */; }; @@ -641,6 +659,13 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + 2D8111FB24C0FD4C00984DA7 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 340E73741C5D819B0076B1F6 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 2D9385B624B37CAD009A12D7; + remoteInfo = AppAuthTV; + }; 341741F61C5D8283000EF209 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 340E73741C5D819B0076B1F6 /* Project object */; @@ -737,6 +762,9 @@ 2D47AADE249A87020059B5A4 /* OIDTVServiceConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDTVServiceConfiguration.h; sourceTree = ""; }; 2D47AADF249A87020059B5A4 /* OIDTVAuthorizationService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDTVAuthorizationService.h; sourceTree = ""; }; 2D47AAE0249A87020059B5A4 /* OIDTVAuthorizationService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OIDTVAuthorizationService.m; sourceTree = ""; }; + 2D8111F524C0FD4C00984DA7 /* AppAuthTVTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AppAuthTVTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 2D81120024C1036700984DA7 /* OIDTVAuthorizationRequestTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OIDTVAuthorizationRequestTests.m; sourceTree = ""; }; + 2D81120324C1036700984DA7 /* OIDTVAuthorizationRequestTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDTVAuthorizationRequestTests.h; sourceTree = ""; }; 2D91B862249053190005B197 /* AppAuthEnterpriseUserAgent.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AppAuthEnterpriseUserAgent.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 2D91B868249177180005B197 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 2D9385B724B37CAD009A12D7 /* AppAuthTV.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AppAuthTV.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -874,6 +902,14 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 2D8111F224C0FD4C00984DA7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 2D8111FA24C0FD4C00984DA7 /* AppAuthTV.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 2D91B83C249053190005B197 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -1045,6 +1081,15 @@ path = AppAuthTV; sourceTree = ""; }; + 2D52A08D24C24C260022E402 /* AppAuthTV */ = { + isa = PBXGroup; + children = ( + 2D81120324C1036700984DA7 /* OIDTVAuthorizationRequestTests.h */, + 2D81120024C1036700984DA7 /* OIDTVAuthorizationRequestTests.m */, + ); + path = AppAuthTV; + sourceTree = ""; + }; 2D91B867249177180005B197 /* EnterpriseUserAgentFramework */ = { isa = PBXGroup; children = ( @@ -1112,6 +1157,7 @@ 348970972177B3B000ABEED4 /* AppAuthCoreTests.xctest */, 2D9385B724B37CAD009A12D7 /* AppAuthTV.framework */, 2D91B862249053190005B197 /* AppAuthEnterpriseUserAgent.framework */, + 2D8111F524C0FD4C00984DA7 /* AppAuthTVTests.xctest */, ); name = Products; sourceTree = ""; @@ -1138,6 +1184,7 @@ 341741FB1C5D82D3000EF209 /* UnitTests */ = { isa = PBXGroup; children = ( + 2D52A08D24C24C260022E402 /* AppAuthTV */, 341742231C5D8317000EF209 /* UnitTestsInfo.plist */, 341742001C5D82D3000EF209 /* OIDAuthorizationRequestTests.h */, 341742011C5D82D3000EF209 /* OIDAuthorizationRequestTests.m */, @@ -1568,6 +1615,24 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ + 2D8111F424C0FD4C00984DA7 /* AppAuthTVTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2D8111FF24C0FD4D00984DA7 /* Build configuration list for PBXNativeTarget "AppAuthTVTests" */; + buildPhases = ( + 2D8111F124C0FD4C00984DA7 /* Sources */, + 2D8111F224C0FD4C00984DA7 /* Frameworks */, + 2D8111F324C0FD4C00984DA7 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 2D8111FC24C0FD4C00984DA7 /* PBXTargetDependency */, + ); + name = AppAuthTVTests; + productName = AppAuthTVTests; + productReference = 2D8111F524C0FD4C00984DA7 /* AppAuthTVTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; 2D91B81D249053190005B197 /* AppAuthEnterpriseUserAgent */ = { isa = PBXNativeTarget; buildConfigurationList = 2D91B85F249053190005B197 /* Build configuration list for PBXNativeTarget "AppAuthEnterpriseUserAgent" */; @@ -1897,6 +1962,9 @@ LastUpgradeCheck = 1000; ORGANIZATIONNAME = "OpenID Foundation"; TargetAttributes = { + 2D8111F424C0FD4C00984DA7 = { + CreatedOnToolsVersion = 11.6; + }; 2D9385B624B37CAD009A12D7 = { CreatedOnToolsVersion = 11.5; DevelopmentTeam = AUX79W8H33; @@ -1989,11 +2057,19 @@ 3489707D2177B3B000ABEED4 /* AppAuthCoreTests */, 2D9385B624B37CAD009A12D7 /* AppAuthTV */, 2D91B81D249053190005B197 /* AppAuthEnterpriseUserAgent */, + 2D8111F424C0FD4C00984DA7 /* AppAuthTVTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 2D8111F324C0FD4C00984DA7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 2D91B85E249053190005B197 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -2095,6 +2171,30 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 2D8111F124C0FD4C00984DA7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2D81120C24C103F300984DA7 /* OIDScopesTests.m in Sources */, + 2D81121224C103F300984DA7 /* OIDURLQueryComponentTests.m in Sources */, + 2D81120D24C103F300984DA7 /* OIDServiceConfigurationTests.m in Sources */, + 2D81121324C103F300984DA7 /* OIDURLQueryComponentTestsIOS7.m in Sources */, + 2D81121524C103F300984DA7 /* OIDRegistrationResponseTests.m in Sources */, + 2D81120824C103F200984DA7 /* OIDAuthStateTests.m in Sources */, + 2D81121024C103F300984DA7 /* OIDTokenResponseTests.m in Sources */, + 2D81120F24C103F300984DA7 /* OIDTokenRequestTests.m in Sources */, + 2D81120424C1036700984DA7 /* OIDTVAuthorizationRequestTests.m in Sources */, + 2D81120E24C103F300984DA7 /* OIDServiceDiscoveryTests.m in Sources */, + 2D81120A24C103F200984DA7 /* OIDResponseTypesTests.m in Sources */, + 2D81120724C103CC00984DA7 /* OIDAuthorizationResponseTests.m in Sources */, + 2D81121424C103F300984DA7 /* OIDRegistrationRequestTests.m in Sources */, + 2D81120924C103F200984DA7 /* OIDGrantTypesTests.m in Sources */, + 2D81121624C103F300984DA7 /* OIDRPProfileCode.m in Sources */, + 2D81120624C103C800984DA7 /* OIDAuthorizationRequestTests.m in Sources */, + 2D81121124C103F300984DA7 /* OIDTokenUtilitiesTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 2D91B81E249053190005B197 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -2636,6 +2736,11 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + 2D8111FC24C0FD4C00984DA7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2D9385B624B37CAD009A12D7 /* AppAuthTV */; + targetProxy = 2D8111FB24C0FD4C00984DA7 /* PBXContainerItemProxy */; + }; 341741F71C5D8283000EF209 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 340E737B1C5D819B0076B1F6 /* AppAuth-iOS */; @@ -2674,6 +2779,36 @@ /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ + 2D8111FD24C0FD4C00984DA7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + HEADER_SEARCH_PATHS = .; + INFOPLIST_FILE = UnitTests/UnitTestsInfo.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = net.openid.AppAuthTVTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TVOS_DEPLOYMENT_TARGET = 10.1; + }; + name = Debug; + }; + 2D8111FE24C0FD4C00984DA7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + HEADER_SEARCH_PATHS = .; + INFOPLIST_FILE = UnitTests/UnitTestsInfo.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = net.openid.AppAuthTVTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TVOS_DEPLOYMENT_TARGET = 10.1; + }; + name = Release; + }; 2D91B860249053190005B197 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -3475,6 +3610,15 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 2D8111FF24C0FD4D00984DA7 /* Build configuration list for PBXNativeTarget "AppAuthTVTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2D8111FD24C0FD4C00984DA7 /* Debug */, + 2D8111FE24C0FD4C00984DA7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 2D91B85F249053190005B197 /* Build configuration list for PBXNativeTarget "AppAuthEnterpriseUserAgent" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuthTV.xcscheme b/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuthTV.xcscheme index 821dc33b5..fd3849bd6 100644 --- a/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuthTV.xcscheme +++ b/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuthTV.xcscheme @@ -28,7 +28,7 @@ buildForAnalyzing = "NO"> @@ -42,6 +42,16 @@ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> + + + + + +@class OIDTVServiceConfiguration; + +NS_ASSUME_NONNULL_BEGIN + +/*! @brief Unit tests for @c OIDTVAuthorizationRequest. + */ +@interface OIDTVAuthorizationRequestTests : XCTestCase +- (OIDTVServiceConfiguration *)testServiceConfiguration; +- (NSDictionary *)bodyParametersFromURLRequest:(NSURLRequest *)urlRequest; + +/*! @brief Tests the initializer + */ +- (void)testInitializer; + +/*! @brief Tests the @c NSCopying implementation by round-tripping an instance through the copying + * process and checking to make sure the source and destination both contain the + * @c TVAuthorizationEndpoint + */ +- (void)testCopying; + +/*! @brief Tests the @c NSSecureCoding implementation by round-tripping an instance through the + * coding process and checking to make sure the source and destination both contain the + * @c TVAuthorizationEndpoint + */ +- (void)testSecureCoding; + +/*! @brief Tests the @c URLRequest method on a request with no scopes or additional parameters + */ +- (void)testURLRequestBasicClientAuth; + +/*! @brief Tests the @c URLRequest method on a request with two scopes and no additional parameters + */ +- (void)testURLRequestScopes; + +/*! @brief Tests the @c URLRequest method on a request with two scopes and one additional parameter + */ +- (void)testURLRequestAdditionalParams; +@end + +NS_ASSUME_NONNULL_END diff --git a/UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.m b/UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.m new file mode 100644 index 000000000..a533483f2 --- /dev/null +++ b/UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.m @@ -0,0 +1,290 @@ +/*! @file OIDTVAuthorizationRequestTests.m + @brief AppAuth iOS SDK + @copyright + Copyright 2020 Google Inc. All Rights Reserved. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "OIDTVAuthorizationRequestTests.h" +#import "OIDTVAuthorizationRequest.h" +#import "OIDTVServiceConfiguration.h" + +#if SWIFT_PACKAGE +@import AppAuthCore; +#else +#import "Source/AppAuthCore/OIDScopeUtilities.h" +#import "Source/AppAuthCore/OIDURLQueryComponent.h" +#endif + +// Ignore warnings about "Use of GNU statement expression extension" which is raised by our use of +// the XCTAssert___ macros. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wgnu" + +/*! @brief Test value for the @c TVAuthorizationEndpoint property. + */ +static NSString *const kTestTVAuthorizationEndpoint = @"https://www.example.com/device/code"; + +/*! @brief Test value for the @c tokenEndpoint property. + */ +static NSString *const kTestTokenEndpoint = @"https://www.example.com/token"; + +/*! @brief Test key for the @c additionalParameters property. + */ +static NSString *const kTestAdditionalParameterKey = @"A"; + +/*! @brief Test value for the @c additionalParameters property. + */ +static NSString *const kTestAdditionalParameterValue = @"1"; + +/*! @brief Test key for the @c clientID parameter in the HTTP request. + */ +static NSString *const kTestClientIDKey = @"client_id"; + +/*! @brief Test value for the @c clientID property. + */ +static NSString *const kTestClientID = @"ClientID"; + +/*! @brief Test value for the @c clientSecret property. + */ +static NSString *const kTestClientSecret = @"ClientSecret"; + +/*! @brief Test key for the @c scope parameter in the HTTP request. + */ +static NSString *const kTestScopeKey = @"scope"; + +/*! @brief Test value for the @c scope property. + */ +static NSString *const kTestScope = @"Scope"; + +/*! @brief Test value for the @c scope property. + */ +static NSString *const kTestScopeA = @"ScopeA"; + +/*! @brief Expected HTTP Method for the authorization @c URLRequest + */ +static NSString *const kHTTPPost = @"POST"; + +/*! @brief Expected @c ContentType header key for the authorization @c URLRequest + */ +static NSString *const kHTTPContentTypeHeaderKey = @"Content-Type"; + +/*! @brief Expected @c ContentType header value for the authorization @c URLRequest + */ +static NSString *const kHTTPContentTypeHeaderValue = + @"application/x-www-form-urlencoded; charset=UTF-8"; + +@implementation OIDTVAuthorizationRequestTests + +- (OIDTVServiceConfiguration *)testServiceConfiguration { + NSURL *tokenEndpoint = [NSURL URLWithString:kTestTokenEndpoint]; + NSURL *TVAuthorizationEndpoint = [NSURL URLWithString:kTestTVAuthorizationEndpoint]; + + // Pass in an empty authorizationEndpoint since only the TVAuthorizationEndpoint and tokenEndpoint + // are used for the TV authentication flow. + OIDTVServiceConfiguration *configuration = [[OIDTVServiceConfiguration alloc] + initWithAuthorizationEndpoint:[[NSURL alloc] initWithString:@""] + TVAuthorizationEndpoint:TVAuthorizationEndpoint + tokenEndpoint:tokenEndpoint]; + return configuration; +} + +- (NSDictionary *)bodyParametersFromURLRequest:(NSURLRequest *)URLRequest { + NSString *bodyString = [[NSString alloc] initWithData:URLRequest.HTTPBody + encoding:NSUTF8StringEncoding]; + NSArray *bodyParameterStrings = [bodyString componentsSeparatedByString:@"&"]; + + NSMutableDictionary *bodyParameters = [[NSMutableDictionary alloc] init]; + + for (NSString *paramString in bodyParameterStrings) { + NSArray *components = [paramString componentsSeparatedByString:@"="]; + + if (components.count == 2) { + bodyParameters[components[0]] = components[1]; + } + } + + return bodyParameters; +} + +/*! @brief Tests the initializer + */ +- (void)testInitializer { + OIDTVServiceConfiguration *serviceConfiguration = [self testServiceConfiguration]; + NSArray *testScopes = @[ kTestScope, kTestScopeA ]; + NSString *testScopeString = [OIDScopeUtilities scopesWithArray:testScopes]; + NSDictionary *testAdditionalParameters = + @{kTestAdditionalParameterKey : kTestAdditionalParameterValue}; + + OIDTVAuthorizationRequest *authRequest = + [[OIDTVAuthorizationRequest alloc] initWithConfiguration:serviceConfiguration + clientId:kTestClientID + clientSecret:kTestClientSecret + scopes:testScopes + additionalParameters:testAdditionalParameters]; + + NSURL *authRequestTVAuthorizationEndpoint = + ((OIDTVServiceConfiguration *)authRequest.configuration).TVAuthorizationEndpoint; + + XCTAssertEqualObjects(authRequest.clientID, kTestClientID); + XCTAssertEqualObjects(authRequest.clientSecret, kTestClientSecret); + XCTAssertEqualObjects(authRequest.scope, testScopeString); + XCTAssertEqualObjects(authRequest.additionalParameters, testAdditionalParameters); + XCTAssertEqualObjects(authRequest.responseType, OIDResponseTypeCode); + XCTAssertEqualObjects(authRequest.redirectURL, [[NSURL alloc] initWithString:@""]); + XCTAssertEqualObjects(authRequestTVAuthorizationEndpoint, + serviceConfiguration.TVAuthorizationEndpoint); +} + +/*! @brief Tests the @c NSCopying implementation by round-tripping an instance through the copying + * process and checking to make sure the source and destination both contain the + * @c TVAuthorizationEndpoint + */ +- (void)testCopying { + OIDTVServiceConfiguration *serviceConfiguration = [self testServiceConfiguration]; + + OIDTVAuthorizationRequest *authRequest = + [[OIDTVAuthorizationRequest alloc] initWithConfiguration:serviceConfiguration + clientId:kTestClientID + clientSecret:kTestClientSecret + scopes:nil + additionalParameters:nil]; + + OIDTVAuthorizationRequest *authRequestCopy = [authRequest copy]; + NSURL *authRequestCopyTVAuthorizationEndpoint = + ((OIDTVServiceConfiguration *)authRequestCopy.configuration).TVAuthorizationEndpoint; + + XCTAssertEqualObjects(authRequestCopyTVAuthorizationEndpoint, + serviceConfiguration.TVAuthorizationEndpoint); +} + +/*! @brief Tests the @c NSSecureCoding implementation by round-tripping an instance through the + * coding process and checking to make sure the source and destination both contain the + * @c TVAuthorizationEndpoint + */ +- (void)testSecureCoding { + OIDTVServiceConfiguration *serviceConfiguration = [self testServiceConfiguration]; + + OIDTVAuthorizationRequest *authRequest = + [[OIDTVAuthorizationRequest alloc] initWithConfiguration:serviceConfiguration + clientId:kTestClientID + clientSecret:kTestClientSecret + scopes:nil + additionalParameters:nil]; + + NSData *data = [NSKeyedArchiver archivedDataWithRootObject:authRequest]; + OIDTVAuthorizationRequest *authRequestCopy = [NSKeyedUnarchiver unarchiveObjectWithData:data]; + + NSURL *authRequestCopyTVAuthorizationEndpoint = + ((OIDTVServiceConfiguration *)authRequestCopy.configuration).TVAuthorizationEndpoint; + + XCTAssertEqualObjects(authRequestCopyTVAuthorizationEndpoint, + serviceConfiguration.TVAuthorizationEndpoint); +} + +/*! @brief Tests the @c URLRequest method on a request with no scopes or additional parameters + */ +- (void)testURLRequestBasicClientAuth { + OIDTVServiceConfiguration *serviceConfiguration = [self testServiceConfiguration]; + + OIDTVAuthorizationRequest *authRequest = + [[OIDTVAuthorizationRequest alloc] initWithConfiguration:serviceConfiguration + clientId:kTestClientID + clientSecret:kTestClientSecret + scopes:nil + additionalParameters:nil]; + + NSURLRequest *URLRequest = [authRequest URLRequest]; + + XCTAssertEqualObjects(URLRequest.HTTPMethod, kHTTPPost); + XCTAssertEqualObjects([URLRequest valueForHTTPHeaderField:kHTTPContentTypeHeaderKey], + kHTTPContentTypeHeaderValue); + XCTAssertEqualObjects(URLRequest.URL, serviceConfiguration.TVAuthorizationEndpoint); + + NSDictionary *bodyParameters = + [self bodyParametersFromURLRequest:URLRequest]; + NSDictionary *expectedParameters = @{@"client_id" : kTestClientID}; + + XCTAssertEqualObjects(bodyParameters, expectedParameters); +} + +/*! @brief Tests the @c URLRequest method on a request with two scopes and no additional parameters + */ +- (void)testURLRequestScopes { + OIDTVServiceConfiguration *serviceConfiguration = [self testServiceConfiguration]; + NSArray *testScopes = @[ kTestScope, kTestScopeA ]; + NSString *testScopeString = [OIDScopeUtilities scopesWithArray:testScopes]; + NSString *testScopeStringPercentEncoded = [testScopeString + stringByAddingPercentEncodingWithAllowedCharacters:[OIDURLQueryComponent + URLParamValueAllowedCharacters]]; + + OIDTVAuthorizationRequest *authRequest = + [[OIDTVAuthorizationRequest alloc] initWithConfiguration:serviceConfiguration + clientId:kTestClientID + clientSecret:kTestClientSecret + scopes:@[ kTestScope, kTestScopeA ] + additionalParameters:nil]; + + NSURLRequest *URLRequest = [authRequest URLRequest]; + + XCTAssertEqualObjects([URLRequest HTTPMethod], kHTTPPost); + XCTAssertEqualObjects([URLRequest valueForHTTPHeaderField:kHTTPContentTypeHeaderKey], + kHTTPContentTypeHeaderValue); + XCTAssertEqualObjects(URLRequest.URL, serviceConfiguration.TVAuthorizationEndpoint); + + NSDictionary *bodyParameters = + [self bodyParametersFromURLRequest:URLRequest]; + NSDictionary *expectedParameters = + @{kTestClientIDKey : kTestClientID, kTestScopeKey : testScopeStringPercentEncoded}; + + XCTAssertEqualObjects(bodyParameters, expectedParameters); +} + +/*! @brief Tests the @c URLRequest method on a request with two scopes and one additional parameter + */ +- (void)testURLRequestAdditionalParams { + OIDTVServiceConfiguration *serviceConfiguration = [self testServiceConfiguration]; + NSArray *testScopes = @[ kTestScope, kTestScopeA ]; + NSString *testScopeString = [OIDScopeUtilities scopesWithArray:testScopes]; + NSString *testScopeStringPercentEncoded = [testScopeString + stringByAddingPercentEncodingWithAllowedCharacters:[OIDURLQueryComponent + URLParamValueAllowedCharacters]]; + OIDTVAuthorizationRequest *authRequest = [[OIDTVAuthorizationRequest alloc] + initWithConfiguration:serviceConfiguration + clientId:kTestClientID + clientSecret:kTestClientSecret + scopes:@[ kTestScope, kTestScopeA ] + additionalParameters:@{kTestAdditionalParameterKey : kTestAdditionalParameterValue}]; + + NSURLRequest *URLRequest = [authRequest URLRequest]; + + XCTAssertEqualObjects([URLRequest HTTPMethod], kHTTPPost); + XCTAssertEqualObjects([URLRequest valueForHTTPHeaderField:kHTTPContentTypeHeaderKey], + kHTTPContentTypeHeaderValue); + XCTAssertEqualObjects(URLRequest.URL, serviceConfiguration.TVAuthorizationEndpoint); + + NSDictionary *bodyParameters = + [self bodyParametersFromURLRequest:URLRequest]; + NSDictionary *expectedParameters = @{ + kTestClientIDKey : kTestClientID, + kTestScopeKey : testScopeStringPercentEncoded, + kTestAdditionalParameterKey : kTestAdditionalParameterValue + }; + + XCTAssertEqualObjects(bodyParameters, expectedParameters); +} + +@end + +#pragma GCC diagnostic pop From d08724f2b4ed71f2dfb69a7b8671d68282567e0b Mon Sep 17 00:00:00 2001 From: Souleiman Benhida Date: Wed, 29 Jul 2020 15:51:14 -0400 Subject: [PATCH 10/81] Add OIDTVTokenRequest class Adds OIDTVTokenRequest class, which is a subclass of OIDTokenRequest, to better adhere to the [RFC for TV authentication](https://tools.ietf.org/html/rfc8628#section-3.4). This adds the required `device_code` property which is sent in the request body, which differs from the `code` property for the authorization code in the parent class. Additionally, the grant type for TV authorization is hard-coded in, and several unused fields are dropped from the initializer and body request code. --- AppAuth.xcodeproj/project.pbxproj | 8 ++ Source/AppAuthCore/OIDTokenRequest.h | 5 + Source/AppAuthCore/OIDTokenRequest.m | 25 +++-- Source/AppAuthTV/OIDTVTokenRequest.h | 101 ++++++++++++++++++ Source/AppAuthTV/OIDTVTokenRequest.m | 152 +++++++++++++++++++++++++++ 5 files changed, 281 insertions(+), 10 deletions(-) create mode 100644 Source/AppAuthTV/OIDTVTokenRequest.h create mode 100644 Source/AppAuthTV/OIDTVTokenRequest.m diff --git a/AppAuth.xcodeproj/project.pbxproj b/AppAuth.xcodeproj/project.pbxproj index ca5c21628..2b793d994 100644 --- a/AppAuth.xcodeproj/project.pbxproj +++ b/AppAuth.xcodeproj/project.pbxproj @@ -155,6 +155,8 @@ 2D93865024B38840009A12D7 /* OIDTVAuthorizationResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D47AAD8249A87010059B5A4 /* OIDTVAuthorizationResponse.m */; }; 2D93865124B38840009A12D7 /* OIDTVAuthorizationService.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D47AAE0249A87020059B5A4 /* OIDTVAuthorizationService.m */; }; 2D93865224B38840009A12D7 /* OIDTVServiceConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D47AADA249A87010059B5A4 /* OIDTVServiceConfiguration.m */; }; + 2DEB065624CA1D9300DF47E7 /* OIDTVTokenRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DEB065424CA1D9300DF47E7 /* OIDTVTokenRequest.h */; }; + 2DEB065724CA1D9300DF47E7 /* OIDTVTokenRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DEB065524CA1D9300DF47E7 /* OIDTVTokenRequest.m */; }; 340DAE571D5821A100EC285B /* OIDAuthorizationService+Mac.m in Sources */ = {isa = PBXBuildFile; fileRef = 340DAE261D581FE700EC285B /* OIDAuthorizationService+Mac.m */; }; 340DAE581D5821A100EC285B /* OIDExternalUserAgentMac.m in Sources */ = {isa = PBXBuildFile; fileRef = 340DAE281D581FE700EC285B /* OIDExternalUserAgentMac.m */; }; 340DAE591D5821A100EC285B /* OIDAuthState+Mac.m in Sources */ = {isa = PBXBuildFile; fileRef = 340DAE2A1D581FE700EC285B /* OIDAuthState+Mac.m */; }; @@ -770,6 +772,8 @@ 2D9385B724B37CAD009A12D7 /* AppAuthTV.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AppAuthTV.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 2D9385B924B37CAD009A12D7 /* AppAuthTV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppAuthTV.h; sourceTree = ""; }; 2D9385BA24B37CAD009A12D7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 2DEB065424CA1D9300DF47E7 /* OIDTVTokenRequest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OIDTVTokenRequest.h; sourceTree = ""; }; + 2DEB065524CA1D9300DF47E7 /* OIDTVTokenRequest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OIDTVTokenRequest.m; sourceTree = ""; }; 340DAE251D581FE700EC285B /* OIDAuthorizationService+Mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "OIDAuthorizationService+Mac.h"; sourceTree = ""; }; 340DAE261D581FE700EC285B /* OIDAuthorizationService+Mac.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "OIDAuthorizationService+Mac.m"; sourceTree = ""; }; 340DAE271D581FE700EC285B /* OIDExternalUserAgentMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDExternalUserAgentMac.h; sourceTree = ""; }; @@ -1077,6 +1081,8 @@ 2D47AAE0249A87020059B5A4 /* OIDTVAuthorizationService.m */, 2D47AADE249A87020059B5A4 /* OIDTVServiceConfiguration.h */, 2D47AADA249A87010059B5A4 /* OIDTVServiceConfiguration.m */, + 2DEB065424CA1D9300DF47E7 /* OIDTVTokenRequest.h */, + 2DEB065524CA1D9300DF47E7 /* OIDTVTokenRequest.m */, ); path = AppAuthTV; sourceTree = ""; @@ -1415,6 +1421,7 @@ 2D93863524B38827009A12D7 /* OIDRegistrationRequest.h in Headers */, 2D93861D24B38815009A12D7 /* OIDAuthorizationService.h in Headers */, 2D93862B24B38825009A12D7 /* OIDExternalUserAgentRequest.h in Headers */, + 2DEB065624CA1D9300DF47E7 /* OIDTVTokenRequest.h in Headers */, 2D93861A24B3880B009A12D7 /* OIDAuthorizationRequest.h in Headers */, 2D9385DE24B3861E009A12D7 /* AppAuthTV.h in Headers */, 2D9385DF24B38646009A12D7 /* OIDTVAuthorizationRequest.h in Headers */, @@ -2244,6 +2251,7 @@ 2D93863624B38827009A12D7 /* OIDRegistrationRequest.m in Sources */, 2D93863224B38826009A12D7 /* OIDEndSessionRequest.m in Sources */, 2D93864424B38828009A12D7 /* OIDServiceDiscovery.m in Sources */, + 2DEB065724CA1D9300DF47E7 /* OIDTVTokenRequest.m in Sources */, 2D93861C24B38812009A12D7 /* OIDAuthorizationResponse.m in Sources */, 2D93863A24B38827009A12D7 /* OIDIDToken.m in Sources */, 2D93864F24B38840009A12D7 /* OIDTVAuthorizationRequest.m in Sources */, diff --git a/Source/AppAuthCore/OIDTokenRequest.h b/Source/AppAuthCore/OIDTokenRequest.h index 00e0c6e20..399294e8c 100644 --- a/Source/AppAuthCore/OIDTokenRequest.h +++ b/Source/AppAuthCore/OIDTokenRequest.h @@ -152,6 +152,11 @@ NS_ASSUME_NONNULL_BEGIN additionalParameters:(nullable NSDictionary *)additionalParameters NS_DESIGNATED_INITIALIZER; +/*! @brief Designated initializer for NSSecureCoding. + @param aDecoder Unarchiver object to decode + */ +- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER; + /*! @brief Constructs an @c NSURLRequest representing the token request. @return An @c NSURLRequest representing the token request. */ diff --git a/Source/AppAuthCore/OIDTokenRequest.m b/Source/AppAuthCore/OIDTokenRequest.m index bd27dd480..5ed8a17ef 100644 --- a/Source/AppAuthCore/OIDTokenRequest.m +++ b/Source/AppAuthCore/OIDTokenRequest.m @@ -177,16 +177,21 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder { NSDictionary *additionalParameters = [aDecoder decodeObjectOfClasses:additionalParameterCodingClasses forKey:kAdditionalParametersKey]; - self = [self initWithConfiguration:configuration - grantType:grantType - authorizationCode:code - redirectURL:redirectURL - clientID:clientID - clientSecret:clientSecret - scope:scope - refreshToken:refreshToken - codeVerifier:codeVerifier - additionalParameters:additionalParameters]; + + self = [super init]; + if (self) { + _configuration = [configuration copy]; + _grantType = [grantType copy]; + _authorizationCode = [code copy]; + _redirectURL = [redirectURL copy]; + _clientID = [clientID copy]; + _clientSecret = [clientSecret copy]; + _scope = [scope copy]; + _refreshToken = [refreshToken copy]; + _codeVerifier = [codeVerifier copy]; + _additionalParameters = + [[NSDictionary alloc] initWithDictionary:additionalParameters copyItems:YES]; + } return self; } diff --git a/Source/AppAuthTV/OIDTVTokenRequest.h b/Source/AppAuthTV/OIDTVTokenRequest.h new file mode 100644 index 000000000..f62911786 --- /dev/null +++ b/Source/AppAuthTV/OIDTVTokenRequest.h @@ -0,0 +1,101 @@ +/*! @file OIDTVTokenRequest.h + @brief AppAuth iOS SDK + @copyright + Copyright 2020 Google Inc. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#import "OIDTokenRequest.h" + +#import + +@class OIDServiceConfiguration; +@class OIDTVServiceConfiguration; + +NS_ASSUME_NONNULL_BEGIN + +@interface OIDTVTokenRequest : OIDTokenRequest + +/*! @brief The device code received from the authorization server. + @remarks device_code + @see https://tools.ietf.org/html/rfc8628#section-3.4 + */ +@property(nonatomic, readonly) NSString *deviceCode; + +/*! @internal + @brief Unavailable. Please use + @c initWithConfiguration:deviceCode:clientID:clientSecret:additionalParameters: + or @c initWithCoder:. +*/ +- (instancetype)init NS_UNAVAILABLE; + +/*! @internal + @brief Unavailable. Please use + @c initWithConfiguration:deviceCode:clientID:clientSecret:additionalParameters: + or @c initWithCoder:. +*/ +- (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration + grantType:(NSString *)grantType + authorizationCode:(nullable NSString *)code + redirectURL:(nullable NSURL *)redirectURL + clientID:(NSString *)clientID + clientSecret:(nullable NSString *)clientSecret + scopes:(nullable NSArray *)scopes + refreshToken:(nullable NSString *)refreshToken + codeVerifier:(nullable NSString *)codeVerifier + additionalParameters: + (nullable NSDictionary *) + additionalParameters NS_UNAVAILABLE; + +/*! @internal + @brief Unavailable. Please use + @c initWithConfiguration:deviceCode:clientID:clientSecret:additionalParameters: + or @c initWithCoder:. +*/ +- (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration + grantType:(NSString *)grantType + authorizationCode:(nullable NSString *)code + redirectURL:(nullable NSURL *)redirectURL + clientID:(NSString *)clientID + clientSecret:(nullable NSString *)clientSecret + scope:(nullable NSString *)scope + refreshToken:(nullable NSString *)refreshToken + codeVerifier:(nullable NSString *)codeVerifier + additionalParameters: + (nullable NSDictionary *) + additionalParameters NS_UNAVAILABLE; + +/*! @brief Designated initializer. + @param configuration The service's configuration. + @param deviceCode The device verification code received from the authorization server. + @param clientID The client identifier. + @param clientSecret The client secret (nullable). + @param additionalParameters The client's additional token request parameters. +*/ +- (instancetype)initWithConfiguration:(OIDTVServiceConfiguration *)configuration + deviceCode:(NSString *)deviceCode + clientID:(NSString *)clientID + clientSecret:(nullable NSString *)clientSecret + additionalParameters:(nullable NSDictionary *) + additionalParameters + NS_DESIGNATED_INITIALIZER; + +/*! @brief Designated initializer for NSSecureCoding. + @param aDecoder Unarchiver object to decode + */ +- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Source/AppAuthTV/OIDTVTokenRequest.m b/Source/AppAuthTV/OIDTVTokenRequest.m new file mode 100644 index 000000000..88874a817 --- /dev/null +++ b/Source/AppAuthTV/OIDTVTokenRequest.m @@ -0,0 +1,152 @@ +/*! @file OIDTVTokenRequest.m + @brief AppAuth iOS SDK + @copyright + Copyright 2020 Google Inc. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#import "OIDTVTokenRequest.h" + +#import "OIDDefines.h" +#import "OIDTVServiceConfiguration.h" +#import "OIDURLQueryComponent.h" + +/*! @brief The key for the @c deviceCode property for @c NSSecureCoding and request body. + */ +static NSString *const kDeviceCodeKey = @"device_code"; + +/*! @brief Key used to encode the @c grantType property for @c NSSecureCoding and request body. + */ +static NSString *const kGrantTypeKey = @"grant_type"; + +/*! @brief Value for @c grant_type key in the request body + @see https://tools.ietf.org/html/rfc8628#section-3.4 + */ +static NSString *const kOIDTVDeviceTokenGrantType = @"urn:ietf:params:oauth:grant-type:device_code"; + +@implementation OIDTVTokenRequest + +- (instancetype)init OID_UNAVAILABLE_USE_INITIALIZER(@selector + (initWithConfiguration: + deviceCode: + clientID: + clientSecret: + additionalParameters: + )) + +- (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration + grantType:(NSString *)grantType + authorizationCode:(nullable NSString *)code + redirectURL:(nullable NSURL *)redirectURL + clientID:(NSString *)clientID + clientSecret:(nullable NSString *)clientSecret + scopes:(nullable NSArray *)scopes + refreshToken:(nullable NSString *)refreshToken + codeVerifier:(nullable NSString *)codeVerifier + additionalParameters: + (nullable NSDictionary *)additionalParameters + OID_UNAVAILABLE_USE_INITIALIZER(@selector + (initWithConfiguration: + deviceCode: + clientID: + clientSecret: + additionalParameters: + )) + +- (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration + grantType:(NSString *)grantType + authorizationCode:(nullable NSString *)code + redirectURL:(nullable NSURL *)redirectURL + clientID:(NSString *)clientID + clientSecret:(nullable NSString *)clientSecret + scope:(nullable NSString *)scope + refreshToken:(nullable NSString *)refreshToken + codeVerifier:(nullable NSString *)codeVerifier + additionalParameters: + (nullable NSDictionary *)additionalParameters + OID_UNAVAILABLE_USE_INITIALIZER(@selector + (initWithConfiguration: + deviceCode: + clientID: + clientSecret: + additionalParameters: + )) + +- (instancetype)initWithConfiguration:(OIDTVServiceConfiguration *)configuration + deviceCode:(NSString *)deviceCode + clientID:(NSString *)clientID + clientSecret:(NSString *)clientSecret + additionalParameters:(NSDictionary *)additionalParameters { + self = [super initWithConfiguration:configuration + grantType:kOIDTVDeviceTokenGrantType + authorizationCode:nil + redirectURL:[[NSURL alloc] initWithString:@""] + clientID:clientID + clientSecret:clientSecret + scope:nil + refreshToken:nil + codeVerifier:nil + additionalParameters:additionalParameters]; + + if (self) { + _deviceCode = [deviceCode copy]; + } + return self; +} + +#pragma mark - NSCopying + +- (instancetype)copyWithZone:(nullable NSZone *)zone { + // The documentation for NSCopying specifically advises us to return a reference to the original + // instance in the case where instances are immutable (as ours is): + // "Implement NSCopying by retaining the original instead of creating a new copy when the class + // and its contents are immutable." + return self; +} + +#pragma mark - NSSecureCoding + ++ (BOOL)supportsSecureCoding { + return YES; +} + +- (instancetype)initWithCoder:(NSCoder *)aDecoder { + self = [super initWithCoder:aDecoder]; + if (self) { + NSString *deviceCode = [aDecoder decodeObjectOfClass:[NSString class] forKey:kDeviceCodeKey]; + _deviceCode = deviceCode; + } + return self; +} + +- (void)encodeWithCoder:(NSCoder *)aCoder { + [super encodeWithCoder:aCoder]; + [aCoder encodeObject:_deviceCode forKey:kDeviceCodeKey]; +} + +- (OIDURLQueryComponent *)tokenRequestBody { + OIDURLQueryComponent *query = [[OIDURLQueryComponent alloc] init]; + + if (self.grantType) { + [query addParameter:kGrantTypeKey value:self.grantType]; + } + + [query addParameter:kDeviceCodeKey value:self.deviceCode]; + + [query addParameters:self.additionalParameters]; + + return query; +} + +@end From da5642aad73ab6461ecb1dfd02cc7301879ca308 Mon Sep 17 00:00:00 2001 From: Souleiman Benhida Date: Fri, 31 Jul 2020 14:58:23 -0400 Subject: [PATCH 11/81] Add OIDTVTokenRequest tests --- AppAuth.xcodeproj/project.pbxproj | 8 + UnitTests/AppAuthTV/OIDTVTokenRequestTests.h | 51 +++++ UnitTests/AppAuthTV/OIDTVTokenRequestTests.m | 194 +++++++++++++++++++ 3 files changed, 253 insertions(+) create mode 100644 UnitTests/AppAuthTV/OIDTVTokenRequestTests.h create mode 100644 UnitTests/AppAuthTV/OIDTVTokenRequestTests.m diff --git a/AppAuth.xcodeproj/project.pbxproj b/AppAuth.xcodeproj/project.pbxproj index 2b793d994..555dc647c 100644 --- a/AppAuth.xcodeproj/project.pbxproj +++ b/AppAuth.xcodeproj/project.pbxproj @@ -157,6 +157,8 @@ 2D93865224B38840009A12D7 /* OIDTVServiceConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D47AADA249A87010059B5A4 /* OIDTVServiceConfiguration.m */; }; 2DEB065624CA1D9300DF47E7 /* OIDTVTokenRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DEB065424CA1D9300DF47E7 /* OIDTVTokenRequest.h */; }; 2DEB065724CA1D9300DF47E7 /* OIDTVTokenRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DEB065524CA1D9300DF47E7 /* OIDTVTokenRequest.m */; }; + 2DEB066124CF5CE000DF47E7 /* OIDTVTokenRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DEB066024CF5CE000DF47E7 /* OIDTVTokenRequestTests.m */; }; + 2DEB066224CF5CFB00DF47E7 /* OIDTVTokenRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DEB066024CF5CE000DF47E7 /* OIDTVTokenRequestTests.m */; }; 340DAE571D5821A100EC285B /* OIDAuthorizationService+Mac.m in Sources */ = {isa = PBXBuildFile; fileRef = 340DAE261D581FE700EC285B /* OIDAuthorizationService+Mac.m */; }; 340DAE581D5821A100EC285B /* OIDExternalUserAgentMac.m in Sources */ = {isa = PBXBuildFile; fileRef = 340DAE281D581FE700EC285B /* OIDExternalUserAgentMac.m */; }; 340DAE591D5821A100EC285B /* OIDAuthState+Mac.m in Sources */ = {isa = PBXBuildFile; fileRef = 340DAE2A1D581FE700EC285B /* OIDAuthState+Mac.m */; }; @@ -774,6 +776,8 @@ 2D9385BA24B37CAD009A12D7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 2DEB065424CA1D9300DF47E7 /* OIDTVTokenRequest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OIDTVTokenRequest.h; sourceTree = ""; }; 2DEB065524CA1D9300DF47E7 /* OIDTVTokenRequest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OIDTVTokenRequest.m; sourceTree = ""; }; + 2DEB065F24CF5CDF00DF47E7 /* OIDTVTokenRequestTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDTVTokenRequestTests.h; sourceTree = ""; }; + 2DEB066024CF5CE000DF47E7 /* OIDTVTokenRequestTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OIDTVTokenRequestTests.m; sourceTree = ""; }; 340DAE251D581FE700EC285B /* OIDAuthorizationService+Mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "OIDAuthorizationService+Mac.h"; sourceTree = ""; }; 340DAE261D581FE700EC285B /* OIDAuthorizationService+Mac.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "OIDAuthorizationService+Mac.m"; sourceTree = ""; }; 340DAE271D581FE700EC285B /* OIDExternalUserAgentMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDExternalUserAgentMac.h; sourceTree = ""; }; @@ -1092,6 +1096,8 @@ children = ( 2D81120324C1036700984DA7 /* OIDTVAuthorizationRequestTests.h */, 2D81120024C1036700984DA7 /* OIDTVAuthorizationRequestTests.m */, + 2DEB065F24CF5CDF00DF47E7 /* OIDTVTokenRequestTests.h */, + 2DEB066024CF5CE000DF47E7 /* OIDTVTokenRequestTests.m */, ); path = AppAuthTV; sourceTree = ""; @@ -2184,6 +2190,7 @@ files = ( 2D81120C24C103F300984DA7 /* OIDScopesTests.m in Sources */, 2D81121224C103F300984DA7 /* OIDURLQueryComponentTests.m in Sources */, + 2DEB066224CF5CFB00DF47E7 /* OIDTVTokenRequestTests.m in Sources */, 2D81120D24C103F300984DA7 /* OIDServiceConfigurationTests.m in Sources */, 2D81121324C103F300984DA7 /* OIDURLQueryComponentTestsIOS7.m in Sources */, 2D81121524C103F300984DA7 /* OIDRegistrationResponseTests.m in Sources */, @@ -2340,6 +2347,7 @@ 340DAECB1D582DE100EC285B /* OIDAuthorizationService+IOS.m in Sources */, 341741E31C5D8243000EF209 /* OIDResponseTypes.m in Sources */, 341741E41C5D8243000EF209 /* OIDScopes.m in Sources */, + 2DEB066124CF5CE000DF47E7 /* OIDTVTokenRequestTests.m in Sources */, 341741E71C5D8243000EF209 /* OIDServiceDiscovery.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/UnitTests/AppAuthTV/OIDTVTokenRequestTests.h b/UnitTests/AppAuthTV/OIDTVTokenRequestTests.h new file mode 100644 index 000000000..1f6eecbdc --- /dev/null +++ b/UnitTests/AppAuthTV/OIDTVTokenRequestTests.h @@ -0,0 +1,51 @@ +/*! @file OIDTVTokenRequestTests.h + @brief AppAuth iOS SDK + @copyright + Copyright 2020 Google Inc. All Rights Reserved. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import + +@class OIDTVTokenRequest; + +NS_ASSUME_NONNULL_BEGIN + +/*! @brief Unit tests for @c OIDTVTokenRequest. + */ +@interface OIDTVTokenRequestTests : XCTestCase + +/*! @brief Tests the initializer +*/ +- (void)testInitializer; + +/*! @brief Tests the @c NSCopying implementation by round-tripping an instance through the copying + * process and checking to make sure the source and destination both contain the @c deviceCode. + */ +- (void)testCopying; + +/*! @brief Tests the @c NSSecureCoding implementation by round-tripping an instance through the + * coding process and checking to make sure the source and destination both contain the + * @c deviceCode + */ +- (void)testSecureCoding; + +/*! @brief Tests the @c URLRequest method to verify that the body parameters include the correct + * grant type, device code and additional parameters. + */ +- (void)testURLRequest; + +@end + +NS_ASSUME_NONNULL_END diff --git a/UnitTests/AppAuthTV/OIDTVTokenRequestTests.m b/UnitTests/AppAuthTV/OIDTVTokenRequestTests.m new file mode 100644 index 000000000..2ccb524c8 --- /dev/null +++ b/UnitTests/AppAuthTV/OIDTVTokenRequestTests.m @@ -0,0 +1,194 @@ +/*! @file OIDTVTokenRequestTests.m + @brief AppAuth iOS SDK + @copyright + Copyright 2020 Google Inc. All Rights Reserved. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "OIDTVTokenRequestTests.h" + +#if SWIFT_PACKAGE +@import AppAuthTV; +#else +#import "Source/AppAuthCore/OIDScopeUtilities.h" +#import "Source/AppAuthTV/OIDTVAuthorizationRequest.h" +#import "Source/AppAuthTV/OIDTVAuthorizationResponse.h" +#import "Source/AppAuthTV/OIDTVServiceConfiguration.h" +#import "Source/AppAuthTV/OIDTVTokenRequest.h" +#endif + +// Ignore warnings about "Use of GNU statement expression extension" which is +// raised by our use of the XCTAssert___ macros. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wgnu" + +/*! @brief Test value for the @c TVAuthorizationEndpoint property. + */ +static NSString *const kTestTVAuthorizationEndpoint = + @"https://www.example.com/device/code"; + +/*! @brief Test value for the @c tokenEndpoint property. + */ +static NSString *const kTestTokenEndpoint = @"https://www.example.com/token"; + +/*! @brief Test key for the @c additionalParameters property. + */ +static NSString *const kTestAdditionalParameterKey = @"A"; + +/*! @brief Test value for the @c additionalParameters property. + */ +static NSString *const kTestAdditionalParameterValue = @"1"; + +/*! @brief Test key for the @c clientID parameter in the HTTP request. + */ +static NSString *const kTestClientIDKey = @"client_id"; + +/*! @brief Test value for the @c clientID property. + */ +static NSString *const kTestClientID = @"ClientID"; + +/*! @brief Test value for the @c clientSecret property. + */ +static NSString *const kTestClientSecret = @"ClientSecret"; + +/*! @brief Key for the @c deviceCode property for @c NSSecureCoding and the HTTP request body. + */ +static NSString *const kDeviceCodeKey = @"device_code"; + +/*! @brief Value for the @c deviceCode key in the HTTP request body. + */ +static NSString *const kDeviceCodeValue = @"DeviceCode"; + +/*! @brief Key for the @c grantType property for @c NSSecureCoding and the HTTP request body. + */ +static NSString *const kGrantTypeKey = @"grant_type"; + +/*! @brief Value for the @c grant_type key in the HTTP request body + * @see https://tools.ietf.org/html/rfc8628#section-3.4 + */ +static NSString *const kOIDTVDeviceTokenGrantType = + @"urn:ietf:params:oauth:grant-type:device_code"; + +@implementation OIDTVTokenRequestTests + +- (NSDictionary *)bodyParametersFromURLRequest: + (NSURLRequest *)URLRequest { + NSString *bodyString = [[NSString alloc] initWithData:URLRequest.HTTPBody + encoding:NSUTF8StringEncoding]; + NSArray *bodyParameterStrings = + [bodyString componentsSeparatedByString:@"&"]; + + NSMutableDictionary *bodyParameters = + [[NSMutableDictionary alloc] init]; + + for (NSString *paramString in bodyParameterStrings) { + NSArray *components = + [paramString componentsSeparatedByString:@"="]; + + if (components.count == 2) { + bodyParameters[components[0]] = components[1]; + } + } + + return bodyParameters; +} + +- (OIDTVServiceConfiguration *)testServiceConfiguration { + NSURL *tokenEndpoint = [NSURL URLWithString:kTestTokenEndpoint]; + NSURL *TVAuthorizationEndpoint = [NSURL URLWithString:kTestTVAuthorizationEndpoint]; + + // Pass in an empty authorizationEndpoint since only the + // TVAuthorizationEndpoint and tokenEndpoint are used for the TV + // authentication flow. + OIDTVServiceConfiguration *configuration = [[OIDTVServiceConfiguration alloc] + initWithAuthorizationEndpoint:[[NSURL alloc] initWithString:@""] + TVAuthorizationEndpoint:TVAuthorizationEndpoint + tokenEndpoint:tokenEndpoint]; + return configuration; +} + +- (OIDTVTokenRequest *)testTokenRequest { + OIDTVServiceConfiguration *service = [self testServiceConfiguration]; + return [[OIDTVTokenRequest alloc] + initWithConfiguration:service + deviceCode:kDeviceCodeValue + clientID:kTestClientID + clientSecret:kTestClientSecret + additionalParameters:@{kTestAdditionalParameterKey : kTestAdditionalParameterValue}]; +} + +/*! @brief Tests the initializer +*/ +- (void)testInitializer { + OIDTVTokenRequest *request = [self testTokenRequest]; + NSURL *requestTVAuthorizationEndpoint = + ((OIDTVServiceConfiguration *)request.configuration).TVAuthorizationEndpoint; + + XCTAssertEqualObjects(requestTVAuthorizationEndpoint, + [self testServiceConfiguration].TVAuthorizationEndpoint); + XCTAssertEqualObjects(request.deviceCode, kDeviceCodeValue); + XCTAssertEqualObjects(request.grantType, kOIDTVDeviceTokenGrantType); + XCTAssertEqualObjects(request.clientID, kTestClientID); + XCTAssertEqualObjects(request.clientSecret, kTestClientSecret); + XCTAssertEqualObjects(request.additionalParameters, + @{kTestAdditionalParameterKey:kTestAdditionalParameterValue}); +} + +/*! @brief Tests the @c NSCopying implementation by round-tripping an instance through the copying + * process and checking to make sure the source and destination both contain the @c deviceCode. + */ +- (void)testCopying { + OIDTVTokenRequest *request = [self testTokenRequest]; + OIDTVTokenRequest *requestCopy = [request copy]; + + XCTAssertEqualObjects(requestCopy.deviceCode, request.deviceCode); +} + +/*! @brief Tests the @c NSSecureCoding implementation by round-tripping an instance through the + * coding process and checking to make sure the source and destination both contain the + * @c deviceCode + */ +- (void)testSecureCoding { + OIDTVTokenRequest *request = [self testTokenRequest]; + NSData *data = [NSKeyedArchiver archivedDataWithRootObject:request]; + OIDTVTokenRequest *requestDecoded = [NSKeyedUnarchiver unarchiveObjectWithData:data]; + XCTAssertEqualObjects(requestDecoded.deviceCode, request.deviceCode); +} + +/*! @brief Tests the @c URLRequest method to verify that the body parameters include the correct + * grant type, device code and additional parameters. + */ +- (void)testURLRequest { + OIDTVTokenRequest *request = [self testTokenRequest]; + + NSURLRequest *URLRequest = [request URLRequest]; + + NSDictionary *bodyParameters = + [self bodyParametersFromURLRequest:URLRequest]; + + // Since clientSecret is present, we will not need to check for client_id + // as that will be passed in using HTTP Basic Authentication + + NSDictionary *expectedParameters = @{ + kGrantTypeKey : kOIDTVDeviceTokenGrantType, + kDeviceCodeKey : kDeviceCodeValue, + kTestAdditionalParameterKey : kTestAdditionalParameterValue + }; + + XCTAssertEqualObjects(bodyParameters, expectedParameters); +} + +@end + +#pragma GCC diagnostic pop From 85cb334859a687b7aa2f672e211a4064d0b1f5c6 Mon Sep 17 00:00:00 2001 From: Souleiman Benhida Date: Wed, 5 Aug 2020 14:44:03 -0400 Subject: [PATCH 12/81] Update for RFC compliance, use new OIDTVTokenRequest class --- AppAuth.podspec | 2 +- Source/AppAuthTV/OIDTVAuthorizationRequest.m | 4 +- Source/AppAuthTV/OIDTVAuthorizationResponse.h | 32 +++++----- Source/AppAuthTV/OIDTVAuthorizationResponse.m | 59 +++++++++++-------- Source/AppAuthTV/OIDTVAuthorizationService.h | 2 +- Source/AppAuthTV/OIDTVAuthorizationService.m | 11 +++- Source/AppAuthTV/OIDTVServiceConfiguration.h | 6 +- Source/AppAuthTV/OIDTVServiceConfiguration.m | 14 ++--- Source/AppAuthTV/OIDTVTokenRequest.h | 12 ++-- .../OIDTVAuthorizationRequestTests.m | 9 +-- UnitTests/AppAuthTV/OIDTVTokenRequestTests.m | 10 +--- 11 files changed, 86 insertions(+), 75 deletions(-) diff --git a/AppAuth.podspec b/AppAuth.podspec index c34fc79f3..d4191ad79 100644 --- a/AppAuth.podspec +++ b/AppAuth.podspec @@ -70,7 +70,7 @@ It follows the OAuth 2.0 for Native Apps best current practice # Subspec for the full AppAuth library, including platform-dependant external user agents. s.subspec 'TV' do |tv| - tv.source_files = "Source/AppAuthTV/*.{h,m}" + tv.source_files = "Source/AppAuthTV.h", "Source/AppAuthTV/*.{h,m}" tv.dependency 'AppAuth/Core' end diff --git a/Source/AppAuthTV/OIDTVAuthorizationRequest.m b/Source/AppAuthTV/OIDTVAuthorizationRequest.m index 4afae8cd8..5d085beb2 100644 --- a/Source/AppAuthTV/OIDTVAuthorizationRequest.m +++ b/Source/AppAuthTV/OIDTVAuthorizationRequest.m @@ -66,9 +66,9 @@ @implementation OIDTVAuthorizationRequest clientId:clientID clientSecret:clientSecret scopes:scopes - redirectURL:[[NSURL alloc] init] + redirectURL:[[NSURL alloc] initWithString:@""] responseType:OIDResponseTypeCode - additionalParameters:additionalParameters]; + additionalParameters:additionalParameters]; } #pragma mark - NSObject overrides diff --git a/Source/AppAuthTV/OIDTVAuthorizationResponse.h b/Source/AppAuthTV/OIDTVAuthorizationResponse.h index cb4793c59..d3bed1e97 100644 --- a/Source/AppAuthTV/OIDTVAuthorizationResponse.h +++ b/Source/AppAuthTV/OIDTVAuthorizationResponse.h @@ -21,27 +21,27 @@ #import "OIDAuthorizationResponse.h" @class OIDTVAuthorizationRequest; -@class OIDTokenRequest; +@class OIDTVTokenRequest; NS_ASSUME_NONNULL_BEGIN -/*! @brief The @c grant_type value for the the TV authorization flow. - @see https://tools.ietf.org/html/rfc8628#section-3.4 - */ -extern NSString *const OIDTVDeviceTokenGrantType; - /*! @brief Represents the response to a TV authorization request. @see https://tools.ietf.org/html/rfc8628#section-3.5 */ @interface OIDTVAuthorizationResponse : OIDAuthorizationResponse -/*! @brief The verification URL that should be displayed to the user instructing them to visit the - URL and enter the code. - @remarks verification_url +/*! @brief The verification URI that should be displayed to the user instructing them to visit the + URI and enter the code. + @remarks verification_uri + */ +@property(nonatomic, readonly, nullable) NSString *verificationURI; + +/*! @brief A complete verification URI to allow for verification without entering the user code. + @remarks verification_uri */ -@property(nonatomic, readonly, nullable) NSString *verificationURL; +@property(nonatomic, readonly, nullable) NSString *verificationURIComplete; -/*! @brief The code that should be displayed to the user which they enter at the @c verificationURL. +/*! @brief The code that should be displayed to the user which they enter at the @c verificationURI. @remarks user_code */ @property(nonatomic, readonly, nullable) NSString *userCode; @@ -70,21 +70,21 @@ extern NSString *const OIDTVDeviceTokenGrantType; @c #additionalParameters dictionary. */ - (instancetype)initWithRequest:(OIDTVAuthorizationRequest *)request - parameters:(NSDictionary *> *)parameters + parameters:(NSDictionary *> *)parameters NS_DESIGNATED_INITIALIZER; /*! @brief Creates a token request suitable for polling the token endpoint with the @c deviceCode. - @return A @c OIDTokenRequest suitable for polling the token endpoint. + @return A @c OIDTVTokenRequest suitable for polling the token endpoint. @see https://tools.ietf.org/html/rfc8628#section-3.4 */ -- (nullable OIDTokenRequest *)tokenPollRequest; +- (nullable OIDTVTokenRequest *)tokenPollRequest; /*! @brief Creates a token request suitable for polling the token endpoint with the @c deviceCode. @param additionalParameters Additional parameters for the token request. - @return A @c OIDTokenRequest suitable for polling the token endpoint. + @return A @c OIDTVTokenRequest suitable for polling the token endpoint. @see https://tools.ietf.org/html/rfc8628#section-3.4 */ -- (nullable OIDTokenRequest *)tokenPollRequestWithAdditionalParameters: +- (nullable OIDTVTokenRequest *)tokenPollRequestWithAdditionalParameters: (nullable NSDictionary *)additionalParameters; @end diff --git a/Source/AppAuthTV/OIDTVAuthorizationResponse.m b/Source/AppAuthTV/OIDTVAuthorizationResponse.m index 6a0110baa..71b9e8f04 100644 --- a/Source/AppAuthTV/OIDTVAuthorizationResponse.m +++ b/Source/AppAuthTV/OIDTVAuthorizationResponse.m @@ -20,16 +20,26 @@ #import "OIDDefines.h" #import "OIDFieldMapping.h" -#import "OIDTokenRequest.h" +#import "OIDTVTokenRequest.h" #import "OIDTVAuthorizationRequest.h" -NSString *const OIDTVDeviceTokenGrantType = @"http://oauth.net/grant_type/device/1.0"; +/*! @brief The key for the @c verificationURI property in the incoming parameters and for + @c NSSecureCoding. + */ +static NSString *const kVerificationURIKey = @"verification_uri"; -/*! @brief The key for the @c verificationURL property in the incoming parameters and for +/*! @brief An alternative key for the @c verificationURI property in the incoming parameters and for + @c NSSecureCoding. If "verification_uri" is not found in the response, a "verification_url" + key is considered equivalent. This is included for compatibility with legacy implementations + and should ideally be removed in the future. + */ +static NSString *const kVerificationURIAlternativeKey = @"verification_url"; + +/*! @brief The key for the @c verificationURIComplete property in the incoming parameters and for @c NSSecureCoding. */ -static NSString *const kVerificationURLKey = @"verification_url"; +static NSString *const kVerificationURICompleteKey = @"verification_uri_complete"; /*! @brief The key for the @c userCode property in the incoming parameters and for @c NSSecureCoding. @@ -69,8 +79,10 @@ @implementation OIDTVAuthorizationResponse static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ fieldMap = [NSMutableDictionary dictionary]; - fieldMap[kVerificationURLKey] = - [[OIDFieldMapping alloc] initWithName:@"_verificationURL" type:[NSString class]]; + fieldMap[kVerificationURIKey] = + [[OIDFieldMapping alloc] initWithName:@"_verificationURI" type:[NSString class]]; + fieldMap[kVerificationURICompleteKey] = + [[OIDFieldMapping alloc] initWithName:@"_verificationURIComplete" type:[NSString class]]; fieldMap[kUserCodeKey] = [[OIDFieldMapping alloc] initWithName:@"_userCode" type:[NSString class]]; fieldMap[kDeviceCodeKey] = @@ -87,6 +99,11 @@ @implementation OIDTVAuthorizationResponse }]; fieldMap[kIntervalKey] = [[OIDFieldMapping alloc] initWithName:@"_interval" type:[NSNumber class]]; + + // Map the alternative verification URI key to "_verificationURI" to support legacy + // implementations using the alternative key + fieldMap[kVerificationURIAlternativeKey] = + [[OIDFieldMapping alloc] initWithName:@"_verificationURI" type:[NSString class]]; }); return fieldMap; } @@ -94,7 +111,7 @@ @implementation OIDTVAuthorizationResponse #pragma mark - Initializers - (instancetype)initWithRequest:(OIDTVAuthorizationRequest *)request - parameters:(NSDictionary *> *)parameters { + parameters:(NSDictionary *> *)parameters { self = [super initWithRequest:request parameters:parameters]; return self; } @@ -112,13 +129,15 @@ - (instancetype)copyWithZone:(nullable NSZone *)zone { #pragma mark - NSObject overrides - (NSString *)description { - return [NSString stringWithFormat:@"<%@: %p, verificationURL: %@, userCode: \"%@\", deviceCode: " + return [NSString stringWithFormat:@"<%@: %p, verificationURI: %@, verificationURIComplete: %@, " + "userCode: \"%@\", deviceCode: " "\"%@\", interval: %@, expirationDate: %@, " "additionalParameters: %@, " "request: %@>", NSStringFromClass([self class]), (void *)self, - _verificationURL, + _verificationURI, + _verificationURIComplete, _userCode, _deviceCode, _interval, @@ -129,24 +148,18 @@ - (NSString *)description { #pragma mark - -- (OIDTokenRequest *)tokenPollRequest { +- (OIDTVTokenRequest *)tokenPollRequest { return [self tokenPollRequestWithAdditionalParameters:nil]; } -- (OIDTokenRequest *)tokenPollRequestWithAdditionalParameters: +- (OIDTVTokenRequest *)tokenPollRequestWithAdditionalParameters: (NSDictionary *)additionalParameters { - OIDTokenRequest *pollRequest = - [[OIDTokenRequest alloc] initWithConfiguration:self.request.configuration - grantType:OIDTVDeviceTokenGrantType - authorizationCode:_deviceCode - redirectURL:[[NSURL alloc] init] - clientID:self.request.clientID - clientSecret:self.request.clientSecret - scopes:nil - refreshToken:nil - codeVerifier:nil - additionalParameters:nil]; - return pollRequest; + return [[OIDTVTokenRequest alloc] + initWithConfiguration:(OIDTVServiceConfiguration *)self.request.configuration + deviceCode:_deviceCode + clientID:self.request.clientID + clientSecret:self.request.clientSecret + additionalParameters:additionalParameters]; } @end diff --git a/Source/AppAuthTV/OIDTVAuthorizationService.h b/Source/AppAuthTV/OIDTVAuthorizationService.h index 14027bc09..2a9bfe571 100644 --- a/Source/AppAuthTV/OIDTVAuthorizationService.h +++ b/Source/AppAuthTV/OIDTVAuthorizationService.h @@ -27,7 +27,7 @@ NS_ASSUME_NONNULL_BEGIN /*! @brief The block that is called when the TV authorization has initialized. @param response The authorization response, or nil if there was an error. Display - @c OIDTVAuthorizationResponse.userCode and @c OIDTVAuthorizationResponse.verificationURL to + @c OIDTVAuthorizationResponse.userCode and @c OIDTVAuthorizationResponse.verificationURI to the user so they can action the request. @param error The error if an error occurred. */ diff --git a/Source/AppAuthTV/OIDTVAuthorizationService.m b/Source/AppAuthTV/OIDTVAuthorizationService.m index fed16a938..944d722df 100644 --- a/Source/AppAuthTV/OIDTVAuthorizationService.m +++ b/Source/AppAuthTV/OIDTVAuthorizationService.m @@ -27,6 +27,7 @@ #import "OIDTVAuthorizationRequest.h" #import "OIDTVAuthorizationResponse.h" #import "OIDTVServiceConfiguration.h" +#import "OIDTVTokenRequest.h" /*! @brief The authorization pending error code. @see https://tools.ietf.org/html/rfc8628#section-3.5 @@ -159,11 +160,19 @@ + (OIDTVAuthorizationCancelBlock)authorizeTVRequest:(OIDTVAuthorizationRequest * }); // Creates the token request that will be used to poll the token endpoint. - OIDTokenRequest *pollRequest = [TVAuthorizationResponse tokenPollRequest]; + OIDTVTokenRequest *pollRequest = [TVAuthorizationResponse tokenPollRequest]; // Starting polling interval (may be increased if a slow down message is received). __block NSTimeInterval interval = [TVAuthorizationResponse.interval doubleValue]; + // If no interval is set, use default value of 5 as per RFC. + // If interval is set to 0, use value of 1 to prevent infinite polling. + if (TVAuthorizationResponse.interval == nil) { + interval = 5.0; + } else if (interval == 0.0) { + interval = 1.0; + } + // Polls the token endpoint until the authorization completes or expires. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ do { diff --git a/Source/AppAuthTV/OIDTVServiceConfiguration.h b/Source/AppAuthTV/OIDTVServiceConfiguration.h index 2b6b29093..b3d60e748 100644 --- a/Source/AppAuthTV/OIDTVServiceConfiguration.h +++ b/Source/AppAuthTV/OIDTVServiceConfiguration.h @@ -48,13 +48,11 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithDiscoveryDocument:(OIDServiceDiscovery *)discoveryDocument NS_UNAVAILABLE; /*! @brief Designated initializer. - @param authorizationEndpoint The authorization endpoint URI. @param TVAuthorizationEndpoint The TV authorization endpoint URI. @param tokenEndpoint The token exchange and refresh endpoint URI. */ -- (instancetype)initWithAuthorizationEndpoint:(NSURL *)authorizationEndpoint - TVAuthorizationEndpoint:(NSURL *)TVAuthorizationEndpoint - tokenEndpoint:(NSURL *)tokenEndpoint NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithTVAuthorizationEndpoint:(NSURL *)TVAuthorizationEndpoint + tokenEndpoint:(NSURL *)tokenEndpoint NS_DESIGNATED_INITIALIZER; @end diff --git a/Source/AppAuthTV/OIDTVServiceConfiguration.m b/Source/AppAuthTV/OIDTVServiceConfiguration.m index edd53962c..0198475c3 100644 --- a/Source/AppAuthTV/OIDTVServiceConfiguration.m +++ b/Source/AppAuthTV/OIDTVServiceConfiguration.m @@ -38,18 +38,16 @@ - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIAL @implementation OIDTVServiceConfiguration - (instancetype)init - OID_UNAVAILABLE_USE_INITIALIZER( - @selector(initWithAuthorizationEndpoint:TVAuthorizationEndpoint:tokenEndpoint:)) + OID_UNAVAILABLE_USE_INITIALIZER(@selector(initWithTVAuthorizationEndpoint:tokenEndpoint:)) - (instancetype)initWithAuthorizationEndpoint:(NSURL *)authorizationEndpoint tokenEndpoint:(NSURL *)tokenEndpoint - OID_UNAVAILABLE_USE_INITIALIZER( - @selector(initWithAuthorizationEndpoint:TVAuthorizationEndpoint:tokenEndpoint:)) + OID_UNAVAILABLE_USE_INITIALIZER(@selector(initWithTVAuthorizationEndpoint:tokenEndpoint:)) -- (instancetype)initWithAuthorizationEndpoint:(NSURL *)authorizationEndpoint - TVAuthorizationEndpoint:(NSURL *)TVAuthorizationEndpoint - tokenEndpoint:(NSURL *)tokenEndpoint { - self = [super initWithAuthorizationEndpoint:authorizationEndpoint tokenEndpoint:tokenEndpoint]; +- (instancetype)initWithTVAuthorizationEndpoint:(NSURL *)TVAuthorizationEndpoint + tokenEndpoint:(NSURL *)tokenEndpoint { + self = [super initWithAuthorizationEndpoint:[[NSURL alloc] initWithString:@""] + tokenEndpoint:tokenEndpoint]; if (self) { _TVAuthorizationEndpoint = [TVAuthorizationEndpoint copy]; } diff --git a/Source/AppAuthTV/OIDTVTokenRequest.h b/Source/AppAuthTV/OIDTVTokenRequest.h index f62911786..5a81c7434 100644 --- a/Source/AppAuthTV/OIDTVTokenRequest.h +++ b/Source/AppAuthTV/OIDTVTokenRequest.h @@ -55,8 +55,8 @@ NS_ASSUME_NONNULL_BEGIN refreshToken:(nullable NSString *)refreshToken codeVerifier:(nullable NSString *)codeVerifier additionalParameters: - (nullable NSDictionary *) - additionalParameters NS_UNAVAILABLE; + (nullable NSDictionary *)additionalParameters + NS_UNAVAILABLE; /*! @internal @brief Unavailable. Please use @@ -73,8 +73,8 @@ NS_ASSUME_NONNULL_BEGIN refreshToken:(nullable NSString *)refreshToken codeVerifier:(nullable NSString *)codeVerifier additionalParameters: - (nullable NSDictionary *) - additionalParameters NS_UNAVAILABLE; + (nullable NSDictionary *)additionalParameters + NS_UNAVAILABLE; /*! @brief Designated initializer. @param configuration The service's configuration. @@ -87,8 +87,8 @@ NS_ASSUME_NONNULL_BEGIN deviceCode:(NSString *)deviceCode clientID:(NSString *)clientID clientSecret:(nullable NSString *)clientSecret - additionalParameters:(nullable NSDictionary *) - additionalParameters + additionalParameters: + (nullable NSDictionary *)additionalParameters NS_DESIGNATED_INITIALIZER; /*! @brief Designated initializer for NSSecureCoding. diff --git a/UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.m b/UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.m index a533483f2..db9655506 100644 --- a/UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.m +++ b/UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.m @@ -91,12 +91,9 @@ - (OIDTVServiceConfiguration *)testServiceConfiguration { NSURL *tokenEndpoint = [NSURL URLWithString:kTestTokenEndpoint]; NSURL *TVAuthorizationEndpoint = [NSURL URLWithString:kTestTVAuthorizationEndpoint]; - // Pass in an empty authorizationEndpoint since only the TVAuthorizationEndpoint and tokenEndpoint - // are used for the TV authentication flow. - OIDTVServiceConfiguration *configuration = [[OIDTVServiceConfiguration alloc] - initWithAuthorizationEndpoint:[[NSURL alloc] initWithString:@""] - TVAuthorizationEndpoint:TVAuthorizationEndpoint - tokenEndpoint:tokenEndpoint]; + OIDTVServiceConfiguration *configuration = + [[OIDTVServiceConfiguration alloc] initWithTVAuthorizationEndpoint:TVAuthorizationEndpoint + tokenEndpoint:tokenEndpoint]; return configuration; } diff --git a/UnitTests/AppAuthTV/OIDTVTokenRequestTests.m b/UnitTests/AppAuthTV/OIDTVTokenRequestTests.m index 2ccb524c8..eecb48d35 100644 --- a/UnitTests/AppAuthTV/OIDTVTokenRequestTests.m +++ b/UnitTests/AppAuthTV/OIDTVTokenRequestTests.m @@ -108,13 +108,9 @@ - (OIDTVServiceConfiguration *)testServiceConfiguration { NSURL *tokenEndpoint = [NSURL URLWithString:kTestTokenEndpoint]; NSURL *TVAuthorizationEndpoint = [NSURL URLWithString:kTestTVAuthorizationEndpoint]; - // Pass in an empty authorizationEndpoint since only the - // TVAuthorizationEndpoint and tokenEndpoint are used for the TV - // authentication flow. - OIDTVServiceConfiguration *configuration = [[OIDTVServiceConfiguration alloc] - initWithAuthorizationEndpoint:[[NSURL alloc] initWithString:@""] - TVAuthorizationEndpoint:TVAuthorizationEndpoint - tokenEndpoint:tokenEndpoint]; + OIDTVServiceConfiguration *configuration = + [[OIDTVServiceConfiguration alloc] initWithTVAuthorizationEndpoint:TVAuthorizationEndpoint + tokenEndpoint:tokenEndpoint]; return configuration; } From 6e89dbabcc071b4ca4a52d22ac253bca0270f975 Mon Sep 17 00:00:00 2001 From: Souleiman Benhida Date: Fri, 7 Aug 2020 13:45:54 -0400 Subject: [PATCH 13/81] Add OIDTVAuthorizationResponse tests --- AppAuth.xcodeproj/project.pbxproj | 6 + .../OIDTVAuthorizationRequestTests.m | 6 +- .../OIDTVAuthorizationResponseTests.h | 59 ++++ .../OIDTVAuthorizationResponseTests.m | 285 ++++++++++++++++++ 4 files changed, 353 insertions(+), 3 deletions(-) create mode 100644 UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.h create mode 100644 UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.m diff --git a/AppAuth.xcodeproj/project.pbxproj b/AppAuth.xcodeproj/project.pbxproj index 555dc647c..27449610b 100644 --- a/AppAuth.xcodeproj/project.pbxproj +++ b/AppAuth.xcodeproj/project.pbxproj @@ -155,6 +155,7 @@ 2D93865024B38840009A12D7 /* OIDTVAuthorizationResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D47AAD8249A87010059B5A4 /* OIDTVAuthorizationResponse.m */; }; 2D93865124B38840009A12D7 /* OIDTVAuthorizationService.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D47AAE0249A87020059B5A4 /* OIDTVAuthorizationService.m */; }; 2D93865224B38840009A12D7 /* OIDTVServiceConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D47AADA249A87010059B5A4 /* OIDTVServiceConfiguration.m */; }; + 2DA8D82624C6190400FDFB34 /* OIDTVAuthorizationResponseTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DA8D82424C6190300FDFB34 /* OIDTVAuthorizationResponseTests.m */; }; 2DEB065624CA1D9300DF47E7 /* OIDTVTokenRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DEB065424CA1D9300DF47E7 /* OIDTVTokenRequest.h */; }; 2DEB065724CA1D9300DF47E7 /* OIDTVTokenRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DEB065524CA1D9300DF47E7 /* OIDTVTokenRequest.m */; }; 2DEB066124CF5CE000DF47E7 /* OIDTVTokenRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DEB066024CF5CE000DF47E7 /* OIDTVTokenRequestTests.m */; }; @@ -774,6 +775,8 @@ 2D9385B724B37CAD009A12D7 /* AppAuthTV.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AppAuthTV.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 2D9385B924B37CAD009A12D7 /* AppAuthTV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppAuthTV.h; sourceTree = ""; }; 2D9385BA24B37CAD009A12D7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 2DA8D82424C6190300FDFB34 /* OIDTVAuthorizationResponseTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OIDTVAuthorizationResponseTests.m; sourceTree = ""; }; + 2DA8D82524C6190400FDFB34 /* OIDTVAuthorizationResponseTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDTVAuthorizationResponseTests.h; sourceTree = ""; }; 2DEB065424CA1D9300DF47E7 /* OIDTVTokenRequest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OIDTVTokenRequest.h; sourceTree = ""; }; 2DEB065524CA1D9300DF47E7 /* OIDTVTokenRequest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OIDTVTokenRequest.m; sourceTree = ""; }; 2DEB065F24CF5CDF00DF47E7 /* OIDTVTokenRequestTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDTVTokenRequestTests.h; sourceTree = ""; }; @@ -1096,6 +1099,8 @@ children = ( 2D81120324C1036700984DA7 /* OIDTVAuthorizationRequestTests.h */, 2D81120024C1036700984DA7 /* OIDTVAuthorizationRequestTests.m */, + 2DA8D82524C6190400FDFB34 /* OIDTVAuthorizationResponseTests.h */, + 2DA8D82424C6190300FDFB34 /* OIDTVAuthorizationResponseTests.m */, 2DEB065F24CF5CDF00DF47E7 /* OIDTVTokenRequestTests.h */, 2DEB066024CF5CE000DF47E7 /* OIDTVTokenRequestTests.m */, ); @@ -2189,6 +2194,7 @@ buildActionMask = 2147483647; files = ( 2D81120C24C103F300984DA7 /* OIDScopesTests.m in Sources */, + 2DA8D82624C6190400FDFB34 /* OIDTVAuthorizationResponseTests.m in Sources */, 2D81121224C103F300984DA7 /* OIDURLQueryComponentTests.m in Sources */, 2DEB066224CF5CFB00DF47E7 /* OIDTVTokenRequestTests.m in Sources */, 2D81120D24C103F300984DA7 /* OIDServiceConfigurationTests.m in Sources */, diff --git a/UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.m b/UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.m index db9655506..b86869c34 100644 --- a/UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.m +++ b/UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.m @@ -17,14 +17,14 @@ */ #import "OIDTVAuthorizationRequestTests.h" -#import "OIDTVAuthorizationRequest.h" -#import "OIDTVServiceConfiguration.h" #if SWIFT_PACKAGE -@import AppAuthCore; +@import AppAuthTV; #else #import "Source/AppAuthCore/OIDScopeUtilities.h" #import "Source/AppAuthCore/OIDURLQueryComponent.h" +#import "Source/AppAuthTV/OIDTVAuthorizationRequest.h" +#import "Source/AppAuthTV/OIDTVServiceConfiguration.h" #endif // Ignore warnings about "Use of GNU statement expression extension" which is raised by our use of diff --git a/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.h b/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.h new file mode 100644 index 000000000..32497c854 --- /dev/null +++ b/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.h @@ -0,0 +1,59 @@ +/*! @file OIDTVAuthorizationResponseTests.h + @brief AppAuth iOS SDK + @copyright + Copyright 2020 Google Inc. All Rights Reserved. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import + +@class OIDTVAuthorizationResponse; + +NS_ASSUME_NONNULL_BEGIN + +/*! @brief Unit tests for @c OIDTVAuthorizationResponse. + */ +@interface OIDTVAuthorizationResponseTests : XCTestCase + +/*! @brief Tests the initializer using the standard key for @c verificationURI. + */ +- (void)testInitializer; + +/*! @brief Tests the initializer using the alternative key for @c verificationURI. + */ +- (void)testInitializerAlternativeKey; + +/*! @brief Tests the @c NSCopying implementation by round-tripping an instance through the copying + * process and checking to make sure the source and destination are equivalent. + */ +- (void)testCopying; + +/*! @brief Tests the @c NSSecureCoding implementation by round-tripping an instance through the + * coding process and checking to make sure the source and destination are equivalent. + */ +- (void)testSecureCoding; + +/*! @brief Tests the @c tokenPollRequest method that takes no additional parameters. + */ +- (void)testTokenPollRequest; + +/*! @brief Tests the @c tokenPollRequestWithAdditionalParameters method with one additional + parameter. + */ +- (void)testTokenPollRequestWithAdditionalParameters; + +@end + +NS_ASSUME_NONNULL_END + diff --git a/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.m b/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.m new file mode 100644 index 000000000..00612fd8f --- /dev/null +++ b/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.m @@ -0,0 +1,285 @@ +/*! @file OIDTVAuthorizationResponseTests.m + @brief AppAuth iOS SDK + @copyright + Copyright 2020 Google Inc. All Rights Reserved. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "OIDTVAuthorizationResponseTests.h" + +#if SWIFT_PACKAGE +@import AppAuthTV; +#else +#import "Source/AppAuthCore/OIDScopeUtilities.h" +#import "Source/AppAuthCore/OIDURLQueryComponent.h" +#import "Source/AppAuthTV/OIDTVAuthorizationRequest.h" +#import "Source/AppAuthTV/OIDTVAuthorizationResponse.h" +#import "Source/AppAuthTV/OIDTVServiceConfiguration.h" +#import "Source/AppAuthTV/OIDTVTokenRequest.h" +#endif + +/*! @brief Test value for the @c TVAuthorizationEndpoint property. + */ +static NSString *const kTestTVAuthorizationEndpoint = @"https://www.example.com/device/code"; + +/*! @brief Test value for the @c tokenEndpoint property. + */ +static NSString *const kTestTokenEndpoint = @"https://www.example.com/token"; + +/*! @brief Test key for the @c additionalParameters property. + */ +static NSString *const kTestAdditionalParameterKey = @"A"; + +/*! @brief Test value for the @c additionalParameters property. + */ +static NSString *const kTestAdditionalParameterValue = @"1"; + +/*! @brief Test value for the @c clientID property. + */ +static NSString *const kTestClientID = @"ClientID"; + +/*! @brief Test value for the @c clientSecret property. + */ +static NSString *const kTestClientSecret = @"ClientSecret"; + +/*! @brief Key for the @c verificationURI property. + */ +static NSString *const kVerificationURIKey = @"verification_uri"; + +/*! @brief Alternative key for the @c verificationURI property. If "verification_uri" is not found + in the response, a "verification_url" key is considered equivalent. + */ +static NSString *const kVerificationURIAlternativeKey = @"verification_url"; + +/*! @brief Test value for the @c verificationURI property. + */ +static NSString *const kTestVerificationURI = @"https://www.example.com/device"; + +/*! @brief Key for the @c verificationURIComplete property. + */ +static NSString *const kVerificationURICompleteKey = @"verification_uri_complete"; + +/*! @brief Test value for the @c verificationURIComplete property. + */ +static NSString *const kTestVerificationURIComplete = @"https://www.example.com/device/UserCode"; + +/*! @brief Key for the @c userCode property. + */ +static NSString *const kUserCodeKey = @"user_code"; + +/*! @brief Test value for the @c userCode property. + */ +static NSString *const kTestUserCode = @"UserCode"; + +/*! @brief Key for the @c deviceCode property. + */ +static NSString *const kDeviceCodeKey = @"device_code"; + +/*! @brief Test value for the @c deviceCode property. + */ +static NSString *const kTestDeviceCode = @"DeviceCode"; + +/*! @brief Key for the @c expirationDate property. + */ +static NSString *const kExpiresInKey = @"expires_in"; + +/*! @brief Test lifetime value used for the @c expirationDate property. + */ +static long long const kTestExpiresIn = 1800; + +/*! @brief Key for the @c interval property. + */ +static NSString *const kIntervalKey = @"interval"; + +/*! @brief Test value for the @c interval property. + */ +static int const kTestInterval = 5; + +@implementation OIDTVAuthorizationResponseTests + +- (OIDTVServiceConfiguration *)testServiceConfiguration { + NSURL *tokenEndpoint = [NSURL URLWithString:kTestTokenEndpoint]; + NSURL *TVAuthorizationEndpoint = [NSURL URLWithString:kTestTVAuthorizationEndpoint]; + + OIDTVServiceConfiguration *configuration = + [[OIDTVServiceConfiguration alloc] initWithTVAuthorizationEndpoint:TVAuthorizationEndpoint + tokenEndpoint:tokenEndpoint]; + return configuration; +} + +- (OIDTVAuthorizationRequest *)testAuthorizationRequest { + OIDTVAuthorizationRequest *request = + [[OIDTVAuthorizationRequest alloc] initWithConfiguration:[self testServiceConfiguration] + clientId:kTestClientID + clientSecret:kTestClientSecret + scopes:nil + additionalParameters:nil]; + return request; +} + +/*! @brief Returns an @c OIDTVAuthorizationResponse instance using the standard key for + @c verificationURI, with a @c verificationURIComplete value and additional parameter. + @returns an @c OIDTVAuthorizationResponse instance +*/ +- (OIDTVAuthorizationResponse *)testAuthorizationResponse { + OIDTVAuthorizationResponse *response = [[OIDTVAuthorizationResponse alloc] + initWithRequest:[self testAuthorizationRequest] + parameters:@{ + kVerificationURIKey : kTestVerificationURI, + kVerificationURICompleteKey : kTestVerificationURIComplete, + kUserCodeKey : kTestUserCode, + kDeviceCodeKey : kTestDeviceCode, + kExpiresInKey : @(kTestExpiresIn), + kIntervalKey : @(kTestInterval), + kTestAdditionalParameterKey : kTestAdditionalParameterValue + }]; + return response; +} + +/*! @brief Tests the initializer using the standard key for @c verificationURI. + */ +- (void)testInitializer { + OIDTVAuthorizationResponse *response = [self testAuthorizationResponse]; + + NSDictionary *testAdditionalParameters = + @{kTestAdditionalParameterKey : kTestAdditionalParameterValue}; + + XCTAssertEqualObjects(response.verificationURI, kTestVerificationURI); + XCTAssertEqualObjects(response.verificationURIComplete, kTestVerificationURIComplete); + XCTAssertEqualObjects(response.userCode, kTestUserCode); + XCTAssertEqualObjects(response.deviceCode, kTestDeviceCode); + XCTAssertEqualObjects(response.interval, @(kTestInterval)); + XCTAssertEqualObjects(response.additionalParameters, testAdditionalParameters); + + // Should be ~ kExpiresInValue seconds. Avoiding swizzling NSDate here for certainty + // to keep dependencies down, and simply making an assumption that this check will be executed + // relatively quickly after the initialization above (less than 5 seconds.) + NSTimeInterval expiration = [response.expirationDate timeIntervalSinceNow]; + XCTAssert(expiration > kTestExpiresIn - 5 && expiration <= kTestExpiresIn); +} + +/*! @brief Tests the initializer using the alternative key for @c verificationURI. + */ +- (void)testInitializerAlternativeKey { + OIDTVAuthorizationResponse *response = [[OIDTVAuthorizationResponse alloc] + initWithRequest:[self testAuthorizationRequest] + parameters:@{ + kVerificationURIAlternativeKey : kTestVerificationURI, + kVerificationURICompleteKey : kTestVerificationURIComplete, + kUserCodeKey : kTestUserCode, + kDeviceCodeKey : kTestDeviceCode, + kExpiresInKey : @(kTestExpiresIn), + kIntervalKey : @(kTestInterval), + kTestAdditionalParameterKey : kTestAdditionalParameterValue + }]; + + NSDictionary *testAdditionalParameters = + @{kTestAdditionalParameterKey : kTestAdditionalParameterValue}; + + // Tests that the alternative key used above maps to the verificationURI property, so + // subsequent tests can simply test using [self testAuthorizationResponse] which uses + // the standard key. + XCTAssertEqualObjects(response.verificationURI, kTestVerificationURI); + + XCTAssertEqualObjects(response.verificationURIComplete, kTestVerificationURIComplete); + XCTAssertEqualObjects(response.userCode, kTestUserCode); + XCTAssertEqualObjects(response.deviceCode, kTestDeviceCode); + XCTAssertEqualObjects(response.interval, @(kTestInterval)); + XCTAssertEqualObjects(response.additionalParameters, testAdditionalParameters); + + // Should be ~ kExpiresInValue seconds. Avoiding swizzling NSDate here for certainty + // to keep dependencies down, and simply making an assumption that this check will be executed + // relatively quickly after the initialization above (less than 5 seconds.) + NSTimeInterval expiration = [response.expirationDate timeIntervalSinceNow]; + XCTAssert(expiration > kTestExpiresIn - 5 && expiration <= kTestExpiresIn); +} + +/*! @brief Tests the @c NSCopying implementation by round-tripping an instance through the copying + * process and checking to make sure the source and destination are equivalent. + */ +- (void)testCopying { + OIDTVAuthorizationResponse *response = [self testAuthorizationResponse]; + OIDTVAuthorizationResponse *responseCopy = [response copy]; + + NSDictionary *testAdditionalParameters = + @{kTestAdditionalParameterKey : kTestAdditionalParameterValue}; + + XCTAssertEqualObjects(responseCopy.request, response.request); + XCTAssertEqualObjects(responseCopy.deviceCode, kTestDeviceCode); + XCTAssertEqualObjects(responseCopy.interval, @(kTestInterval)); + XCTAssertEqualObjects(responseCopy.userCode, kTestUserCode); + XCTAssertEqualObjects(responseCopy.verificationURIComplete, kTestVerificationURIComplete); + XCTAssertEqualObjects(responseCopy.verificationURI, kTestVerificationURI); + XCTAssertEqualObjects(responseCopy.additionalParameters, testAdditionalParameters); +} + +/*! @brief Tests the @c NSSecureCoding implementation by round-tripping an instance through the + * coding process and checking to make sure the source and destination are equivalent. + */ +- (void)testSecureCoding { + OIDTVAuthorizationResponse *response = [self testAuthorizationResponse]; + NSData *data = [NSKeyedArchiver archivedDataWithRootObject:response]; + OIDTVAuthorizationResponse *responseCopy = [NSKeyedUnarchiver unarchiveObjectWithData:data]; + + NSDictionary *testAdditionalParameters = + @{kTestAdditionalParameterKey : kTestAdditionalParameterValue}; + + // Not a full test of the request deserialization, but should be sufficient as a smoke test + // to make sure the request IS actually getting serialized and deserialized in the + // NSSecureCoding implementation. We'll leave it up to the OIDTVAuthorizationRequest tests to make + // sure the NSSecureCoding implementation of that class is correct. + XCTAssertNotNil(responseCopy.request); + + XCTAssertEqualObjects(responseCopy.deviceCode, kTestDeviceCode); + XCTAssertEqualObjects(responseCopy.interval, @(kTestInterval)); + XCTAssertEqualObjects(responseCopy.userCode, kTestUserCode); + XCTAssertEqualObjects(responseCopy.verificationURIComplete, kTestVerificationURIComplete); + XCTAssertEqualObjects(responseCopy.verificationURI, kTestVerificationURI); + XCTAssertEqualObjects(responseCopy.additionalParameters, testAdditionalParameters); +} + +/*! @brief Tests the @c tokenPollRequest method that takes no additional parameters. + */ +- (void)testTokenPollRequest { + OIDTVAuthorizationResponse *testResponse = [self testAuthorizationResponse]; + + OIDTVTokenRequest *pollRequest = [testResponse tokenPollRequest]; + + XCTAssertEqualObjects(pollRequest.deviceCode, kTestDeviceCode); + XCTAssertEqualObjects(pollRequest.clientID, kTestClientID); + XCTAssertEqualObjects(pollRequest.clientSecret, kTestClientSecret); + XCTAssertEqualObjects(pollRequest.additionalParameters, @{}); +} + +/*! @brief Tests the @c tokenPollRequestWithAdditionalParameters method with one additional + parameter. + */ +- (void)testTokenPollRequestWithAdditionalParameters { + OIDTVAuthorizationResponse *testResponse = [self testAuthorizationResponse]; + + NSDictionary *testAdditionalParameters = + @{kTestAdditionalParameterKey : kTestAdditionalParameterValue}; + + OIDTVTokenRequest *pollRequest = + [testResponse tokenPollRequestWithAdditionalParameters:testAdditionalParameters]; + + XCTAssertEqualObjects(pollRequest.deviceCode, kTestDeviceCode); + XCTAssertEqualObjects(pollRequest.clientID, kTestClientID); + XCTAssertEqualObjects(pollRequest.clientSecret, kTestClientSecret); + XCTAssertEqualObjects(pollRequest.additionalParameters, testAdditionalParameters); +} + +@end + +#pragma GCC diagnostic pop From 61229cb6b990048931d0b6fe3ae9e1f3f75ef459 Mon Sep 17 00:00:00 2001 From: Souleiman Benhida Date: Tue, 11 Aug 2020 19:46:40 -0400 Subject: [PATCH 14/81] Add updated tvOS example project --- .../Example-tvOS.xcodeproj/project.pbxproj | 382 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../AppAuthTVExampleViewController.h | 63 +++ .../AppAuthTVExampleViewController.m | 358 ++++++++++++++++ .../Example-tvOS/Example-tvOS/AppDelegate.h | 27 ++ .../Example-tvOS/Example-tvOS/AppDelegate.m | 20 + .../Content.imageset/Contents.json | 11 + .../Back.imagestacklayer/Contents.json | 6 + .../Contents.json | 17 + .../Content.imageset/Contents.json | 11 + .../Front.imagestacklayer/Contents.json | 6 + .../Content.imageset/Contents.json | 11 + .../Middle.imagestacklayer/Contents.json | 6 + .../Content.imageset/Contents.json | 16 + .../Back.imagestacklayer/Contents.json | 6 + .../App Icon.imagestack/Contents.json | 17 + .../Content.imageset/Contents.json | 16 + .../Front.imagestacklayer/Contents.json | 6 + .../Content.imageset/Contents.json | 16 + .../Middle.imagestacklayer/Contents.json | 6 + .../Contents.json | 32 ++ .../Contents.json | 24 ++ .../Top Shelf Image.imageset/Contents.json | 24 ++ .../Assets.xcassets/Contents.json | 6 + .../Base.lproj/LaunchScreen.storyboard | 24 ++ Examples/Example-tvOS/Example-tvOS/Info.plist | 32 ++ .../Example-tvOS/Example-tvOS/Main.storyboard | 133 ++++++ Examples/Example-tvOS/Example-tvOS/main.m | 24 ++ Examples/Example-tvOS/Podfile | 7 + 30 files changed, 1322 insertions(+) create mode 100644 Examples/Example-tvOS/Example-tvOS.xcodeproj/project.pbxproj create mode 100644 Examples/Example-tvOS/Example-tvOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 Examples/Example-tvOS/Example-tvOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.h create mode 100644 Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.m create mode 100644 Examples/Example-tvOS/Example-tvOS/AppDelegate.h create mode 100644 Examples/Example-tvOS/Example-tvOS/AppDelegate.m create mode 100644 Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json create mode 100644 Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Contents.json create mode 100644 Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Contents.json create mode 100644 Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json create mode 100644 Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Contents.json create mode 100644 Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json create mode 100644 Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Contents.json create mode 100644 Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json create mode 100644 Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Contents.json create mode 100644 Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Contents.json create mode 100644 Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json create mode 100644 Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Contents.json create mode 100644 Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json create mode 100644 Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Contents.json create mode 100644 Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json create mode 100644 Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json create mode 100644 Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json create mode 100644 Examples/Example-tvOS/Example-tvOS/Assets.xcassets/Contents.json create mode 100644 Examples/Example-tvOS/Example-tvOS/Base.lproj/LaunchScreen.storyboard create mode 100644 Examples/Example-tvOS/Example-tvOS/Info.plist create mode 100644 Examples/Example-tvOS/Example-tvOS/Main.storyboard create mode 100644 Examples/Example-tvOS/Example-tvOS/main.m create mode 100644 Examples/Example-tvOS/Podfile diff --git a/Examples/Example-tvOS/Example-tvOS.xcodeproj/project.pbxproj b/Examples/Example-tvOS/Example-tvOS.xcodeproj/project.pbxproj new file mode 100644 index 000000000..c70129f75 --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS.xcodeproj/project.pbxproj @@ -0,0 +1,382 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 2D8B83982497C7B800CD51D7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2D8B83972497C7B800CD51D7 /* Main.storyboard */; }; + 2D91B7A8248EA17C0005B197 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D91B7A7248EA17C0005B197 /* AppDelegate.m */; }; + 2D91B7AB248EA17C0005B197 /* AppAuthTVExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D91B7AA248EA17C0005B197 /* AppAuthTVExampleViewController.m */; }; + 2D91B7B0248EA17D0005B197 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2D91B7AF248EA17D0005B197 /* Assets.xcassets */; }; + 2D91B7B3248EA17D0005B197 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2D91B7B1248EA17D0005B197 /* LaunchScreen.storyboard */; }; + 2D91B7B6248EA17E0005B197 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D91B7B5248EA17E0005B197 /* main.m */; }; + 424A8D8BA4EB0A6C9FF4326A /* libPods-Example-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EEBF9489D390F9D0913AE178 /* libPods-Example-tvOS.a */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 0822FAAB579E01CE65770A61 /* Pods-Example-tvOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-tvOS.release.xcconfig"; path = "Target Support Files/Pods-Example-tvOS/Pods-Example-tvOS.release.xcconfig"; sourceTree = ""; }; + 2D8B83972497C7B800CD51D7 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; + 2D91B7A3248EA17C0005B197 /* AppAuth tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "AppAuth tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 2D91B7A6248EA17C0005B197 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 2D91B7A7248EA17C0005B197 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 2D91B7A9248EA17C0005B197 /* AppAuthTVExampleViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppAuthTVExampleViewController.h; sourceTree = ""; }; + 2D91B7AA248EA17C0005B197 /* AppAuthTVExampleViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppAuthTVExampleViewController.m; sourceTree = ""; }; + 2D91B7AF248EA17D0005B197 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 2D91B7B2248EA17D0005B197 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 2D91B7B4248EA17D0005B197 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 2D91B7B5248EA17E0005B197 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + D33A601E3AA7C8647C857C08 /* Pods-Example-tvOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-tvOS.debug.xcconfig"; path = "Target Support Files/Pods-Example-tvOS/Pods-Example-tvOS.debug.xcconfig"; sourceTree = ""; }; + EEBF9489D390F9D0913AE178 /* libPods-Example-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Example-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 2D91B7A0248EA17C0005B197 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 424A8D8BA4EB0A6C9FF4326A /* libPods-Example-tvOS.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 2D91B79A248EA17C0005B197 = { + isa = PBXGroup; + children = ( + 2D91B7A5248EA17C0005B197 /* Example-tvOS */, + 2D91B7A4248EA17C0005B197 /* Products */, + D5A14A70EF1AB61275EF2A3E /* Pods */, + 9CCA3BB0D6EA112455518E2C /* Frameworks */, + ); + sourceTree = ""; + }; + 2D91B7A4248EA17C0005B197 /* Products */ = { + isa = PBXGroup; + children = ( + 2D91B7A3248EA17C0005B197 /* AppAuth tvOS.app */, + ); + name = Products; + sourceTree = ""; + }; + 2D91B7A5248EA17C0005B197 /* Example-tvOS */ = { + isa = PBXGroup; + children = ( + 2D91B7A6248EA17C0005B197 /* AppDelegate.h */, + 2D91B7A7248EA17C0005B197 /* AppDelegate.m */, + 2D91B7A9248EA17C0005B197 /* AppAuthTVExampleViewController.h */, + 2D91B7AA248EA17C0005B197 /* AppAuthTVExampleViewController.m */, + 2D8B83972497C7B800CD51D7 /* Main.storyboard */, + 2D91B7AF248EA17D0005B197 /* Assets.xcassets */, + 2D91B7B1248EA17D0005B197 /* LaunchScreen.storyboard */, + 2D91B7B4248EA17D0005B197 /* Info.plist */, + 2D91B7B5248EA17E0005B197 /* main.m */, + ); + path = "Example-tvOS"; + sourceTree = ""; + }; + 9CCA3BB0D6EA112455518E2C /* Frameworks */ = { + isa = PBXGroup; + children = ( + EEBF9489D390F9D0913AE178 /* libPods-Example-tvOS.a */, + ); + name = Frameworks; + sourceTree = ""; + }; + D5A14A70EF1AB61275EF2A3E /* Pods */ = { + isa = PBXGroup; + children = ( + D33A601E3AA7C8647C857C08 /* Pods-Example-tvOS.debug.xcconfig */, + 0822FAAB579E01CE65770A61 /* Pods-Example-tvOS.release.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 2D91B7A2248EA17C0005B197 /* Example-tvOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2D91B7B9248EA17E0005B197 /* Build configuration list for PBXNativeTarget "Example-tvOS" */; + buildPhases = ( + BE78BAE9067856409CDDD945 /* [CP] Check Pods Manifest.lock */, + 2D91B79F248EA17C0005B197 /* Sources */, + 2D91B7A0248EA17C0005B197 /* Frameworks */, + 2D91B7A1248EA17C0005B197 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Example-tvOS"; + productName = "Example-tvOS"; + productReference = 2D91B7A3248EA17C0005B197 /* AppAuth tvOS.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 2D91B79B248EA17C0005B197 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1150; + ORGANIZATIONNAME = "Souleiman Benhida"; + TargetAttributes = { + 2D91B7A2248EA17C0005B197 = { + CreatedOnToolsVersion = 11.5; + }; + }; + }; + buildConfigurationList = 2D91B79E248EA17C0005B197 /* Build configuration list for PBXProject "Example-tvOS" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 2D91B79A248EA17C0005B197; + productRefGroup = 2D91B7A4248EA17C0005B197 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 2D91B7A2248EA17C0005B197 /* Example-tvOS */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 2D91B7A1248EA17C0005B197 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2D8B83982497C7B800CD51D7 /* Main.storyboard in Resources */, + 2D91B7B3248EA17D0005B197 /* LaunchScreen.storyboard in Resources */, + 2D91B7B0248EA17D0005B197 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + BE78BAE9067856409CDDD945 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Example-tvOS-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 2D91B79F248EA17C0005B197 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2D91B7AB248EA17C0005B197 /* AppAuthTVExampleViewController.m in Sources */, + 2D91B7B6248EA17E0005B197 /* main.m in Sources */, + 2D91B7A8248EA17C0005B197 /* AppDelegate.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 2D91B7B1248EA17D0005B197 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 2D91B7B2248EA17D0005B197 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 2D91B7B7248EA17E0005B197 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = appletvos; + TVOS_DEPLOYMENT_TARGET = 9.0; + }; + name = Debug; + }; + 2D91B7B8248EA17E0005B197 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = appletvos; + TVOS_DEPLOYMENT_TARGET = 9.0; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 2D91B7BA248EA17E0005B197 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = D33A601E3AA7C8647C857C08 /* Pods-Example-tvOS.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = "Example-tvOS/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = net.openid.appauthtv.Example; + PRODUCT_NAME = "AppAuth tvOS"; + TARGETED_DEVICE_FAMILY = 3; + }; + name = Debug; + }; + 2D91B7BB248EA17E0005B197 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 0822FAAB579E01CE65770A61 /* Pods-Example-tvOS.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = "Example-tvOS/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = net.openid.appauthtv.Example; + PRODUCT_NAME = "AppAuth tvOS"; + TARGETED_DEVICE_FAMILY = 3; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 2D91B79E248EA17C0005B197 /* Build configuration list for PBXProject "Example-tvOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2D91B7B7248EA17E0005B197 /* Debug */, + 2D91B7B8248EA17E0005B197 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2D91B7B9248EA17E0005B197 /* Build configuration list for PBXNativeTarget "Example-tvOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2D91B7BA248EA17E0005B197 /* Debug */, + 2D91B7BB248EA17E0005B197 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 2D91B79B248EA17C0005B197 /* Project object */; +} diff --git a/Examples/Example-tvOS/Example-tvOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Examples/Example-tvOS/Example-tvOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..eb768ef2b --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Examples/Example-tvOS/Example-tvOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Examples/Example-tvOS/Example-tvOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.h b/Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.h new file mode 100644 index 000000000..aeccd98b5 --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.h @@ -0,0 +1,63 @@ +/*! @file AppAuthTVExampleViewController.h + @brief AppAuth tvOS SDK Example + @copyright + Copyright 2016 Google Inc. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import + +@class OIDAuthState; + +NS_ASSUME_NONNULL_BEGIN + +/*! @brief The example application's view controller. + */ +@interface AppAuthTVExampleViewController : UIViewController + +@property(nullable) IBOutlet UIView *signInView; +@property(nullable) IBOutlet UILabel *verificationURLLabel; +@property(nullable) IBOutlet UILabel *userCodeLabel; +@property(nullable) IBOutlet UIView *signInButtons; +@property(nullable) IBOutlet UIButton *cancelSignInButton; +@property(nullable) IBOutlet UIView *signedInButtons; +@property(nullable) IBOutlet UITextView *logTextView; + +/*! @brief The authorization state. + */ +@property(nonatomic, nullable) OIDAuthState *authState; + +/*! @brief Initiates the sign-in. + @param sender IBAction sender. + */ +- (IBAction)signin:(nullable id)sender; + +/*! @brief Cancels the active sign-in (if any), has no effect if a sign-in isn't in progress. + @param sender IBAction sender. + */ +- (IBAction)cancelSignIn:(nullable id)sender; + +/*! @brief Forgets the authentication state, used to sign-out the user. + @param sender IBAction sender. + */ +- (IBAction)clearAuthState:(nullable id)sender; + +/*! @brief Performs an authenticated API call. + @param sender IBAction sender. + */ +- (IBAction)userinfo:(nullable id)sender; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.m b/Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.m new file mode 100644 index 000000000..bb40c3426 --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.m @@ -0,0 +1,358 @@ +/*! @file AppAuthTVExampleViewController.m + @brief AppAuth tvOS SDK Example + @copyright + Copyright 2016 Google Inc. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "AppAuthTVExampleViewController.h" + +#import +#import + +/*! @brief OAuth client ID. + */ +static NSString *const kClientID = @"YOUR_CLIENT_ID"; + +/*! @brief OAuth client secret. + */ +static NSString *const kClientSecret = @"YOUR_CLIENT_SECRET"; + +/*! @brief Device authorization endpoint. + */ +static NSString *const kTVAuthorizationEndpoint = @"https://oauth.example.com/device"; + +/*! @brief Token endpoint. + */ +static NSString *const kTokenEndpoint = @"https://oauth.example.com/token"; + +/*! @brief User info endpoint. + */ +static NSString *const kUserInfoEndpoint = @"https://oauth.example.com/userinfo"; + +/*! @brief NSCoding key for the authorization property. + */ +static NSString *const kExampleAuthorizerKey = @"authorization"; + +/*! @brief NSCoding key for the authState property. + */ +static NSString *const kExampleAuthStateKey = @"authState"; + +@interface AppAuthTVExampleViewController () +@end + +@implementation AppAuthTVExampleViewController { + OIDTVAuthorizationCancelBlock _cancelBlock; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + + _logTextView.text = @""; + _signInView.hidden = YES; + _cancelSignInButton.hidden = YES; + _logTextView.selectable = YES; + _logTextView.panGestureRecognizer.allowedTouchTypes = @[ @(UITouchTypeIndirect) ]; + + [self verifyConfig]; + + [self loadState]; + [self updateUI]; +} + +- (void)verifyConfig { +#if !defined(NS_BLOCK_ASSERTIONS) + // The example needs to be configured with your own client details. + // See: https://github.com/openid/AppAuth-iOS/blob/master/Examples/Example-tvOS/README.md + + NSAssert(![kClientID isEqualToString:@"YOUR_CLIENT_ID"], + @"Update kClientID with your own client ID. " + "Instructions: " + "https://github.com/openid/AppAuth-iOS/blob/master/Examples/Example-tvOS/README.md"); + + NSAssert(![kClientSecret isEqualToString:@"YOUR_CLIENT_SECRET"], + @"Update kClientSecret with your own client secret. " + "Instructions: " + "https://github.com/openid/AppAuth-iOS/blob/master/Examples/Example-tvOS/README.md"); + + NSAssert(![kTVAuthorizationEndpoint isEqualToString:@"https://oauth.example.com/device"], + @"Update kTVAuthorizationEndpoint with your own TV authorization endpoint. " + "Instructions: " + "https://github.com/openid/AppAuth-iOS/blob/master/Examples/Example-tvOS/README.md"); + + NSAssert(![kTokenEndpoint isEqualToString:@"https://oauth.example.com/token"], + @"Update kTokenEndpoint with your own token endpoint. " + "Instructions: " + "https://github.com/openid/AppAuth-iOS/blob/master/Examples/Example-tvOS/README.md"); + + NSAssert(![kUserInfoEndpoint isEqualToString:@"https://oauth.example.com/userinfo"], + @"Update kUserInfoEndpoint with your own user info endpoint. " + "Instructions: " + "https://github.com/openid/AppAuth-iOS/blob/master/Examples/Example-tvOS/README.md"); +#endif // !defined(NS_BLOCK_ASSERTIONS) +} + +- (void)stateChanged { + [self saveState]; + [self updateUI]; +} + +- (void)didChangeState:(OIDAuthState *)state { + [self stateChanged]; +} + +- (void)authState:(OIDAuthState *)state didEncounterAuthorizationError:(nonnull NSError *)error { + [self logMessage:@"Received authorization error: %@", error]; +} + +/*! @brief Initiates the sign-in. + @param sender IBAction sender. +*/ +- (IBAction)signin:(id)sender { + if (_cancelBlock) { + [self cancelSignIn:nil]; + } + + // builds authentication request + NSURL *TVAuthorizationEndpoint = [NSURL URLWithString:kTVAuthorizationEndpoint]; + NSURL *tokenEndpoint = [NSURL URLWithString:kTokenEndpoint]; + + __weak __typeof(self) weakSelf = self; + + OIDTVServiceConfiguration *configuration = + [[OIDTVServiceConfiguration alloc] initWithTVAuthorizationEndpoint:TVAuthorizationEndpoint + tokenEndpoint:tokenEndpoint]; + OIDTVAuthorizationRequest *request = + [[OIDTVAuthorizationRequest alloc] initWithConfiguration:configuration + clientId:kClientID + clientSecret:kClientSecret + scopes:@[ OIDScopeOpenID, OIDScopeProfile ] + additionalParameters:nil]; + + OIDTVAuthorizationInitialization initBlock = + ^(OIDTVAuthorizationResponse *_Nullable response, NSError *_Nullable error) { + if (response) { + [weakSelf logMessage:@"Authorization response: %@", response]; + weakSelf.signInView.hidden = NO; + weakSelf.cancelSignInButton.hidden = NO; + weakSelf.verificationURLLabel.text = response.verificationURI; + weakSelf.userCodeLabel.text = response.userCode; + } else { + [weakSelf logMessage:@"Initialization error %@", error]; + } + }; + + OIDTVAuthorizationCompletion completionBlock = + ^(OIDAuthState *_Nullable authState, NSError *_Nullable error) { + weakSelf.signInView.hidden = YES; + if (authState) { + [weakSelf setAuthState:authState]; + [weakSelf logMessage:@"Token response: %@", authState.lastTokenResponse]; + } else { + [weakSelf setAuthState:nil]; + [weakSelf logMessage:@"Error: %@", error]; + } + }; + + _cancelBlock = [OIDTVAuthorizationService authorizeTVRequest:request + initialization:initBlock + completion:completionBlock]; +} + +/*! @brief Cancels the active sign-in (if any), has no effect if a sign-in isn't in progress. + @param sender IBAction sender. +*/ +- (IBAction)cancelSignIn:(nullable id)sender { + if (_cancelBlock) { + _cancelBlock(); + _cancelBlock = nil; + } + _signInView.hidden = YES; + _cancelSignInButton.hidden = YES; +} + +- (void)setAuthState:(nullable OIDAuthState *)authState { + if (_authState == authState) { + return; + } + _authState = authState; + _authState.stateChangeDelegate = self; + [self stateChanged]; +} + +/*! @brief Saves the @c OIDAuthState to @c NSUSerDefaults. + */ +- (void)saveState { + // for production usage consider using the OS Keychain instead + NSData *archivedAuthState = [NSKeyedArchiver archivedDataWithRootObject:_authState]; + [[NSUserDefaults standardUserDefaults] setObject:archivedAuthState forKey:kExampleAuthStateKey]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} + +/*! @brief Loads the @c OIDAuthState from @c NSUSerDefaults. + */ +- (void)loadState { + // loads OIDAuthState from NSUSerDefaults + NSData *archivedAuthState = + [[NSUserDefaults standardUserDefaults] objectForKey:kExampleAuthStateKey]; + OIDAuthState *authState = [NSKeyedUnarchiver unarchiveObjectWithData:archivedAuthState]; + [self setAuthState:authState]; +} + +/*! @brief Refreshes UI, typically called after the auth state changed. + */ +- (void)updateUI { + _signInButtons.hidden = [_authState isAuthorized]; + _signedInButtons.hidden = !_signInButtons.hidden; +} + +- (void)updateSignInUIWithResponse:(OIDTVAuthorizationResponse *)response { + _signInView.hidden = NO; + _cancelSignInButton.hidden = NO; + _verificationURLLabel.text = response.verificationURI; + _userCodeLabel.text = response.userCode; +} + +/*! @brief Forgets the authentication state, used to sign-out the user. + @param sender IBAction sender. +*/ +- (IBAction)clearAuthState:(nullable id)sender { + [self setAuthState:nil]; + [self logMessage:@"Authorization state cleared."]; + _cancelSignInButton.hidden = TRUE; +} + +- (IBAction)clearLog:(nullable id)sender { + _logTextView.text = @""; +} + +/*! @brief Performs an authenticated API call. + @param sender IBAction sender. +*/ +- (IBAction)userinfo:(nullable id)sender { + NSURL *userinfoEndpoint = [NSURL URLWithString:kUserInfoEndpoint]; + NSString *currentAccessToken = _authState.lastTokenResponse.accessToken; + + [self logMessage:@"Performing userinfo request"]; + + [_authState performActionWithFreshTokens:^(NSString *_Nonnull accessToken, + NSString *_Nonnull idToken, NSError *_Nullable error) { + if (error) { + [self logMessage:@"Error fetching fresh tokens: %@", [error localizedDescription]]; + return; + } + + // log whether a token refresh occurred + if (![currentAccessToken isEqual:accessToken]) { + [self logMessage:@"Access token was refreshed automatically (%@ to %@)", currentAccessToken, + accessToken]; + } else { + [self logMessage:@"Access token was fresh and not updated [%@]", accessToken]; + } + + // creates request to the userinfo endpoint, with access token in the Authorization header + NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:userinfoEndpoint]; + NSString *authorizationHeaderValue = [NSString stringWithFormat:@"Bearer %@", accessToken]; + [request addValue:authorizationHeaderValue forHTTPHeaderField:@"Authorization"]; + + NSURLSessionConfiguration *configuration = + [NSURLSessionConfiguration defaultSessionConfiguration]; + NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration + delegate:nil + delegateQueue:nil]; + + // performs HTTP request + NSURLSessionDataTask *postDataTask = [session + dataTaskWithRequest:request + completionHandler:^(NSData *_Nullable data, NSURLResponse *_Nullable response, + NSError *_Nullable error) { + dispatch_async(dispatch_get_main_queue(), ^() { + if (error) { + [self logMessage:@"HTTP request failed %@", error]; + return; + } + if (![response isKindOfClass:[NSHTTPURLResponse class]]) { + [self logMessage:@"Non-HTTP response"]; + return; + } + + NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; + id jsonDictionaryOrArray = [NSJSONSerialization JSONObjectWithData:data + options:0 + error:NULL]; + + if (httpResponse.statusCode != 200) { + // server replied with an error + NSString *responseText = [[NSString alloc] initWithData:data + encoding:NSUTF8StringEncoding]; + if (httpResponse.statusCode == 401) { + // "401 Unauthorized" generally indicates there is an issue with the authorization + // grant. Puts OIDAuthState into an error state. + NSError *oauthError = [OIDErrorUtilities + resourceServerAuthorizationErrorWithCode:0 + errorResponse:jsonDictionaryOrArray + underlyingError:error]; + [self->_authState updateWithAuthorizationError:oauthError]; + // log error + [self logMessage:@"Authorization Error (%@). Response: %@", oauthError, + responseText]; + } else { + [self logMessage:@"HTTP: %d. Response: %@", (int)httpResponse.statusCode, + responseText]; + } + return; + } + + // success response + [self logMessage:@"Success: %@", jsonDictionaryOrArray]; + }); + }]; + + [postDataTask resume]; + }]; +} + +/*! @brief Logs a message to stdout and the textfield. + @param format The format string and arguments. + */ +- (void)logMessage:(NSString *)format, ... NS_FORMAT_FUNCTION(1, 2) { + // gets message as string + va_list argp; + va_start(argp, format); + NSString *log = [[NSString alloc] initWithFormat:format arguments:argp]; + va_end(argp); + + // outputs to stdout + NSLog(@"%@", log); + + // appends to output log + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + dateFormatter.dateFormat = @"hh:mm:ss"; + NSString *dateString = [dateFormatter stringFromDate:[NSDate date]]; + NSString *logLine = [NSString stringWithFormat:@"\n%@: %@", dateString, log]; + UIFont *systemFont = [UIFont systemFontOfSize:36.0f]; + NSDictionary *fontAttributes = + [[NSDictionary alloc] initWithObjectsAndKeys:systemFont, NSFontAttributeName, nil]; + NSMutableAttributedString *logLineAttr = + [[NSMutableAttributedString alloc] initWithString:logLine attributes:fontAttributes]; + [[_logTextView textStorage] appendAttributedString:logLineAttr]; + + // Scroll to bottom + if (_logTextView.text.length > 0) { + NSRange bottom = NSMakeRange(_logTextView.text.length - 1, 1); + [_logTextView scrollRangeToVisible:bottom]; + } +} + +@end diff --git a/Examples/Example-tvOS/Example-tvOS/AppDelegate.h b/Examples/Example-tvOS/Example-tvOS/AppDelegate.h new file mode 100644 index 000000000..0a665e487 --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/AppDelegate.h @@ -0,0 +1,27 @@ +/*! @file AppDelegate.h + @brief AppAuth tvOS SDK Example + @copyright + Copyright 2016 Google Inc. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import + +/*! @brief The example application's delegate. + */ +@interface AppDelegate : UIResponder + +/*! @brief The example application's @c UIWindow. + */ +@property (strong, nonatomic) UIWindow *window; + +@end diff --git a/Examples/Example-tvOS/Example-tvOS/AppDelegate.m b/Examples/Example-tvOS/Example-tvOS/AppDelegate.m new file mode 100644 index 000000000..4ae47a2db --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/AppDelegate.m @@ -0,0 +1,20 @@ +/*! @file AppDelegate.m + @brief AppAuth tvOS SDK Example + @copyright + Copyright 2016 Google Inc. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "AppDelegate.h" + +@implementation AppDelegate +@end diff --git a/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000..2e003356c --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,11 @@ +{ + "images" : [ + { + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Contents.json b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 000000000..73c00596a --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Contents.json b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Contents.json new file mode 100644 index 000000000..de59d885a --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Contents.json @@ -0,0 +1,17 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Middle.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ] +} diff --git a/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000..2e003356c --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,11 @@ +{ + "images" : [ + { + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Contents.json b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 000000000..73c00596a --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000..2e003356c --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,11 @@ +{ + "images" : [ + { + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Contents.json b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Contents.json new file mode 100644 index 000000000..73c00596a --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000..795cce172 --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,16 @@ +{ + "images" : [ + { + "idiom" : "tv", + "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Contents.json b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 000000000..73c00596a --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Contents.json b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Contents.json new file mode 100644 index 000000000..de59d885a --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Contents.json @@ -0,0 +1,17 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Middle.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ] +} diff --git a/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000..795cce172 --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,16 @@ +{ + "images" : [ + { + "idiom" : "tv", + "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Contents.json b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 000000000..73c00596a --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000..795cce172 --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,16 @@ +{ + "images" : [ + { + "idiom" : "tv", + "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Contents.json b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Contents.json new file mode 100644 index 000000000..73c00596a --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json new file mode 100644 index 000000000..f47ba43da --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json @@ -0,0 +1,32 @@ +{ + "assets" : [ + { + "filename" : "App Icon - App Store.imagestack", + "idiom" : "tv", + "role" : "primary-app-icon", + "size" : "1280x768" + }, + { + "filename" : "App Icon.imagestack", + "idiom" : "tv", + "role" : "primary-app-icon", + "size" : "400x240" + }, + { + "filename" : "Top Shelf Image Wide.imageset", + "idiom" : "tv", + "role" : "top-shelf-image-wide", + "size" : "2320x720" + }, + { + "filename" : "Top Shelf Image.imageset", + "idiom" : "tv", + "role" : "top-shelf-image", + "size" : "1920x720" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json new file mode 100644 index 000000000..b65f0cddc --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json @@ -0,0 +1,24 @@ +{ + "images" : [ + { + "idiom" : "tv", + "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" + }, + { + "idiom" : "tv-marketing", + "scale" : "1x" + }, + { + "idiom" : "tv-marketing", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json new file mode 100644 index 000000000..b65f0cddc --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json @@ -0,0 +1,24 @@ +{ + "images" : [ + { + "idiom" : "tv", + "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" + }, + { + "idiom" : "tv-marketing", + "scale" : "1x" + }, + { + "idiom" : "tv-marketing", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/Contents.json b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/Contents.json new file mode 100644 index 000000000..73c00596a --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Examples/Example-tvOS/Example-tvOS/Base.lproj/LaunchScreen.storyboard b/Examples/Example-tvOS/Example-tvOS/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 000000000..660ba53de --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/Example-tvOS/Example-tvOS/Info.plist b/Examples/Example-tvOS/Example-tvOS/Info.plist new file mode 100644 index 000000000..959d2174c --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + arm64 + + UIUserInterfaceStyle + Automatic + + diff --git a/Examples/Example-tvOS/Example-tvOS/Main.storyboard b/Examples/Example-tvOS/Example-tvOS/Main.storyboard new file mode 100644 index 000000000..b0725a43e --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/Main.storyboard @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/Example-tvOS/Example-tvOS/main.m b/Examples/Example-tvOS/Example-tvOS/main.m new file mode 100644 index 000000000..151d7c872 --- /dev/null +++ b/Examples/Example-tvOS/Example-tvOS/main.m @@ -0,0 +1,24 @@ +/*! @file main.m + @brief AppAuth tvOS SDK Example + @copyright + Copyright 2016 Google Inc. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/Examples/Example-tvOS/Podfile b/Examples/Example-tvOS/Podfile new file mode 100644 index 000000000..979341635 --- /dev/null +++ b/Examples/Example-tvOS/Podfile @@ -0,0 +1,7 @@ +platform :tvos, '9.0' + +target 'Example-tvOS' do + # AppAuth Pod, TV subspec + # In production, just use `pod 'AppAuth/TV'` without the path reference. + pod 'AppAuth/TV', :path => '../../' +end From 8c33e8cdce87998919f8fab82ee2c594dcbe59c3 Mon Sep 17 00:00:00 2001 From: Souleiman Benhida Date: Thu, 13 Aug 2020 17:15:34 -0400 Subject: [PATCH 15/81] Add OIDC Discovery for the Device Authorization Endpoint Update the example project to support discovery --- .../AppAuthTVExampleViewController.m | 102 +++++++++++++----- Source/AppAuthCore/OIDServiceDiscovery.h | 6 ++ Source/AppAuthCore/OIDServiceDiscovery.m | 5 + Source/AppAuthTV/OIDTVAuthorizationService.h | 36 +++++++ Source/AppAuthTV/OIDTVAuthorizationService.m | 46 ++++++++ Source/AppAuthTV/OIDTVServiceConfiguration.h | 15 +-- Source/AppAuthTV/OIDTVServiceConfiguration.m | 15 +++ UnitTests/OIDServiceDiscoveryTests.m | 86 ++++++++------- 8 files changed, 240 insertions(+), 71 deletions(-) diff --git a/Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.m b/Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.m index bb40c3426..c65ee4e0d 100644 --- a/Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.m +++ b/Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.m @@ -21,6 +21,12 @@ #import #import +/*! @brief Indicates whether YES to discover endpoints from @c kIssuer or NO to use the + @c kTVAuthorizationEndpoint, @c kTokenEndpoint, and @c kUserInfoEndpoint values defined + below. + */ +static BOOL const shouldDiscoverEndpoints = YES; + /*! @brief OAuth client ID. */ static NSString *const kClientID = @"YOUR_CLIENT_ID"; @@ -29,17 +35,21 @@ */ static NSString *const kClientSecret = @"YOUR_CLIENT_SECRET"; +/*! @brief The OIDC issuer from which the configuration will be discovered. + */ +static NSString *const kIssuer = @"https://issuer.example.com"; + /*! @brief Device authorization endpoint. */ -static NSString *const kTVAuthorizationEndpoint = @"https://oauth.example.com/device"; +static NSString *const kTVAuthorizationEndpoint = @"https://www.example.com/device"; /*! @brief Token endpoint. */ -static NSString *const kTokenEndpoint = @"https://oauth.example.com/token"; +static NSString *const kTokenEndpoint = @"https://www.example.com/token"; /*! @brief User info endpoint. */ -static NSString *const kUserInfoEndpoint = @"https://oauth.example.com/userinfo"; +static NSString *const kUserInfoEndpoint = @"https://www.example.com/userinfo"; /*! @brief NSCoding key for the authorization property. */ @@ -73,9 +83,6 @@ - (void)viewDidLoad { - (void)verifyConfig { #if !defined(NS_BLOCK_ASSERTIONS) - // The example needs to be configured with your own client details. - // See: https://github.com/openid/AppAuth-iOS/blob/master/Examples/Example-tvOS/README.md - NSAssert(![kClientID isEqualToString:@"YOUR_CLIENT_ID"], @"Update kClientID with your own client ID. " "Instructions: " @@ -86,20 +93,27 @@ - (void)verifyConfig { "Instructions: " "https://github.com/openid/AppAuth-iOS/blob/master/Examples/Example-tvOS/README.md"); - NSAssert(![kTVAuthorizationEndpoint isEqualToString:@"https://oauth.example.com/device"], - @"Update kTVAuthorizationEndpoint with your own TV authorization endpoint. " - "Instructions: " - "https://github.com/openid/AppAuth-iOS/blob/master/Examples/Example-tvOS/README.md"); - - NSAssert(![kTokenEndpoint isEqualToString:@"https://oauth.example.com/token"], - @"Update kTokenEndpoint with your own token endpoint. " - "Instructions: " - "https://github.com/openid/AppAuth-iOS/blob/master/Examples/Example-tvOS/README.md"); - - NSAssert(![kUserInfoEndpoint isEqualToString:@"https://oauth.example.com/userinfo"], - @"Update kUserInfoEndpoint with your own user info endpoint. " - "Instructions: " - "https://github.com/openid/AppAuth-iOS/blob/master/Examples/Example-tvOS/README.md"); + if (shouldDiscoverEndpoints) { + NSAssert(![kIssuer isEqualToString:@"https://issuer.example.com"], + @"Update kIssuer with your own issuer. " + "Instructions: " + "https://github.com/openid/AppAuth-iOS/blob/master/Examples/Example-tvOS/README.md"); + } else { + NSAssert(![kTVAuthorizationEndpoint isEqualToString:@"https://www.example.com/device"], + @"Update kTVAuthorizationEndpoint with your own TV authorization endpoint. " + "Instructions: " + "https://github.com/openid/AppAuth-iOS/blob/master/Examples/Example-tvOS/README.md"); + + NSAssert(![kTokenEndpoint isEqualToString:@"https://www.example.com/token"], + @"Update kTokenEndpoint with your own token endpoint. " + "Instructions: " + "https://github.com/openid/AppAuth-iOS/blob/master/Examples/Example-tvOS/README.md"); + + NSAssert(![kUserInfoEndpoint isEqualToString:@"https://www.example.com/userinfo"], + @"Update kUserInfoEndpoint with your own user info endpoint. " + "Instructions: " + "https://github.com/openid/AppAuth-iOS/blob/master/Examples/Example-tvOS/README.md"); + } #endif // !defined(NS_BLOCK_ASSERTIONS) } @@ -115,7 +129,6 @@ - (void)didChangeState:(OIDAuthState *)state { - (void)authState:(OIDAuthState *)state didEncounterAuthorizationError:(nonnull NSError *)error { [self logMessage:@"Received authorization error: %@", error]; } - /*! @brief Initiates the sign-in. @param sender IBAction sender. */ @@ -124,15 +137,40 @@ - (IBAction)signin:(id)sender { [self cancelSignIn:nil]; } - // builds authentication request - NSURL *TVAuthorizationEndpoint = [NSURL URLWithString:kTVAuthorizationEndpoint]; - NSURL *tokenEndpoint = [NSURL URLWithString:kTokenEndpoint]; + if (shouldDiscoverEndpoints) { + NSURL *issuer = [NSURL URLWithString:kIssuer]; + + // Discover endpoints + [OIDTVAuthorizationService discoverServiceConfigurationForIssuer:issuer + completion:^(OIDTVServiceConfiguration *_Nullable configuration, NSError *_Nullable error) { + if (!configuration) { + [self logMessage:@"Error retrieving discovery document: %@", [error localizedDescription]]; + [self setAuthState:nil]; + return; + } + + [self logMessage:@"Got configuration: %@", configuration]; + + // Perform authorization flow + [self performAuthorizationWithConfiguration:configuration]; + }]; + } else { + NSURL *TVAuthorizationEndpoint = [NSURL URLWithString:kTVAuthorizationEndpoint]; + NSURL *tokenEndpoint = [NSURL URLWithString:kTokenEndpoint]; + + OIDTVServiceConfiguration *configuration = + [[OIDTVServiceConfiguration alloc] initWithTVAuthorizationEndpoint:TVAuthorizationEndpoint + tokenEndpoint:tokenEndpoint]; + + // Perform authorization flow + [self performAuthorizationWithConfiguration:configuration]; + } +} +- (void)performAuthorizationWithConfiguration:(OIDTVServiceConfiguration *)configuration { + // builds authentication request __weak __typeof(self) weakSelf = self; - OIDTVServiceConfiguration *configuration = - [[OIDTVServiceConfiguration alloc] initWithTVAuthorizationEndpoint:TVAuthorizationEndpoint - tokenEndpoint:tokenEndpoint]; OIDTVAuthorizationRequest *request = [[OIDTVAuthorizationRequest alloc] initWithConfiguration:configuration clientId:kClientID @@ -241,7 +279,15 @@ - (IBAction)clearLog:(nullable id)sender { @param sender IBAction sender. */ - (IBAction)userinfo:(nullable id)sender { - NSURL *userinfoEndpoint = [NSURL URLWithString:kUserInfoEndpoint]; + NSURL *userinfoEndpoint; + + if (shouldDiscoverEndpoints) { + userinfoEndpoint = _authState.lastAuthorizationResponse.request.configuration.discoveryDocument + .userinfoEndpoint; + } else { + userinfoEndpoint = [NSURL URLWithString:kUserInfoEndpoint]; + } + NSString *currentAccessToken = _authState.lastTokenResponse.accessToken; [self logMessage:@"Performing userinfo request"]; diff --git a/Source/AppAuthCore/OIDServiceDiscovery.h b/Source/AppAuthCore/OIDServiceDiscovery.h index 577700834..3998fa12b 100644 --- a/Source/AppAuthCore/OIDServiceDiscovery.h +++ b/Source/AppAuthCore/OIDServiceDiscovery.h @@ -44,6 +44,12 @@ NS_ASSUME_NONNULL_BEGIN */ @property(nonatomic, readonly) NSURL *authorizationEndpoint; +/*! @brief OPTIONAL. URL of the OP's OAuth 2.0 Device Authorization Endpoint. + @remarks device_authorization_endpoint + @seealso https://tools.ietf.org/html/rfc8628#section-4 + */ +@property(nonatomic, readonly, nullable) NSURL *deviceAuthorizationEndpoint; + /*! @brief URL of the OP's OAuth 2.0 Token Endpoint. This is REQUIRED unless only the Implicit Flow is used. @remarks token_endpoint diff --git a/Source/AppAuthCore/OIDServiceDiscovery.m b/Source/AppAuthCore/OIDServiceDiscovery.m index ca81108a8..739275251 100644 --- a/Source/AppAuthCore/OIDServiceDiscovery.m +++ b/Source/AppAuthCore/OIDServiceDiscovery.m @@ -26,6 +26,7 @@ /*! Field keys associated with an OpenID Connect Discovery Document. */ static NSString *const kIssuerKey = @"issuer"; static NSString *const kAuthorizationEndpointKey = @"authorization_endpoint"; +static NSString *const kDeviceAuthorizationEndpointKey = @"device_authorization_endpoint"; static NSString *const kTokenEndpointKey = @"token_endpoint"; static NSString *const kUserinfoEndpointKey = @"userinfo_endpoint"; static NSString *const kJWKSURLKey = @"jwks_uri"; @@ -217,6 +218,10 @@ - (NSURL *)authorizationEndpoint { return [NSURL URLWithString:_discoveryDictionary[kAuthorizationEndpointKey]]; } +- (nullable NSURL *)deviceAuthorizationEndpoint { + return [NSURL URLWithString:_discoveryDictionary[kDeviceAuthorizationEndpointKey]]; +} + - (NSURL *)tokenEndpoint { return [NSURL URLWithString:_discoveryDictionary[kTokenEndpointKey]]; } diff --git a/Source/AppAuthTV/OIDTVAuthorizationService.h b/Source/AppAuthTV/OIDTVAuthorizationService.h index 2a9bfe571..93158579c 100644 --- a/Source/AppAuthTV/OIDTVAuthorizationService.h +++ b/Source/AppAuthTV/OIDTVAuthorizationService.h @@ -25,6 +25,14 @@ NS_ASSUME_NONNULL_BEGIN @class OIDTVAuthorizationResponse; @class OIDTVServiceConfiguration; +/*! @brief Represents the type of block used as a callback for creating a TV service configuration from + a remote OpenID Connect Discovery document. + @param configuration The TV service configuration, if available. + @param error The error if an error occurred. + */ +typedef void (^OIDTVDiscoveryCallback)(OIDTVServiceConfiguration *_Nullable configuration, + NSError *_Nullable error); + /*! @brief The block that is called when the TV authorization has initialized. @param response The authorization response, or nil if there was an error. Display @c OIDTVAuthorizationResponse.userCode and @c OIDTVAuthorizationResponse.verificationURI to @@ -52,6 +60,34 @@ typedef void (^OIDTVAuthorizationCancelBlock)(void); /*! @brief Performs authorization flows designed for TVs and other limited input devices. */ @interface OIDTVAuthorizationService : NSObject +/*! @internal + @brief Unavailable. This class should not be initialized. + */ +- (instancetype)init NS_UNAVAILABLE; + +/*! @brief Convenience method for creating a TV authorization service configuration from an OpenID + Connect compliant issuer URL. This method validates the presence of a device authorization + endpoint in the retrieved discovery document and instantiates an + @c OIDTVServiceConfiguration. + @param issuerURL The service provider's OpenID Connect issuer. + @param completion A block which will be invoked when the authorization service configuration has + been created, or when an error has occurred. + @see https://openid.net/specs/openid-connect-discovery-1_0.html + */ ++ (void)discoverServiceConfigurationForIssuer:(NSURL *)issuerURL + completion:(OIDTVDiscoveryCallback)completion; + +/*! @brief Convenience method for creating a TV authorization service configuration from an OpenID + Connect compliant identity provider's discovery document. This method validates the presence + of a device authorization endpoint in the retrieved discovery document and instantiates an + @c OIDTVServiceConfiguration. + @param discoveryURL The URL of the service provider's OpenID Connect discovery document. + @param completion A block which will be invoked when the authorization service configuration has + been created, or when an error has occurred. + @see https://openid.net/specs/openid-connect-discovery-1_0.html + */ ++ (void)discoverServiceConfigurationForDiscoveryURL:(NSURL *)discoveryURL + completion:(OIDTVDiscoveryCallback)completion; /*! @brief Starts a TV authorization flow with the given request and polls for a response. @param request The TV authorization request to initiate. diff --git a/Source/AppAuthTV/OIDTVAuthorizationService.m b/Source/AppAuthTV/OIDTVAuthorizationService.m index 944d722df..eaa4d6bfc 100644 --- a/Source/AppAuthTV/OIDTVAuthorizationService.m +++ b/Source/AppAuthTV/OIDTVAuthorizationService.m @@ -22,7 +22,9 @@ #import "OIDAuthState.h" #import "OIDDefines.h" #import "OIDErrorUtilities.h" +#import "OIDServiceDiscovery.h" #import "OIDURLQueryComponent.h" +#import "OIDURLSessionProvider.h" #import "OIDTVAuthorizationRequest.h" #import "OIDTVAuthorizationResponse.h" @@ -39,8 +41,52 @@ */ NSString *const kErrorCodeSlowDown = @"slow_down"; +/*! @brief Path appended to an OpenID Connect issuer for discovery + @see https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig + */ +static NSString *const kOpenIDConfigurationWellKnownPath = @".well-known/openid-configuration"; + @implementation OIDTVAuthorizationService +#pragma mark OIDC Discovery + ++ (void)discoverServiceConfigurationForIssuer:(NSURL *)issuerURL + completion:(OIDTVDiscoveryCallback)completion { + NSURL *fullDiscoveryURL = + [issuerURL URLByAppendingPathComponent:kOpenIDConfigurationWellKnownPath]; + + [[self class] discoverServiceConfigurationForDiscoveryURL:fullDiscoveryURL + completion:completion]; +} + ++ (void)discoverServiceConfigurationForDiscoveryURL:(NSURL *)discoveryURL + completion:(OIDTVDiscoveryCallback)completion { + // Call the corresponding discovery method in OIDAuthorizationService + [OIDAuthorizationService discoverServiceConfigurationForDiscoveryURL:discoveryURL + completion:^(OIDServiceConfiguration * _Nullable configuration, NSError * _Nullable error) { + if (configuration == nil) { + completion(nil, error); + return; + } + + if (configuration.discoveryDocument.deviceAuthorizationEndpoint == nil) { + NSError *missingEndpointError = [OIDErrorUtilities + errorWithCode:OIDErrorCodeInvalidDiscoveryDocument + underlyingError:nil + description:@"Discovery document does not contain device authorization endpoint."]; + + completion(nil, missingEndpointError); + return; + } + + // Create an OIDTVServiceConfiguration from the discovery document of the configuration + OIDTVServiceConfiguration *TVConfiguration = [[OIDTVServiceConfiguration alloc] + initWithDiscoveryDocument:configuration.discoveryDocument]; + + completion(TVConfiguration, nil); + }]; +} + #pragma mark - Initializers + (OIDTVAuthorizationCancelBlock)authorizeTVRequest:(OIDTVAuthorizationRequest *)request diff --git a/Source/AppAuthTV/OIDTVServiceConfiguration.h b/Source/AppAuthTV/OIDTVServiceConfiguration.h index b3d60e748..bdedcdd10 100644 --- a/Source/AppAuthTV/OIDTVServiceConfiguration.h +++ b/Source/AppAuthTV/OIDTVServiceConfiguration.h @@ -30,22 +30,23 @@ NS_ASSUME_NONNULL_BEGIN /*! @internal @brief Unavailable. Please use - @c initWithAuthorizationEndpoint:TVAuthorizationEndpoint:tokenEndpoint: + @c initWithTVAuthorizationEndpoint:tokenEndpoint: */ - (instancetype)init NS_UNAVAILABLE; /*! @internal @brief Unavailable. Please use - @c initWithAuthorizationEndpoint:TVAuthorizationEndpoint:tokenEndpoint: + @c initWithTVAuthorizationEndpoint:tokenEndpoint: */ - (instancetype)initWithAuthorizationEndpoint:(NSURL *)authorizationEndpoint tokenEndpoint:(NSURL *)tokenEndpoint NS_UNAVAILABLE; -/*! @internal - @brief Unavailable. Please use - @c initWithAuthorizationEndpoint:TVAuthorizationEndpoint:tokenEndpoint: - */ -- (instancetype)initWithDiscoveryDocument:(OIDServiceDiscovery *)discoveryDocument NS_UNAVAILABLE; +/*! @brief Designated initializer. + @param discoveryDocument The discovery document from which to extract the required OAuth + configuration. +*/ +- (instancetype)initWithDiscoveryDocument:(OIDServiceDiscovery *)discoveryDocument + NS_DESIGNATED_INITIALIZER; /*! @brief Designated initializer. @param TVAuthorizationEndpoint The TV authorization endpoint URI. diff --git a/Source/AppAuthTV/OIDTVServiceConfiguration.m b/Source/AppAuthTV/OIDTVServiceConfiguration.m index 0198475c3..c20883d18 100644 --- a/Source/AppAuthTV/OIDTVServiceConfiguration.m +++ b/Source/AppAuthTV/OIDTVServiceConfiguration.m @@ -19,6 +19,7 @@ #import "OIDTVServiceConfiguration.h" #import "OIDDefines.h" +#import "OIDServiceDiscovery.h" /*! @brief The key for the @c TVAuthorizationEndpoint property. */ @@ -44,6 +45,20 @@ - (instancetype)initWithAuthorizationEndpoint:(NSURL *)authorizationEndpoint tokenEndpoint:(NSURL *)tokenEndpoint OID_UNAVAILABLE_USE_INITIALIZER(@selector(initWithTVAuthorizationEndpoint:tokenEndpoint:)) +- (instancetype)initWithDiscoveryDocument:(OIDServiceDiscovery *)discoveryDocument { + self = [super initWithDiscoveryDocument:discoveryDocument]; + + if (self) { + if (discoveryDocument.deviceAuthorizationEndpoint == nil) { + NSLog(@"Warning: Discovery document used to initialize %@ " + @"does not contain device authorization endpoint.", self); + } else { + _TVAuthorizationEndpoint = [discoveryDocument.deviceAuthorizationEndpoint copy]; + } + } + return self; +} + - (instancetype)initWithTVAuthorizationEndpoint:(NSURL *)TVAuthorizationEndpoint tokenEndpoint:(NSURL *)tokenEndpoint { self = [super initWithAuthorizationEndpoint:[[NSURL alloc] initWithString:@""] diff --git a/UnitTests/OIDServiceDiscoveryTests.m b/UnitTests/OIDServiceDiscoveryTests.m index 574cd794f..17d6cd19e 100644 --- a/UnitTests/OIDServiceDiscoveryTests.m +++ b/UnitTests/OIDServiceDiscoveryTests.m @@ -39,6 +39,7 @@ /*! Field keys associated with an OpenID Connect Discovery Document. */ static NSString *const kIssuerKey = @"issuer"; static NSString *const kAuthorizationEndpointKey = @"authorization_endpoint"; +static NSString *const kDeviceAuthorizationEndpointKey = @"device_authorization_endpoint"; static NSString *const kTokenEndpointKey = @"token_endpoint"; static NSString *const kUserinfoEndpointKey = @"userinfo_endpoint"; static NSString *const kJWKSURLKey = @"jwks_uri"; @@ -103,6 +104,7 @@ + (NSDictionary *)completeServiceDiscoveryDictionary { return @{ kIssuerKey : @"http://www.example.com/issuer", kAuthorizationEndpointKey : @"http://www.example.com/authorization", + kDeviceAuthorizationEndpointKey : @"http://www.example.com/device", kTokenEndpointKey : @"http://www.example.com/token", kUserinfoEndpointKey : @"User Info Endpoint", kJWKSURLKey : @"http://www.example.com/jwks", @@ -152,47 +154,58 @@ + (NSURL *)googleDiscoveryAuthorizationEndpoint { // from https://accounts.google.com/.well-known/openid-configuration static NSString *const kDiscoveryDocument = - @"{\"issuer\":\"https://accounts.google.com\",\"authorization_endpoint\":\"https://account" - "s.google.com/o/oauth2/v2/auth\",\"token_endpoint\":\"https://www.googleapis.com/oauth2/v4/to" - "ken\",\"userinfo_endpoint\":\"https://www.googleapis.com/oauth2/v3/userinfo\",\"revocation_e" - "ndpoint\":\"https://accounts.google.com/o/oauth2/revoke\",\"jwks_uri\":\"https://www.googlea" - "pis.com/oauth2/v3/certs\",\"response_types_supported\":[\"code\",\"token\",\"id_token\",\"co" - "de token\",\"code id_token\",\"token id_token\",\"code token id_token\",\"none\"],\"subject_" - "types_supported\":[\"public\"],\"id_token_signing_alg_values_supported\":[\"RS256\"],\"scope" - "s_supported\":[\"openid\",\"email\",\"profile\"],\"token_endpoint_auth_methods_supported\":[" - "\"client_secret_post\",\"client_secret_basic\"],\"claims_supported\":[\"aud\",\"email\",\"em" - "ail_verified\",\"exp\",\"family_name\",\"given_name\",\"iat\",\"iss\",\"locale\",\"name\",\"" - "picture\",\"sub\"]}"; + @"{\"issuer\":\"https://accounts.google.com\",\"authorization_endpoint\":\"https://" + @"accounts.google.com/o/oauth2/v2/auth\",\"device_authorization_endpoint\":\"https://" + @"oauth2.googleapis.com/device/code\",\"token_endpoint\":\"https://oauth2.googleapis.com/" + @"token\",\"userinfo_endpoint\":\"https://openidconnect.googleapis.com/v1/" + @"userinfo\",\"revocation_endpoint\":\"https://oauth2.googleapis.com/" + @"revoke\",\"jwks_uri\":\"https://www.googleapis.com/oauth2/v3/" + @"certs\",\"response_types_supported\":[\"code\",\"token\",\"id_token\",\"codetoken\",\"codeid_" + @"token\",\"tokenid_token\",\"codetokenid_token\",\"none\"],\"subject_types_supported\":[" + @"\"public\"],\"id_token_signing_alg_values_supported\":[\"RS256\"],\"scopes_supported\":[" + @"\"openid\",\"email\",\"profile\"],\"token_endpoint_auth_methods_supported\":[\"client_secret_" + @"post\",\"client_secret_basic\"],\"claims_supported\":[\"aud\",\"email\",\"email_verified\"," + @"\"exp\",\"family_name\",\"given_name\",\"iat\",\"iss\",\"locale\",\"name\",\"picture\"," + @"\"sub\"],\"code_challenge_methods_supported\":[\"plain\",\"S256\"],\"grant_types_supported\":" + @"[\"authorization_code\",\"refresh_token\",\"urn:ietf:params:oauth:grant-type:device_code\"," + @"\"urn:ietf:params:oauth:grant-type:jwt-bearer\"]}"; // from https://accounts.google.com/.well-known/openid-configuration with authorization_endpoint // removed static NSString *const kDiscoveryDocumentMissingField = - @"{\"issuer\":\"https://accounts.google.com\",\"token_endpoint\":\"https://www.googleapis." - "com/oauth2/v4/to" - "ken\",\"userinfo_endpoint\":\"https://www.googleapis.com/oauth2/v3/userinfo\",\"revocation_e" - "ndpoint\":\"https://accounts.google.com/o/oauth2/revoke\",\"jwks_uri\":\"https://www.googlea" - "pis.com/oauth2/v3/certs\",\"response_types_supported\":[\"code\",\"token\",\"id_token\",\"co" - "de token\",\"code id_token\",\"token id_token\",\"code token id_token\",\"none\"],\"subject_" - "types_supported\":[\"public\"],\"id_token_signing_alg_values_supported\":[\"RS256\"],\"scope" - "s_supported\":[\"openid\",\"email\",\"profile\"],\"token_endpoint_auth_methods_supported\":[" - "\"client_secret_post\",\"client_secret_basic\"],\"claims_supported\":[\"aud\",\"email\",\"em" - "ail_verified\",\"exp\",\"family_name\",\"given_name\",\"iat\",\"iss\",\"locale\",\"name\",\"" - "picture\",\"sub\"]}"; - - // from https://accounts.google.com/.well-known/openid-configuration with authorization_endpoint - // and token_endpoint set to JSON 'null' + @"{\"issuer\":\"https://accounts.google.com\",\"device_authorization_endpoint\":\"https://" + @"oauth2.googleapis.com/device/code\",\"token_endpoint\":\"https://oauth2.googleapis.com/" + @"token\",\"userinfo_endpoint\":\"https://openidconnect.googleapis.com/v1/" + @"userinfo\",\"revocation_endpoint\":\"https://oauth2.googleapis.com/" + @"revoke\",\"jwks_uri\":\"https://www.googleapis.com/oauth2/v3/" + @"certs\",\"response_types_supported\":[\"code\",\"token\",\"id_token\",\"codetoken\",\"codeid_" + @"token\",\"tokenid_token\",\"codetokenid_token\",\"none\"],\"subject_types_supported\":[" + @"\"public\"],\"id_token_signing_alg_values_supported\":[\"RS256\"],\"scopes_supported\":[" + @"\"openid\",\"email\",\"profile\"],\"token_endpoint_auth_methods_supported\":[\"client_secret_" + @"post\",\"client_secret_basic\"],\"claims_supported\":[\"aud\",\"email\",\"email_verified\"," + @"\"exp\",\"family_name\",\"given_name\",\"iat\",\"iss\",\"locale\",\"name\",\"picture\"," + @"\"sub\"],\"code_challenge_methods_supported\":[\"plain\",\"S256\"],\"grant_types_supported\":" + @"[\"authorization_code\",\"refresh_token\",\"urn:ietf:params:oauth:grant-type:device_code\"," + @"\"urn:ietf:params:oauth:grant-type:jwt-bearer\"]}"; + +// from https://accounts.google.com/.well-known/openid-configuration with authorization_endpoint +// and token_endpoint set to JSON 'null' static NSString *const kDiscoveryDocumentNullField = - @"{\"issuer\":\"https://accounts.google.com\",\"authorization_endpoint\":null," - "\"token_endpoint\":null" - ",\"userinfo_endpoint\":\"https://www.googleapis.com/oauth2/v3/userinfo\",\"revocation_e" - "ndpoint\":\"https://accounts.google.com/o/oauth2/revoke\",\"jwks_uri\":\"https://www.googlea" - "pis.com/oauth2/v3/certs\",\"response_types_supported\":[\"code\",\"token\",\"id_token\",\"co" - "de token\",\"code id_token\",\"token id_token\",\"code token id_token\",\"none\"],\"subject_" - "types_supported\":[\"public\"],\"id_token_signing_alg_values_supported\":[\"RS256\"],\"scope" - "s_supported\":[\"openid\",\"email\",\"profile\"],\"token_endpoint_auth_methods_supported\":[" - "\"client_secret_post\",\"client_secret_basic\"],\"claims_supported\":[\"aud\",\"email\",\"em" - "ail_verified\",\"exp\",\"family_name\",\"given_name\",\"iat\",\"iss\",\"locale\",\"name\",\"" - "picture\",\"sub\"]}"; + @"{\"issuer\":\"https://" + @"accounts.google.com\",\"authorization_endpoint\":null,\"device_authorization_endpoint\":" + @"\"https://oauth2.googleapis.com/device/" + @"code\",\"token_endpoint\":null,\"userinfo_endpoint\":\"https://openidconnect.googleapis.com/" + @"v1/userinfo\",\"revocation_endpoint\":\"https://oauth2.googleapis.com/" + @"revoke\",\"jwks_uri\":\"https://www.googleapis.com/oauth2/v3/" + @"certs\",\"response_types_supported\":[\"code\",\"token\",\"id_token\",\"codetoken\",\"codeid_" + @"token\",\"tokenid_token\",\"codetokenid_token\",\"none\"],\"subject_types_supported\":[" + @"\"public\"],\"id_token_signing_alg_values_supported\":[\"RS256\"],\"scopes_supported\":[" + @"\"openid\",\"email\",\"profile\"],\"token_endpoint_auth_methods_supported\":[\"client_secret_" + @"post\",\"client_secret_basic\"],\"claims_supported\":[\"aud\",\"email\",\"email_verified\"," + @"\"exp\",\"family_name\",\"given_name\",\"iat\",\"iss\",\"locale\",\"name\",\"picture\"," + @"\"sub\"],\"code_challenge_methods_supported\":[\"plain\",\"S256\"],\"grant_types_supported\":" + @"[\"authorization_code\",\"refresh_token\",\"urn:ietf:params:oauth:grant-type:device_code\"," + @"\"urn:ietf:params:oauth:grant-type:jwt-bearer\"]}"; static NSString *const kDiscoveryDocumentNotDictionary = @"[\"code\",\"token\",\"id_token\",\"code token\",\"code id_token\",\"token id_token\",\"code to" @@ -489,6 +502,7 @@ - (void)testField_##_field_ { TestURLFieldBackedBy(issuer, kIssuerKey, kTestURL) TestURLFieldBackedBy(authorizationEndpoint, kAuthorizationEndpointKey, kTestURL) +TestURLFieldBackedBy(deviceAuthorizationEndpoint, kDeviceAuthorizationEndpointKey, kTestURL) TestURLFieldBackedBy(tokenEndpoint, kTokenEndpointKey, kTestURL) TestURLFieldBackedBy(userinfoEndpoint, kUserinfoEndpointKey, kTestURL) TestURLFieldBackedBy(jwksURL, kJWKSURLKey, kTestURL) From e46c433a8dee333015edb9484ddf9c64276e9d49 Mon Sep 17 00:00:00 2001 From: Julien Bodet Date: Sun, 11 Mar 2018 16:29:46 -0400 Subject: [PATCH 16/81] Add extension for Example-iOS_ObjC --- .../project.pbxproj | 225 +++++++++++++++++- .../Base.lproj/MainInterface.storyboard | 75 ++++++ .../Example-iOS_ObjC_Extension/Info.plist | 31 +++ .../TodayViewController.h | 13 + .../TodayViewController.m | 214 +++++++++++++++++ Examples/Example-iOS_ObjC/Podfile | 10 +- 6 files changed, 565 insertions(+), 3 deletions(-) create mode 100644 Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/Base.lproj/MainInterface.storyboard create mode 100644 Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/Info.plist create mode 100644 Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.h create mode 100644 Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.m diff --git a/Examples/Example-iOS_ObjC/Example-iOS_ObjC.xcodeproj/project.pbxproj b/Examples/Example-iOS_ObjC/Example-iOS_ObjC.xcodeproj/project.pbxproj index 0e1a19c74..6d898dc8c 100644 --- a/Examples/Example-iOS_ObjC/Example-iOS_ObjC.xcodeproj/project.pbxproj +++ b/Examples/Example-iOS_ObjC/Example-iOS_ObjC.xcodeproj/project.pbxproj @@ -7,6 +7,10 @@ objects = { /* Begin PBXBuildFile section */ + 06D4812F2055C3D400D9DC32 /* NotificationCenter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06D4812E2055C3D400D9DC32 /* NotificationCenter.framework */; }; + 06D481332055C3D400D9DC32 /* TodayViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 06D481322055C3D400D9DC32 /* TodayViewController.m */; }; + 06D481362055C3D400D9DC32 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 06D481342055C3D400D9DC32 /* MainInterface.storyboard */; }; + 06D4813A2055C3D400D9DC32 /* Example-iOS_ObjC_Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 06D4812D2055C3D400D9DC32 /* Example-iOS_ObjC_Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 341310AA1E6DEF7000D5DEE5 /* AppAuthExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 341310A91E6DEF7000D5DEE5 /* AppAuthExampleTests.m */; }; 346E916E1C29D42800D3620B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 346E916D1C29D42800D3620B /* main.m */; }; 346E91711C29D42800D3620B /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 346E91701C29D42800D3620B /* AppDelegate.m */; }; @@ -15,10 +19,18 @@ 346E91991C2A245000D3620B /* SafariServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 346E91981C2A245000D3620B /* SafariServices.framework */; }; 34CB09BD1C42007600A54261 /* AppAuthExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34CB09BB1C42007600A54261 /* AppAuthExampleViewController.m */; }; 34CB09BE1C42007600A54261 /* AppAuthExampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 34CB09BC1C42007600A54261 /* AppAuthExampleViewController.xib */; }; + D0B5FA33D74A6F7924A47471 /* libPods-Example-iOS_ObjC_Extension.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 715EDB7EC4271193E47615ED /* libPods-Example-iOS_ObjC_Extension.a */; }; E46F8589CE9E5DDFA69D835B /* libPods-Example-iOS_ObjC.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B61A918CBE7B8142CD7D8B3 /* libPods-Example-iOS_ObjC.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + 06D481382055C3D400D9DC32 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 346E91611C29D42800D3620B /* Project object */; + proxyType = 1; + remoteGlobalIDString = 06D4812C2055C3D400D9DC32; + remoteInfo = "Example-iOS_ObjC_Extension"; + }; 341310AC1E6DEF7000D5DEE5 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 346E91611C29D42800D3620B /* Project object */; @@ -28,7 +40,27 @@ }; /* End PBXContainerItemProxy section */ +/* Begin PBXCopyFilesBuildPhase section */ + 06D4813E2055C3D400D9DC32 /* Embed App Extensions */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + 06D4813A2055C3D400D9DC32 /* Example-iOS_ObjC_Extension.appex in Embed App Extensions */, + ); + name = "Embed App Extensions"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ + 06D4812D2055C3D400D9DC32 /* Example-iOS_ObjC_Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Example-iOS_ObjC_Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; + 06D4812E2055C3D400D9DC32 /* NotificationCenter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NotificationCenter.framework; path = System/Library/Frameworks/NotificationCenter.framework; sourceTree = SDKROOT; }; + 06D481312055C3D400D9DC32 /* TodayViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TodayViewController.h; sourceTree = ""; }; + 06D481322055C3D400D9DC32 /* TodayViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TodayViewController.m; sourceTree = ""; }; + 06D481352055C3D400D9DC32 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = ""; }; + 06D481372055C3D400D9DC32 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 09795EAF079B07A1781675D9 /* libPods-Example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Example.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 0D29B2A58C931A5D41332144 /* Pods-Example-iOS_ObjC.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-iOS_ObjC.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Example-iOS_ObjC/Pods-Example-iOS_ObjC.debug.xcconfig"; sourceTree = ""; }; 341310A71E6DEF7000D5DEE5 /* AppAuthExample-iOS_ObjCTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "AppAuthExample-iOS_ObjCTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -46,6 +78,9 @@ 34CB09BA1C42007600A54261 /* AppAuthExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppAuthExampleViewController.h; sourceTree = ""; }; 34CB09BB1C42007600A54261 /* AppAuthExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppAuthExampleViewController.m; sourceTree = ""; }; 34CB09BC1C42007600A54261 /* AppAuthExampleViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AppAuthExampleViewController.xib; sourceTree = ""; }; + 3A18DF082AC2FA0980C9DE57 /* Pods-Example-iOS_ObjC_Extension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-iOS_ObjC_Extension.release.xcconfig"; path = "Pods/Target Support Files/Pods-Example-iOS_ObjC_Extension/Pods-Example-iOS_ObjC_Extension.release.xcconfig"; sourceTree = ""; }; + 715EDB7EC4271193E47615ED /* libPods-Example-iOS_ObjC_Extension.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Example-iOS_ObjC_Extension.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 86C7660572AE6FF7A4D1592A /* Pods-Example-iOS_ObjC_Extension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-iOS_ObjC_Extension.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Example-iOS_ObjC_Extension/Pods-Example-iOS_ObjC_Extension.debug.xcconfig"; sourceTree = ""; }; 8B61A918CBE7B8142CD7D8B3 /* libPods-Example-iOS_ObjC.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Example-iOS_ObjC.a"; sourceTree = BUILT_PRODUCTS_DIR; }; C4C31DB4A4928F246AA03805 /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig"; sourceTree = ""; }; D9867DC6FA9089CD613D4728 /* Pods-Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Example/Pods-Example.debug.xcconfig"; sourceTree = ""; }; @@ -53,6 +88,15 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 06D4812A2055C3D400D9DC32 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 06D4812F2055C3D400D9DC32 /* NotificationCenter.framework in Frameworks */, + D0B5FA33D74A6F7924A47471 /* libPods-Example-iOS_ObjC_Extension.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 341310A41E6DEF7000D5DEE5 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -72,6 +116,17 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 06D481302055C3D400D9DC32 /* Example-iOS_ObjC_Extension */ = { + isa = PBXGroup; + children = ( + 06D481312055C3D400D9DC32 /* TodayViewController.h */, + 06D481322055C3D400D9DC32 /* TodayViewController.m */, + 06D481342055C3D400D9DC32 /* MainInterface.storyboard */, + 06D481372055C3D400D9DC32 /* Info.plist */, + ); + path = "Example-iOS_ObjC_Extension"; + sourceTree = ""; + }; 341310A81E6DEF7000D5DEE5 /* Tests */ = { isa = PBXGroup; children = ( @@ -88,6 +143,8 @@ 346E91981C2A245000D3620B /* SafariServices.framework */, 09795EAF079B07A1781675D9 /* libPods-Example.a */, 8B61A918CBE7B8142CD7D8B3 /* libPods-Example-iOS_ObjC.a */, + 06D4812E2055C3D400D9DC32 /* NotificationCenter.framework */, + 715EDB7EC4271193E47615ED /* libPods-Example-iOS_ObjC_Extension.a */, ); name = Frameworks; sourceTree = ""; @@ -97,6 +154,7 @@ children = ( 346E916B1C29D42800D3620B /* Source */, 341310A81E6DEF7000D5DEE5 /* Tests */, + 06D481302055C3D400D9DC32 /* Example-iOS_ObjC_Extension */, 341564001C487ABA00ECA3D9 /* Frameworks */, 346E916A1C29D42800D3620B /* Products */, 6DB0B0125441549B9E4A3E6C /* Pods */, @@ -108,6 +166,7 @@ children = ( 346E91691C29D42800D3620B /* Example-iOS_ObjC.app */, 341310A71E6DEF7000D5DEE5 /* AppAuthExample-iOS_ObjCTests.xctest */, + 06D4812D2055C3D400D9DC32 /* Example-iOS_ObjC_Extension.appex */, ); name = Products; sourceTree = ""; @@ -135,6 +194,8 @@ C4C31DB4A4928F246AA03805 /* Pods-Example.release.xcconfig */, 0D29B2A58C931A5D41332144 /* Pods-Example-iOS_ObjC.debug.xcconfig */, ECBCCC4A1A779C83C72044F2 /* Pods-Example-iOS_ObjC.release.xcconfig */, + 86C7660572AE6FF7A4D1592A /* Pods-Example-iOS_ObjC_Extension.debug.xcconfig */, + 3A18DF082AC2FA0980C9DE57 /* Pods-Example-iOS_ObjC_Extension.release.xcconfig */, ); name = Pods; sourceTree = ""; @@ -142,6 +203,25 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ + 06D4812C2055C3D400D9DC32 /* Example-iOS_ObjC_Extension */ = { + isa = PBXNativeTarget; + buildConfigurationList = 06D4813D2055C3D400D9DC32 /* Build configuration list for PBXNativeTarget "Example-iOS_ObjC_Extension" */; + buildPhases = ( + 836219F293F319703A16E68D /* [CP] Check Pods Manifest.lock */, + 06D481292055C3D400D9DC32 /* Sources */, + 06D4812A2055C3D400D9DC32 /* Frameworks */, + 06D4812B2055C3D400D9DC32 /* Resources */, + F998F170E4D14F53FCAA2B07 /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Example-iOS_ObjC_Extension"; + productName = "Example-iOS_ObjC_Extension"; + productReference = 06D4812D2055C3D400D9DC32 /* Example-iOS_ObjC_Extension.appex */; + productType = "com.apple.product-type.app-extension"; + }; 341310A61E6DEF7000D5DEE5 /* AppAuthExample-iOS_ObjCTests */ = { isa = PBXNativeTarget; buildConfigurationList = 341310AE1E6DEF7000D5DEE5 /* Build configuration list for PBXNativeTarget "AppAuthExample-iOS_ObjCTests" */; @@ -170,10 +250,12 @@ 346E91671C29D42800D3620B /* Resources */, 0B0B46F67786AB6E322D5F2B /* [CP] Embed Pods Frameworks */, 3CB1FD4B438DD277394F39A7 /* [CP] Copy Pods Resources */, + 06D4813E2055C3D400D9DC32 /* Embed App Extensions */, ); buildRules = ( ); dependencies = ( + 06D481392055C3D400D9DC32 /* PBXTargetDependency */, ); name = "Example-iOS_ObjC"; productName = Example; @@ -189,6 +271,10 @@ LastUpgradeCheck = 0720; ORGANIZATIONNAME = "William Denniss"; TargetAttributes = { + 06D4812C2055C3D400D9DC32 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Automatic; + }; 341310A61E6DEF7000D5DEE5 = { CreatedOnToolsVersion = 8.2.1; ProvisioningStyle = Automatic; @@ -214,11 +300,20 @@ targets = ( 346E91681C29D42800D3620B /* Example-iOS_ObjC */, 341310A61E6DEF7000D5DEE5 /* AppAuthExample-iOS_ObjCTests */, + 06D4812C2055C3D400D9DC32 /* Example-iOS_ObjC_Extension */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 06D4812B2055C3D400D9DC32 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 06D481362055C3D400D9DC32 /* MainInterface.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 341310A51E6DEF7000D5DEE5 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -269,24 +364,68 @@ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example-iOS_ObjC/Pods-Example-iOS_ObjC-resources.sh\"\n"; showEnvVarsInLog = 0; }; + 836219F293F319703A16E68D /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Example-iOS_ObjC_Extension-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; C4DC5E3A0D4C7419380FA8C2 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Example-iOS_ObjC-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + F998F170E4D14F53FCAA2B07 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example-iOS_ObjC_Extension/Pods-Example-iOS_ObjC_Extension-resources.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 06D481292055C3D400D9DC32 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 06D481332055C3D400D9DC32 /* TodayViewController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 341310A31E6DEF7000D5DEE5 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -308,6 +447,11 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + 06D481392055C3D400D9DC32 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 06D4812C2055C3D400D9DC32 /* Example-iOS_ObjC_Extension */; + targetProxy = 06D481382055C3D400D9DC32 /* PBXContainerItemProxy */; + }; 341310AD1E6DEF7000D5DEE5 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 346E91681C29D42800D3620B /* Example-iOS_ObjC */; @@ -316,6 +460,14 @@ /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ + 06D481342055C3D400D9DC32 /* MainInterface.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 06D481352055C3D400D9DC32 /* Base */, + ); + name = MainInterface.storyboard; + sourceTree = ""; + }; 346E917A1C29D42800D3620B /* LaunchScreen.storyboard */ = { isa = PBXVariantGroup; children = ( @@ -327,6 +479,66 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ + 06D4813B2055C3D400D9DC32 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 86C7660572AE6FF7A4D1592A /* Pods-Example-iOS_ObjC_Extension.debug.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = "Example-iOS_ObjC_Extension/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "net.openid.appauth.Example.Example-iOS-ObjC-Extension"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 06D4813C2055C3D400D9DC32 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 3A18DF082AC2FA0980C9DE57 /* Pods-Example-iOS_ObjC_Extension.release.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = "Example-iOS_ObjC_Extension/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "net.openid.appauth.Example.Example-iOS-ObjC-Extension"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; 341310AF1E6DEF7000D5DEE5 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -456,6 +668,7 @@ baseConfigurationReference = 0D29B2A58C931A5D41332144 /* Pods-Example-iOS_ObjC.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; INFOPLIST_FILE = Source/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 7.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -469,6 +682,7 @@ baseConfigurationReference = ECBCCC4A1A779C83C72044F2 /* Pods-Example-iOS_ObjC.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; INFOPLIST_FILE = Source/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 7.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -480,6 +694,15 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 06D4813D2055C3D400D9DC32 /* Build configuration list for PBXNativeTarget "Example-iOS_ObjC_Extension" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 06D4813B2055C3D400D9DC32 /* Debug */, + 06D4813C2055C3D400D9DC32 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 341310AE1E6DEF7000D5DEE5 /* Build configuration list for PBXNativeTarget "AppAuthExample-iOS_ObjCTests" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/Base.lproj/MainInterface.storyboard b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/Base.lproj/MainInterface.storyboard new file mode 100644 index 000000000..f9e3f4b64 --- /dev/null +++ b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/Base.lproj/MainInterface.storyboard @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/Info.plist b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/Info.plist new file mode 100644 index 000000000..8839cbabf --- /dev/null +++ b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/Info.plist @@ -0,0 +1,31 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Example-iOS_ObjC_Extension + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + XPC! + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + NSExtension + + NSExtensionMainStoryboard + MainInterface + NSExtensionPointIdentifier + com.apple.widget-extension + + + diff --git a/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.h b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.h new file mode 100644 index 000000000..89f148304 --- /dev/null +++ b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.h @@ -0,0 +1,13 @@ +// +// TodayViewController.h +// Example-iOS_ObjC_Extension +// +// Created by Julien Bodet on 2018-03-11. +// Copyright © 2018 William Denniss. All rights reserved. +// + +#import + +@interface TodayViewController : UIViewController + +@end diff --git a/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.m b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.m new file mode 100644 index 000000000..2c356326a --- /dev/null +++ b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.m @@ -0,0 +1,214 @@ +// +// TodayViewController.m +// Example-iOS_ObjC_Extension +// +// Created by Julien Bodet on 2018-03-11. +// Copyright © 2018 William Denniss. All rights reserved. +// + +#import "TodayViewController.h" +#import +#import + +static NSString *const kAppAuthExampleAuthStateKey = @"authState"; + +@interface TodayViewController () + +@property(nonatomic, readonly, nullable) OIDAuthState *authState; +@property (weak, nonatomic) IBOutlet UITextView *logTextView; + +@end + +@implementation TodayViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + if ([self.extensionContext respondsToSelector:@selector(setWidgetLargestAvailableDisplayMode:)]) { // iOS 10+ + [self.extensionContext setWidgetLargestAvailableDisplayMode:NCWidgetDisplayModeExpanded]; + } else { + self.preferredContentSize = CGSizeMake(0, 600.0); // iOS 10- + } + + [self loadState]; +} + +- (void) viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; +} + +- (void)widgetActiveDisplayModeDidChange:(NCWidgetDisplayMode)activeDisplayMode + withMaximumSize:(CGSize)maxSize { + + if (activeDisplayMode == NCWidgetDisplayModeExpanded) { + self.preferredContentSize = CGSizeMake(maxSize.width, 600.0); + } else if (activeDisplayMode == NCWidgetDisplayModeCompact) { + self.preferredContentSize = maxSize; + } +} + +- (void)widgetPerformUpdateWithCompletionHandler:(void (^)(NCUpdateResult))completionHandler { + // Perform any setup necessary in order to update the view. + + // If an error is encountered, use NCUpdateResultFailed + // If there's no update required, use NCUpdateResultNoData + // If there's an update, use NCUpdateResultNewData + + completionHandler(NCUpdateResultNewData); +} + +/*! @brief Loads the @c OIDAuthState from @c NSUSerDefaults. + */ +- (void)loadState { + // loads OIDAuthState from NSUSerDefaults + NSData *archivedAuthState = + [[NSUserDefaults standardUserDefaults] objectForKey:kAppAuthExampleAuthStateKey]; + OIDAuthState *authState = [NSKeyedUnarchiver unarchiveObjectWithData:archivedAuthState]; + [self setAuthState:authState]; +} + +/*! @brief Saves the @c OIDAuthState to @c NSUSerDefaults. + */ +- (void)saveState { + // for production usage consider using the OS Keychain instead + NSData *archivedAuthState = [ NSKeyedArchiver archivedDataWithRootObject:_authState]; + [[NSUserDefaults standardUserDefaults] setObject:archivedAuthState + forKey:kAppAuthExampleAuthStateKey]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} + +- (void)setAuthState:(nullable OIDAuthState *)authState { + if (_authState == authState) { + return; + } + _authState = authState; + _authState.stateChangeDelegate = self; + [self stateChanged]; +} + +- (void)stateChanged { + [self saveState]; +} + +- (void)didChangeState:(OIDAuthState *)state { + [self stateChanged]; +} + +- (IBAction)getUserInfo:(UIButton *)sender { + NSURL *userinfoEndpoint = + _authState.lastAuthorizationResponse.request.configuration.discoveryDocument.userinfoEndpoint; + if (!userinfoEndpoint) { + [self logMessage:@"Userinfo endpoint not declared in discovery document"]; + return; + } + NSString *currentAccessToken = _authState.lastTokenResponse.accessToken; + + [self logMessage:@"Performing userinfo request"]; + + [_authState performActionWithFreshTokens:^(NSString *_Nonnull accessToken, + NSString *_Nonnull idToken, + NSError *_Nullable error) { + if (error) { + [self logMessage:@"Error fetching fresh tokens: %@", [error localizedDescription]]; + return; + } + + // log whether a token refresh occurred + if (![currentAccessToken isEqual:accessToken]) { + [self logMessage:@"Access token was refreshed automatically (%@ to %@)", + currentAccessToken, + accessToken]; + } else { + [self logMessage:@"Access token was fresh and not updated [%@]", accessToken]; + } + + // creates request to the userinfo endpoint, with access token in the Authorization header + NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:userinfoEndpoint]; + NSString *authorizationHeaderValue = [NSString stringWithFormat:@"Bearer %@", accessToken]; + [request addValue:authorizationHeaderValue forHTTPHeaderField:@"Authorization"]; + + NSURLSessionConfiguration *configuration = + [NSURLSessionConfiguration defaultSessionConfiguration]; + NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration + delegate:nil + delegateQueue:nil]; + + // performs HTTP request + NSURLSessionDataTask *postDataTask = + [session dataTaskWithRequest:request + completionHandler:^(NSData *_Nullable data, + NSURLResponse *_Nullable response, + NSError *_Nullable error) { + dispatch_async(dispatch_get_main_queue(), ^() { + if (error) { + [self logMessage:@"HTTP request failed %@", error]; + return; + } + if (![response isKindOfClass:[NSHTTPURLResponse class]]) { + [self logMessage:@"Non-HTTP response"]; + return; + } + + NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; + id jsonDictionaryOrArray = + [NSJSONSerialization JSONObjectWithData:data options:0 error:NULL]; + + if (httpResponse.statusCode != 200) { + // server replied with an error + NSString *responseText = [[NSString alloc] initWithData:data + encoding:NSUTF8StringEncoding]; + if (httpResponse.statusCode == 401) { + // "401 Unauthorized" generally indicates there is an issue with the authorization + // grant. Puts OIDAuthState into an error state. + NSError *oauthError = + [OIDErrorUtilities resourceServerAuthorizationErrorWithCode:0 + errorResponse:jsonDictionaryOrArray + underlyingError:error]; + [_authState updateWithAuthorizationError:oauthError]; + // log error + [self logMessage:@"Authorization Error (%@). Response: %@", oauthError, responseText]; + } else { + [self logMessage:@"HTTP: %d. Response: %@", + (int)httpResponse.statusCode, + responseText]; + } + return; + } + + // success response + [self logMessage:@"Success: %@", jsonDictionaryOrArray]; + }); + }]; + + [postDataTask resume]; + }]; +} + +/*! @brief Logs a message to stdout and the textfield. + @param format The format string and arguments. + */ +- (void)logMessage:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2) { + // gets message as string + va_list argp; + va_start(argp, format); + NSString *log = [[NSString alloc] initWithFormat:format arguments:argp]; + va_end(argp); + + // outputs to stdout + NSLog(@"%@", log); + + // appends to output log + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + dateFormatter.dateFormat = @"hh:mm:ss"; + NSString *dateString = [dateFormatter stringFromDate:[NSDate date]]; + _logTextView.text = [NSString stringWithFormat:@"%@%@%@: %@", + _logTextView.text, + ([_logTextView.text length] > 0) ? @"\n" : @"", + dateString, + log]; +} +- (IBAction)clearLogTextView:(UIButton *)sender { + _logTextView.text = @""; +} + +@end diff --git a/Examples/Example-iOS_ObjC/Podfile b/Examples/Example-iOS_ObjC/Podfile index 4d6ab0f6f..bf21b203a 100644 --- a/Examples/Example-iOS_ObjC/Podfile +++ b/Examples/Example-iOS_ObjC/Podfile @@ -1,7 +1,13 @@ -target 'Example-iOS_ObjC' do - platform :ios, '9.0' +platform :ios, '9.0' +target 'Example-iOS_ObjC' do # AppAuth Pod # In production, just use `pod 'AppAuth'` without the path reference. pod 'AppAuth', :path => '../../' end + +target 'Example-iOS_ObjC_Extension' do + # AppAuth Pod + # In production, just use `pod 'AppAuth'` without the path reference. + pod 'AppAuth', :path => '../../' +end From 099afb1e1ec3e9ec298fc9dc222c0949fc49834b Mon Sep 17 00:00:00 2001 From: Julien Bodet Date: Sun, 11 Mar 2018 16:48:45 -0400 Subject: [PATCH 17/81] Multiple fixes to the app extension example --- .../Example-iOS_ObjC_Extension.xcscheme | 120 ++++++++++++++++++ .../Base.lproj/MainInterface.storyboard | 10 -- .../TodayViewController.h | 24 +++- .../TodayViewController.m | 29 +++-- 4 files changed, 155 insertions(+), 28 deletions(-) create mode 100644 Examples/Example-iOS_ObjC/Example-iOS_ObjC.xcodeproj/xcshareddata/xcschemes/Example-iOS_ObjC_Extension.xcscheme diff --git a/Examples/Example-iOS_ObjC/Example-iOS_ObjC.xcodeproj/xcshareddata/xcschemes/Example-iOS_ObjC_Extension.xcscheme b/Examples/Example-iOS_ObjC/Example-iOS_ObjC.xcodeproj/xcshareddata/xcschemes/Example-iOS_ObjC_Extension.xcscheme new file mode 100644 index 000000000..7a9720c27 --- /dev/null +++ b/Examples/Example-iOS_ObjC/Example-iOS_ObjC.xcodeproj/xcshareddata/xcschemes/Example-iOS_ObjC_Extension.xcscheme @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/Base.lproj/MainInterface.storyboard b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/Base.lproj/MainInterface.storyboard index f9e3f4b64..11e788e03 100644 --- a/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/Base.lproj/MainInterface.storyboard +++ b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/Base.lproj/MainInterface.storyboard @@ -18,12 +18,6 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/Example-iOS_ObjC-Carthage/Example_Extension/Example_Extension.entitlements b/Examples/Example-iOS_ObjC-Carthage/Example_Extension/Example_Extension.entitlements new file mode 100644 index 000000000..c250a2746 --- /dev/null +++ b/Examples/Example-iOS_ObjC-Carthage/Example_Extension/Example_Extension.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.application-groups + + group.net.openid.appauth.Example + + + diff --git a/Examples/Example-iOS_ObjC-Carthage/Example_Extension/Info.plist b/Examples/Example-iOS_ObjC-Carthage/Example_Extension/Info.plist new file mode 100644 index 000000000..6ea3c3dc6 --- /dev/null +++ b/Examples/Example-iOS_ObjC-Carthage/Example_Extension/Info.plist @@ -0,0 +1,31 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Example_Extension + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + XPC! + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + NSExtension + + NSExtensionMainStoryboard + MainInterface + NSExtensionPointIdentifier + com.apple.widget-extension + + + diff --git a/Examples/Example-iOS_ObjC-Carthage/Example_Extension/TodayViewController.h b/Examples/Example-iOS_ObjC-Carthage/Example_Extension/TodayViewController.h new file mode 100644 index 000000000..9053ba197 --- /dev/null +++ b/Examples/Example-iOS_ObjC-Carthage/Example_Extension/TodayViewController.h @@ -0,0 +1,24 @@ +/*! @file TodayViewController.h + @brief AppAuth iOS SDK Example + @copyright + Copyright 2015 Google Inc. All Rights Reserved. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import + +@interface TodayViewController : UIViewController + +@end + diff --git a/Examples/Example-iOS_ObjC-Carthage/Example_Extension/TodayViewController.m b/Examples/Example-iOS_ObjC-Carthage/Example_Extension/TodayViewController.m new file mode 100644 index 000000000..2643f1747 --- /dev/null +++ b/Examples/Example-iOS_ObjC-Carthage/Example_Extension/TodayViewController.m @@ -0,0 +1,223 @@ +/*! @file TodayViewController.m + @brief AppAuth iOS SDK Example + @copyright + Copyright 2015 Google Inc. All Rights Reserved. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "TodayViewController.h" +#import +#import + +static NSString *const kAppAuthExampleAuthStateKey = @"authState"; + +@interface TodayViewController () + +@property(nonatomic, readonly, nullable) OIDAuthState *authState; +@property (weak, nonatomic) IBOutlet UITextView *logTextView; + +@end + +@implementation TodayViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + if ([self.extensionContext respondsToSelector:@selector(setWidgetLargestAvailableDisplayMode:)]) { // iOS 10+ + [self.extensionContext setWidgetLargestAvailableDisplayMode:NCWidgetDisplayModeExpanded]; + } else { + self.preferredContentSize = CGSizeMake(0, 600.0); // iOS 10- + } + + [self loadState]; +} + +- (void)widgetActiveDisplayModeDidChange:(NCWidgetDisplayMode)activeDisplayMode + withMaximumSize:(CGSize)maxSize { + + if (activeDisplayMode == NCWidgetDisplayModeExpanded) { + self.preferredContentSize = CGSizeMake(maxSize.width, 600.0); + } else if (activeDisplayMode == NCWidgetDisplayModeCompact) { + self.preferredContentSize = maxSize; + } +} + +- (void)widgetPerformUpdateWithCompletionHandler:(void (^)(NCUpdateResult))completionHandler { + // Perform any setup necessary in order to update the view. + + // If an error is encountered, use NCUpdateResultFailed + // If there's no update required, use NCUpdateResultNoData + // If there's an update, use NCUpdateResultNewData + + completionHandler(NCUpdateResultNewData); +} + +/*! @brief Loads the @c OIDAuthState from @c NSUSerDefaults. + */ +- (void)loadState { + // loads OIDAuthState from NSUSerDefaults + NSUserDefaults* userDefaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.net.openid.appauth.Example"]; + NSData *archivedAuthState = [userDefaults objectForKey:kAppAuthExampleAuthStateKey]; + OIDAuthState *authState = [NSKeyedUnarchiver unarchiveObjectWithData:archivedAuthState]; + [self setAuthState:authState]; +} + +/*! @brief Saves the @c OIDAuthState to @c NSUSerDefaults. + */ +- (void)saveState { + // for production usage consider using the OS Keychain instead + NSUserDefaults* userDefaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.net.openid.appauth.Example"]; + NSData *archivedAuthState = [NSKeyedArchiver archivedDataWithRootObject:_authState]; + [userDefaults setObject:archivedAuthState + forKey:kAppAuthExampleAuthStateKey]; + [userDefaults synchronize]; +} + +- (void)setAuthState:(nullable OIDAuthState *)authState { + if (_authState == authState) { + return; + } + _authState = authState; + _authState.stateChangeDelegate = self; + [self stateChanged]; +} + +- (void)stateChanged { + [self saveState]; +} + +- (void)didChangeState:(OIDAuthState *)state { + [self stateChanged]; +} + +- (IBAction)getUserInfo:(UIButton *)sender { + NSURL *userinfoEndpoint = + _authState.lastAuthorizationResponse.request.configuration.discoveryDocument.userinfoEndpoint; + if (!userinfoEndpoint) { + [self logMessage:@"Userinfo endpoint not declared in discovery document"]; + return; + } + NSString *currentAccessToken = _authState.lastTokenResponse.accessToken; + + [self logMessage:@"Performing userinfo request"]; + + [_authState performActionWithFreshTokens:^(NSString *_Nonnull accessToken, + NSString *_Nonnull idToken, + NSError *_Nullable error) { + if (error) { + [self logMessage:@"Error fetching fresh tokens: %@", [error localizedDescription]]; + return; + } + + // log whether a token refresh occurred + if (![currentAccessToken isEqual:accessToken]) { + [self logMessage:@"Access token was refreshed automatically (%@ to %@)", + currentAccessToken, + accessToken]; + } else { + [self logMessage:@"Access token was fresh and not updated [%@]", accessToken]; + } + + // creates request to the userinfo endpoint, with access token in the Authorization header + NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:userinfoEndpoint]; + NSString *authorizationHeaderValue = [NSString stringWithFormat:@"Bearer %@", accessToken]; + [request addValue:authorizationHeaderValue forHTTPHeaderField:@"Authorization"]; + + NSURLSessionConfiguration *configuration = + [NSURLSessionConfiguration defaultSessionConfiguration]; + NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration + delegate:nil + delegateQueue:nil]; + + // performs HTTP request + NSURLSessionDataTask *postDataTask = + [session dataTaskWithRequest:request + completionHandler:^(NSData *_Nullable data, + NSURLResponse *_Nullable response, + NSError *_Nullable error) { + dispatch_async(dispatch_get_main_queue(), ^() { + if (error) { + [self logMessage:@"HTTP request failed %@", error]; + return; + } + if (![response isKindOfClass:[NSHTTPURLResponse class]]) { + [self logMessage:@"Non-HTTP response"]; + return; + } + + NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; + id jsonDictionaryOrArray = + [NSJSONSerialization JSONObjectWithData:data options:0 error:NULL]; + + if (httpResponse.statusCode != 200) { + // server replied with an error + NSString *responseText = [[NSString alloc] initWithData:data + encoding:NSUTF8StringEncoding]; + if (httpResponse.statusCode == 401) { + // "401 Unauthorized" generally indicates there is an issue with the authorization + // grant. Puts OIDAuthState into an error state. + NSError *oauthError = + [OIDErrorUtilities resourceServerAuthorizationErrorWithCode:0 + errorResponse:jsonDictionaryOrArray + underlyingError:error]; + [_authState updateWithAuthorizationError:oauthError]; + // log error + [self logMessage:@"Authorization Error (%@). Response: %@", oauthError, responseText]; + } else { + [self logMessage:@"HTTP: %d. Response: %@", + (int)httpResponse.statusCode, + responseText]; + } + return; + } + + // success response + [self logMessage:@"Success: %@", jsonDictionaryOrArray]; + }); + }]; + + [postDataTask resume]; + }]; +} + +/*! @brief Logs a message to stdout and the textfield. + @param format The format string and arguments. + */ +- (void)logMessage:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2) { + // gets message as string + va_list argp; + va_start(argp, format); + NSString *log = [[NSString alloc] initWithFormat:format arguments:argp]; + va_end(argp); + + // outputs to stdout + NSLog(@"%@", log); + + // appends to output log + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + dateFormatter.dateFormat = @"hh:mm:ss"; + NSString *dateString = [dateFormatter stringFromDate:[NSDate date]]; + _logTextView.text = [NSString stringWithFormat:@"%@%@%@: %@", + _logTextView.text, + ([_logTextView.text length] > 0) ? @"\n" : @"", + dateString, + log]; +} + +- (IBAction)clearLogTextView:(UIButton *)sender { + _logTextView.text = @""; +} + +@end + diff --git a/Examples/Example-iOS_ObjC-Carthage/Source/AppAuthExampleViewController.m b/Examples/Example-iOS_ObjC-Carthage/Source/AppAuthExampleViewController.m index 68354c436..dc76a8c9c 100644 --- a/Examples/Example-iOS_ObjC-Carthage/Source/AppAuthExampleViewController.m +++ b/Examples/Example-iOS_ObjC-Carthage/Source/AppAuthExampleViewController.m @@ -102,18 +102,19 @@ - (void)viewDidLoad { */ - (void)saveState { // for production usage consider using the OS Keychain instead + NSUserDefaults* userDefaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.net.openid.appauth.Example"]; NSData *archivedAuthState = [ NSKeyedArchiver archivedDataWithRootObject:_authState]; - [[NSUserDefaults standardUserDefaults] setObject:archivedAuthState - forKey:kAppAuthExampleAuthStateKey]; - [[NSUserDefaults standardUserDefaults] synchronize]; + [userDefaults setObject:archivedAuthState + forKey:kAppAuthExampleAuthStateKey]; + [userDefaults synchronize]; } /*! @brief Loads the @c OIDAuthState from @c NSUSerDefaults. */ - (void)loadState { // loads OIDAuthState from NSUSerDefaults - NSData *archivedAuthState = - [[NSUserDefaults standardUserDefaults] objectForKey:kAppAuthExampleAuthStateKey]; + NSUserDefaults* userDefaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.net.openid.appauth.Example"]; + NSData *archivedAuthState = [userDefaults objectForKey:kAppAuthExampleAuthStateKey]; OIDAuthState *authState = [NSKeyedUnarchiver unarchiveObjectWithData:archivedAuthState]; [self setAuthState:authState]; } diff --git a/Examples/Example-iOS_ObjC-Carthage/Source/Example.entitlements b/Examples/Example-iOS_ObjC-Carthage/Source/Example.entitlements new file mode 100644 index 000000000..c250a2746 --- /dev/null +++ b/Examples/Example-iOS_ObjC-Carthage/Source/Example.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.application-groups + + group.net.openid.appauth.Example + + + From 602066c7b0a60ee49abfe6e32acd72020bb56edc Mon Sep 17 00:00:00 2001 From: Julien Bodet Date: Sun, 18 Mar 2018 17:36:20 -0400 Subject: [PATCH 20/81] Add extension to swift example --- .../Example.xcodeproj/project.pbxproj | 185 ++++++++++++++- .../xcshareddata/xcschemes/Example.xcscheme | 93 ++++++++ .../xcschemes/Example_Extension.xcscheme | 120 ++++++++++ .../Base.lproj/MainInterface.storyboard | 65 +++++ .../Example_Extension.entitlements | 10 + .../Example_Extension/Info.plist | 31 +++ .../TodayViewController.swift | 223 ++++++++++++++++++ .../Source/AppAuthExampleViewController.swift | 10 +- .../Source/Example.entitlements | 10 + 9 files changed, 742 insertions(+), 5 deletions(-) create mode 100644 Examples/Example-iOS_Swift-Carthage/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme create mode 100644 Examples/Example-iOS_Swift-Carthage/Example.xcodeproj/xcshareddata/xcschemes/Example_Extension.xcscheme create mode 100644 Examples/Example-iOS_Swift-Carthage/Example_Extension/Base.lproj/MainInterface.storyboard create mode 100644 Examples/Example-iOS_Swift-Carthage/Example_Extension/Example_Extension.entitlements create mode 100644 Examples/Example-iOS_Swift-Carthage/Example_Extension/Info.plist create mode 100644 Examples/Example-iOS_Swift-Carthage/Example_Extension/TodayViewController.swift create mode 100644 Examples/Example-iOS_Swift-Carthage/Source/Example.entitlements diff --git a/Examples/Example-iOS_Swift-Carthage/Example.xcodeproj/project.pbxproj b/Examples/Example-iOS_Swift-Carthage/Example.xcodeproj/project.pbxproj index 825c2a30f..99724e0b6 100644 --- a/Examples/Example-iOS_Swift-Carthage/Example.xcodeproj/project.pbxproj +++ b/Examples/Example-iOS_Swift-Carthage/Example.xcodeproj/project.pbxproj @@ -7,6 +7,11 @@ objects = { /* Begin PBXBuildFile section */ + 0646249B205F026300072191 /* NotificationCenter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0646249A205F026300072191 /* NotificationCenter.framework */; }; + 0646249E205F026300072191 /* TodayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0646249D205F026300072191 /* TodayViewController.swift */; }; + 064624A1205F026300072191 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0646249F205F026300072191 /* MainInterface.storyboard */; }; + 064624A5205F026300072191 /* Example_Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 06462499205F026300072191 /* Example_Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 064624AC205F02FA00072191 /* AppAuth.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F265BD91F9AE50400DC14BF /* AppAuth.framework */; }; 9F265BD11F9AC69300DC14BF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9F265BC91F9AC69300DC14BF /* Assets.xcassets */; }; 9F265BD31F9AC69300DC14BF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9F265BCB1F9AC69300DC14BF /* LaunchScreen.storyboard */; }; 9F265BD41F9AC69300DC14BF /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9F265BCD1F9AC69300DC14BF /* Main.storyboard */; }; @@ -15,7 +20,38 @@ 9FD378231FB7C6F800436204 /* AppAuthExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FD378221FB7C6F800436204 /* AppAuthExampleViewController.swift */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + 064624A3205F026300072191 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9F265B8F1F9AC5D600DC14BF /* Project object */; + proxyType = 1; + remoteGlobalIDString = 06462498205F026300072191; + remoteInfo = Example_Extension; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 064624A9205F026300072191 /* Embed App Extensions */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + 064624A5205F026300072191 /* Example_Extension.appex in Embed App Extensions */, + ); + name = "Embed App Extensions"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ + 06462499205F026300072191 /* Example_Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = Example_Extension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; + 0646249A205F026300072191 /* NotificationCenter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NotificationCenter.framework; path = System/Library/Frameworks/NotificationCenter.framework; sourceTree = SDKROOT; }; + 0646249D205F026300072191 /* TodayViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TodayViewController.swift; sourceTree = ""; }; + 064624A0205F026300072191 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = ""; }; + 064624A2205F026300072191 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 064624AD205F034A00072191 /* Example.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Example.entitlements; sourceTree = ""; }; + 064624AE205F035D00072191 /* Example_Extension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Example_Extension.entitlements; sourceTree = ""; }; 9F265B971F9AC5D600DC14BF /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 9F265BC91F9AC69300DC14BF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 9F265BCC1F9AC69300DC14BF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; @@ -27,6 +63,15 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 06462496205F026300072191 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 064624AC205F02FA00072191 /* AppAuth.framework in Frameworks */, + 0646249B205F026300072191 /* NotificationCenter.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 9F265B941F9AC5D600DC14BF /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -38,10 +83,22 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 0646249C205F026300072191 /* Example_Extension */ = { + isa = PBXGroup; + children = ( + 0646249D205F026300072191 /* TodayViewController.swift */, + 0646249F205F026300072191 /* MainInterface.storyboard */, + 064624A2205F026300072191 /* Info.plist */, + 064624AE205F035D00072191 /* Example_Extension.entitlements */, + ); + path = Example_Extension; + sourceTree = ""; + }; 9F265B8E1F9AC5D600DC14BF = { isa = PBXGroup; children = ( 9F265BC81F9AC69300DC14BF /* Source */, + 0646249C205F026300072191 /* Example_Extension */, 9F265BD81F9AE4CA00DC14BF /* Frameworks */, 9F265B981F9AC5D600DC14BF /* Products */, ); @@ -51,6 +108,7 @@ isa = PBXGroup; children = ( 9F265B971F9AC5D600DC14BF /* Example.app */, + 06462499205F026300072191 /* Example_Extension.appex */, ); name = Products; sourceTree = ""; @@ -64,6 +122,7 @@ 9F265BCD1F9AC69300DC14BF /* Main.storyboard */, 9F265BC91F9AC69300DC14BF /* Assets.xcassets */, 9F265BD01F9AC69300DC14BF /* Info.plist */, + 064624AD205F034A00072191 /* Example.entitlements */, ); path = Source; sourceTree = ""; @@ -72,6 +131,7 @@ isa = PBXGroup; children = ( 9F265BD91F9AE50400DC14BF /* AppAuth.framework */, + 0646249A205F026300072191 /* NotificationCenter.framework */, ); name = Frameworks; sourceTree = ""; @@ -79,6 +139,23 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ + 06462498205F026300072191 /* Example_Extension */ = { + isa = PBXNativeTarget; + buildConfigurationList = 064624A8205F026300072191 /* Build configuration list for PBXNativeTarget "Example_Extension" */; + buildPhases = ( + 06462495205F026300072191 /* Sources */, + 06462496205F026300072191 /* Frameworks */, + 06462497205F026300072191 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Example_Extension; + productName = Example_Extension; + productReference = 06462499205F026300072191 /* Example_Extension.appex */; + productType = "com.apple.product-type.app-extension"; + }; 9F265B961F9AC5D600DC14BF /* Example */ = { isa = PBXNativeTarget; buildConfigurationList = 9F265BBF1F9AC5D600DC14BF /* Build configuration list for PBXNativeTarget "Example" */; @@ -87,10 +164,12 @@ 9F265B941F9AC5D600DC14BF /* Frameworks */, 9F265B951F9AC5D600DC14BF /* Resources */, 9F265BDB1F9AE52C00DC14BF /* ShellScript */, + 064624A9205F026300072191 /* Embed App Extensions */, ); buildRules = ( ); dependencies = ( + 064624A4205F026300072191 /* PBXTargetDependency */, ); name = Example; productName = Example; @@ -103,13 +182,27 @@ 9F265B8F1F9AC5D600DC14BF /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 0900; + LastSwiftUpdateCheck = 0920; LastUpgradeCheck = 0900; ORGANIZATIONNAME = "Google Inc."; TargetAttributes = { + 06462498205F026300072191 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.ApplicationGroups.iOS = { + enabled = 1; + }; + }; + }; 9F265B961F9AC5D600DC14BF = { CreatedOnToolsVersion = 9.0.1; ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.ApplicationGroups.iOS = { + enabled = 1; + }; + }; }; }; }; @@ -127,11 +220,20 @@ projectRoot = ""; targets = ( 9F265B961F9AC5D600DC14BF /* Example */, + 06462498205F026300072191 /* Example_Extension */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 06462497205F026300072191 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 064624A1205F026300072191 /* MainInterface.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 9F265B951F9AC5D600DC14BF /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -162,6 +264,14 @@ /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 06462495205F026300072191 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0646249E205F026300072191 /* TodayViewController.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 9F265B931F9AC5D600DC14BF /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -173,7 +283,23 @@ }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + 064624A4205F026300072191 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 06462498205F026300072191 /* Example_Extension */; + targetProxy = 064624A3205F026300072191 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin PBXVariantGroup section */ + 0646249F205F026300072191 /* MainInterface.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 064624A0205F026300072191 /* Base */, + ); + name = MainInterface.storyboard; + sourceTree = ""; + }; 9F265BCB1F9AC69300DC14BF /* LaunchScreen.storyboard */ = { isa = PBXVariantGroup; children = ( @@ -193,6 +319,48 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ + 064624A6205F026300072191 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = Example_Extension/Example_Extension.entitlements; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = ""; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); + INFOPLIST_FILE = Example_Extension/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "net.openid.appauth.Example.Example-Extension"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 064624A7205F026300072191 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = Example_Extension/Example_Extension.entitlements; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = ""; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); + INFOPLIST_FILE = Example_Extension/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "net.openid.appauth.Example.Example-Extension"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; 9F265BBD1F9AC5D600DC14BF /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -303,8 +471,11 @@ 9F265BC01F9AC5D600DC14BF /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = Source/Example.entitlements; CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = ""; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/iOS", @@ -322,8 +493,11 @@ 9F265BC11F9AC5D600DC14BF /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = Source/Example.entitlements; CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = ""; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/iOS", @@ -341,6 +515,15 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 064624A8205F026300072191 /* Build configuration list for PBXNativeTarget "Example_Extension" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 064624A6205F026300072191 /* Debug */, + 064624A7205F026300072191 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 9F265B921F9AC5D600DC14BF /* Build configuration list for PBXProject "Example" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Examples/Example-iOS_Swift-Carthage/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme b/Examples/Example-iOS_Swift-Carthage/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme new file mode 100644 index 000000000..7ffcb4c0f --- /dev/null +++ b/Examples/Example-iOS_Swift-Carthage/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/Example-iOS_Swift-Carthage/Example.xcodeproj/xcshareddata/xcschemes/Example_Extension.xcscheme b/Examples/Example-iOS_Swift-Carthage/Example.xcodeproj/xcshareddata/xcschemes/Example_Extension.xcscheme new file mode 100644 index 000000000..719ebd973 --- /dev/null +++ b/Examples/Example-iOS_Swift-Carthage/Example.xcodeproj/xcshareddata/xcschemes/Example_Extension.xcscheme @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/Example-iOS_Swift-Carthage/Example_Extension/Base.lproj/MainInterface.storyboard b/Examples/Example-iOS_Swift-Carthage/Example_Extension/Base.lproj/MainInterface.storyboard new file mode 100644 index 000000000..5d44999b1 --- /dev/null +++ b/Examples/Example-iOS_Swift-Carthage/Example_Extension/Base.lproj/MainInterface.storyboard @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/Example-iOS_Swift-Carthage/Example_Extension/Example_Extension.entitlements b/Examples/Example-iOS_Swift-Carthage/Example_Extension/Example_Extension.entitlements new file mode 100644 index 000000000..c250a2746 --- /dev/null +++ b/Examples/Example-iOS_Swift-Carthage/Example_Extension/Example_Extension.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.application-groups + + group.net.openid.appauth.Example + + + diff --git a/Examples/Example-iOS_Swift-Carthage/Example_Extension/Info.plist b/Examples/Example-iOS_Swift-Carthage/Example_Extension/Info.plist new file mode 100644 index 000000000..6ea3c3dc6 --- /dev/null +++ b/Examples/Example-iOS_Swift-Carthage/Example_Extension/Info.plist @@ -0,0 +1,31 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Example_Extension + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + XPC! + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + NSExtension + + NSExtensionMainStoryboard + MainInterface + NSExtensionPointIdentifier + com.apple.widget-extension + + + diff --git a/Examples/Example-iOS_Swift-Carthage/Example_Extension/TodayViewController.swift b/Examples/Example-iOS_Swift-Carthage/Example_Extension/TodayViewController.swift new file mode 100644 index 000000000..7f5a55088 --- /dev/null +++ b/Examples/Example-iOS_Swift-Carthage/Example_Extension/TodayViewController.swift @@ -0,0 +1,223 @@ +// +// TodayViewController.swift +// +// Copyright (c) 2017 The AppAuth Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import UIKit +import NotificationCenter +import AppAuth + +/** + NSCoding key for the authState property. + */ +let kAppAuthExampleAuthStateKey: String = "authState"; + +class TodayViewController: UIViewController, NCWidgetProviding { + + @IBOutlet private weak var logTextView: UITextView! + + private var authState: OIDAuthState? + + override func viewDidLoad() { + super.viewDidLoad() + + if let extensionContext = self.extensionContext, extensionContext.responds(to: #selector(setter: NSExtensionContext.widgetLargestAvailableDisplayMode)) { // iOS 10+ + extensionContext.widgetLargestAvailableDisplayMode = .expanded + } else { + preferredContentSize = CGSize(width: 0, height: 600.0) // iOS 10- + } + + self.loadState() + } + + func widgetActiveDisplayModeDidChange(_ activeDisplayMode: NCWidgetDisplayMode, withMaximumSize maxSize: CGSize) { + if activeDisplayMode == .expanded { + preferredContentSize = CGSize(width: maxSize.width, height: 600.0) + } else if activeDisplayMode == .compact { + preferredContentSize = maxSize + } + } + + func widgetPerformUpdate(completionHandler: (@escaping (NCUpdateResult) -> Void)) { + // Perform any setup necessary in order to update the view. + + // If an error is encountered, use NCUpdateResult.Failed + // If there's no update required, use NCUpdateResult.NoData + // If there's an update, use NCUpdateResult.NewData + + completionHandler(NCUpdateResult.newData) + } + + @IBAction func userinfo(_ sender: UIButton) { + + guard let userinfoEndpoint = self.authState?.lastAuthorizationResponse.request.configuration.discoveryDocument?.userinfoEndpoint else { + self.logMessage("Userinfo endpoint not declared in discovery document") + return + } + + self.logMessage("Performing userinfo request") + + let currentAccessToken: String? = self.authState?.lastTokenResponse?.accessToken + + self.authState?.performAction() { (accessToken, idTOken, error) in + + if error != nil { + self.logMessage("Error fetching fresh tokens: \(error?.localizedDescription ?? "ERROR")") + return + } + + guard let accessToken = accessToken else { + self.logMessage("Error getting accessToken") + return + } + + if currentAccessToken != accessToken { + self.logMessage("Access token was refreshed automatically (\(currentAccessToken ?? "CURRENT_ACCESS_TOKEN") to \(accessToken))") + } else { + self.logMessage("Access token was fresh and not updated \(accessToken)") + } + + var urlRequest = URLRequest(url: userinfoEndpoint) + urlRequest.allHTTPHeaderFields = ["Authorization":"Bearer \(accessToken)"] + + let task = URLSession.shared.dataTask(with: urlRequest) { data, response, error in + + DispatchQueue.main.async { + + guard error == nil else { + self.logMessage("HTTP request failed \(error?.localizedDescription ?? "ERROR")") + return + } + + guard let response = response as? HTTPURLResponse else { + self.logMessage("Non-HTTP response") + return + } + + guard let data = data else { + self.logMessage("HTTP response data is empty") + return + } + + var json: [AnyHashable: Any]? + + do { + json = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] + } catch { + self.logMessage("JSON Serialization Error") + } + + if response.statusCode != 200 { + // server replied with an error + let responseText: String? = String(data: data, encoding: String.Encoding.utf8) + + if response.statusCode == 401 { + // "401 Unauthorized" generally indicates there is an issue with the authorization + // grant. Puts OIDAuthState into an error state. + let oauthError = OIDErrorUtilities.resourceServerAuthorizationError(withCode: 0, + errorResponse: json, + underlyingError: error) + self.authState?.update(withAuthorizationError: oauthError) + self.logMessage("Authorization Error (\(oauthError)). Response: \(responseText ?? "RESPONSE_TEXT")") + } else { + self.logMessage("HTTP: \(response.statusCode), Response: \(responseText ?? "RESPONSE_TEXT")") + } + + return + } + + if let json = json { + self.logMessage("Success: \(json)") + } + } + } + + task.resume() + } + } + + @IBAction func clearLogTextView(_ sender: UIButton) { + self.logTextView.text = "" + } +} + +//MARK: OIDAuthState Delegate +extension TodayViewController: OIDAuthStateChangeDelegate { + + func didChange(_ state: OIDAuthState) { + self.stateChanged() + } +} + +//MARK: Helper Methods +extension TodayViewController { + + func saveState() { + + var data: Data? = nil + + if let authState = self.authState { + data = NSKeyedArchiver.archivedData(withRootObject: authState) + } + + if let userDefaults = UserDefaults(suiteName: "group.net.openid.appauth.Example") { + userDefaults.set(data, forKey: kAppAuthExampleAuthStateKey) + userDefaults.synchronize() + } + } + + func loadState() { + guard let data = UserDefaults(suiteName: "group.net.openid.appauth.Example")?.object(forKey: kAppAuthExampleAuthStateKey) as? Data else { + return + } + + if let authState = NSKeyedUnarchiver.unarchiveObject(with: data) as? OIDAuthState { + self.setAuthState(authState) + } + } + + func setAuthState(_ authState: OIDAuthState?) { + if (self.authState == authState) { + return; + } + self.authState = authState; + self.authState?.stateChangeDelegate = self; + self.stateChanged() + } + + func stateChanged() { + self.saveState() + } + + func logMessage(_ message: String?) { + + guard let message = message else { + return + } + + print(message); + + let dateFormatter = DateFormatter() + dateFormatter.dateFormat = "hh:mm:ss"; + let dateString = dateFormatter.string(from: Date()) + + // appends to output log + DispatchQueue.main.async { + let logText = "\(self.logTextView.text ?? "")\n\(dateString): \(message)" + self.logTextView.text = logText + } + } +} diff --git a/Examples/Example-iOS_Swift-Carthage/Source/AppAuthExampleViewController.swift b/Examples/Example-iOS_Swift-Carthage/Source/AppAuthExampleViewController.swift index fe9c27242..f70540472 100644 --- a/Examples/Example-iOS_Swift-Carthage/Source/AppAuthExampleViewController.swift +++ b/Examples/Example-iOS_Swift-Carthage/Source/AppAuthExampleViewController.swift @@ -463,13 +463,15 @@ extension AppAuthExampleViewController { if let authState = self.authState { data = NSKeyedArchiver.archivedData(withRootObject: authState) } - - UserDefaults.standard.set(data, forKey: kAppAuthExampleAuthStateKey) - UserDefaults.standard.synchronize() + + if let userDefaults = UserDefaults(suiteName: "group.net.openid.appauth.Example") { + userDefaults.set(data, forKey: kAppAuthExampleAuthStateKey) + userDefaults.synchronize() + } } func loadState() { - guard let data = UserDefaults.standard.object(forKey: kAppAuthExampleAuthStateKey) as? Data else { + guard let data = UserDefaults(suiteName: "group.net.openid.appauth.Example")?.object(forKey: kAppAuthExampleAuthStateKey) as? Data else { return } diff --git a/Examples/Example-iOS_Swift-Carthage/Source/Example.entitlements b/Examples/Example-iOS_Swift-Carthage/Source/Example.entitlements new file mode 100644 index 000000000..c250a2746 --- /dev/null +++ b/Examples/Example-iOS_Swift-Carthage/Source/Example.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.application-groups + + group.net.openid.appauth.Example + + + From 216c5b5e4f5d035766627b9983f2469beba4aed2 Mon Sep 17 00:00:00 2001 From: Julien Bodet Date: Sun, 18 Mar 2018 18:04:46 -0400 Subject: [PATCH 21/81] Fixed warnings in storyboards + formatting --- .../Base.lproj/MainInterface.storyboard | 1 + .../Base.lproj/MainInterface.storyboard | 1 + .../TodayViewController.h | 26 +++++++++---------- .../TodayViewController.m | 26 +++++++++---------- .../Base.lproj/MainInterface.storyboard | 1 + .../TodayViewController.swift | 6 ++--- 6 files changed, 32 insertions(+), 29 deletions(-) diff --git a/Examples/Example-iOS_ObjC-Carthage/Example_Extension/Base.lproj/MainInterface.storyboard b/Examples/Example-iOS_ObjC-Carthage/Example_Extension/Base.lproj/MainInterface.storyboard index 26c353cd6..6d96036e2 100644 --- a/Examples/Example-iOS_ObjC-Carthage/Example_Extension/Base.lproj/MainInterface.storyboard +++ b/Examples/Example-iOS_ObjC-Carthage/Example_Extension/Base.lproj/MainInterface.storyboard @@ -45,6 +45,7 @@ + diff --git a/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/Base.lproj/MainInterface.storyboard b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/Base.lproj/MainInterface.storyboard index 11e788e03..12863f62a 100644 --- a/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/Base.lproj/MainInterface.storyboard +++ b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/Base.lproj/MainInterface.storyboard @@ -43,6 +43,7 @@ + diff --git a/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.h b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.h index 2dd53762e..73d2d5e3a 100644 --- a/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.h +++ b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.h @@ -1,19 +1,19 @@ /*! @file TodayViewController.h - @brief AppAuth iOS SDK Example - @copyright - Copyright 2015 Google Inc. All Rights Reserved. - @copydetails - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + @brief AppAuth iOS SDK Example + @copyright + Copyright 2015 Google Inc. All Rights Reserved. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #import diff --git a/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.m b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.m index a9baa1ce9..caf555cb6 100644 --- a/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.m +++ b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.m @@ -1,19 +1,19 @@ /*! @file TodayViewController.m - @brief AppAuth iOS SDK Example - @copyright - Copyright 2015 Google Inc. All Rights Reserved. - @copydetails - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + @brief AppAuth iOS SDK Example + @copyright + Copyright 2015 Google Inc. All Rights Reserved. + @copydetails + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #import "TodayViewController.h" diff --git a/Examples/Example-iOS_Swift-Carthage/Example_Extension/Base.lproj/MainInterface.storyboard b/Examples/Example-iOS_Swift-Carthage/Example_Extension/Base.lproj/MainInterface.storyboard index 5d44999b1..74d4f1fa2 100644 --- a/Examples/Example-iOS_Swift-Carthage/Example_Extension/Base.lproj/MainInterface.storyboard +++ b/Examples/Example-iOS_Swift-Carthage/Example_Extension/Base.lproj/MainInterface.storyboard @@ -43,6 +43,7 @@ + diff --git a/Examples/Example-iOS_Swift-Carthage/Example_Extension/TodayViewController.swift b/Examples/Example-iOS_Swift-Carthage/Example_Extension/TodayViewController.swift index 7f5a55088..a62fd4907 100644 --- a/Examples/Example-iOS_Swift-Carthage/Example_Extension/TodayViewController.swift +++ b/Examples/Example-iOS_Swift-Carthage/Example_Extension/TodayViewController.swift @@ -34,10 +34,10 @@ class TodayViewController: UIViewController, NCWidgetProviding { override func viewDidLoad() { super.viewDidLoad() - if let extensionContext = self.extensionContext, extensionContext.responds(to: #selector(setter: NSExtensionContext.widgetLargestAvailableDisplayMode)) { // iOS 10+ - extensionContext.widgetLargestAvailableDisplayMode = .expanded + if #available(iOS 10.0, *) { + self.extensionContext?.widgetLargestAvailableDisplayMode = .expanded } else { - preferredContentSize = CGSize(width: 0, height: 600.0) // iOS 10- + self.preferredContentSize = CGSize(width: 0, height: 600.0) } self.loadState() From 636c4d96c3eec7710309f68207038d1f881a12a0 Mon Sep 17 00:00:00 2001 From: Julien Bodet Date: Mon, 26 Mar 2018 19:26:50 -0400 Subject: [PATCH 22/81] Change iOS version of example's app extensions + layout changes --- .../Example.xcodeproj/project.pbxproj | 4 +- .../Base.lproj/MainInterface.storyboard | 42 +++++++++--------- .../Example_Extension/TodayViewController.m | 9 ++-- .../project.pbxproj | 4 +- .../Base.lproj/MainInterface.storyboard | 44 ++++++++++--------- .../TodayViewController.m | 9 ++-- .../Example.xcodeproj/project.pbxproj | 4 +- .../Base.lproj/MainInterface.storyboard | 32 +++++++------- .../TodayViewController.swift | 5 ++- 9 files changed, 82 insertions(+), 71 deletions(-) diff --git a/Examples/Example-iOS_ObjC-Carthage/Example.xcodeproj/project.pbxproj b/Examples/Example-iOS_ObjC-Carthage/Example.xcodeproj/project.pbxproj index 6864919ea..88f29cf14 100644 --- a/Examples/Example-iOS_ObjC-Carthage/Example.xcodeproj/project.pbxproj +++ b/Examples/Example-iOS_ObjC-Carthage/Example.xcodeproj/project.pbxproj @@ -350,7 +350,7 @@ ); GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = Example_Extension/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 11.2; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "net.openid.appauth.Example.Example-Extension"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -385,7 +385,7 @@ ); GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = Example_Extension/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 11.2; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "net.openid.appauth.Example.Example-Extension"; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/Examples/Example-iOS_ObjC-Carthage/Example_Extension/Base.lproj/MainInterface.storyboard b/Examples/Example-iOS_ObjC-Carthage/Example_Extension/Base.lproj/MainInterface.storyboard index 6d96036e2..c2f74e69f 100644 --- a/Examples/Example-iOS_ObjC-Carthage/Example_Extension/Base.lproj/MainInterface.storyboard +++ b/Examples/Example-iOS_ObjC-Carthage/Example_Extension/Base.lproj/MainInterface.storyboard @@ -1,12 +1,11 @@ - + - @@ -14,43 +13,46 @@ + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + - diff --git a/Examples/Example-iOS_ObjC-Carthage/Example_Extension/TodayViewController.m b/Examples/Example-iOS_ObjC-Carthage/Example_Extension/TodayViewController.m index 2643f1747..9da9c3aba 100644 --- a/Examples/Example-iOS_ObjC-Carthage/Example_Extension/TodayViewController.m +++ b/Examples/Example-iOS_ObjC-Carthage/Example_Extension/TodayViewController.m @@ -34,24 +34,27 @@ @implementation TodayViewController - (void)viewDidLoad { [super viewDidLoad]; - if ([self.extensionContext respondsToSelector:@selector(setWidgetLargestAvailableDisplayMode:)]) { // iOS 10+ + if (@available(iOS 10.0, *)) { [self.extensionContext setWidgetLargestAvailableDisplayMode:NCWidgetDisplayModeExpanded]; } else { - self.preferredContentSize = CGSizeMake(0, 600.0); // iOS 10- + self.preferredContentSize = CGSizeMake(0, 400.0); } [self loadState]; } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpartial-availability" - (void)widgetActiveDisplayModeDidChange:(NCWidgetDisplayMode)activeDisplayMode withMaximumSize:(CGSize)maxSize { if (activeDisplayMode == NCWidgetDisplayModeExpanded) { - self.preferredContentSize = CGSizeMake(maxSize.width, 600.0); + self.preferredContentSize = CGSizeMake(maxSize.width, 400.0); } else if (activeDisplayMode == NCWidgetDisplayModeCompact) { self.preferredContentSize = maxSize; } } +#pragma clang diagnostic pop - (void)widgetPerformUpdateWithCompletionHandler:(void (^)(NCUpdateResult))completionHandler { // Perform any setup necessary in order to update the view. diff --git a/Examples/Example-iOS_ObjC/Example-iOS_ObjC.xcodeproj/project.pbxproj b/Examples/Example-iOS_ObjC/Example-iOS_ObjC.xcodeproj/project.pbxproj index 9b84a9b08..276f53c3f 100644 --- a/Examples/Example-iOS_ObjC/Example-iOS_ObjC.xcodeproj/project.pbxproj +++ b/Examples/Example-iOS_ObjC/Example-iOS_ObjC.xcodeproj/project.pbxproj @@ -516,7 +516,7 @@ DEVELOPMENT_TEAM = ""; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "Example-iOS_ObjC_Extension/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 11.2; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "net.openid.appauth.Example.Example-iOS-ObjC-Extension"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -548,7 +548,7 @@ DEVELOPMENT_TEAM = ""; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "Example-iOS_ObjC_Extension/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 11.2; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "net.openid.appauth.Example.Example-iOS-ObjC-Extension"; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/Base.lproj/MainInterface.storyboard b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/Base.lproj/MainInterface.storyboard index 12863f62a..67a53a714 100644 --- a/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/Base.lproj/MainInterface.storyboard +++ b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/Base.lproj/MainInterface.storyboard @@ -1,12 +1,11 @@ - + - @@ -14,43 +13,46 @@ + + + + - - + + - - - - - - - - - + + + + + + + + + - diff --git a/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.m b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.m index caf555cb6..5c86136f6 100644 --- a/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.m +++ b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.m @@ -34,24 +34,27 @@ @implementation TodayViewController - (void)viewDidLoad { [super viewDidLoad]; - if ([self.extensionContext respondsToSelector:@selector(setWidgetLargestAvailableDisplayMode:)]) { // iOS 10+ + if (@available(iOS 10, *)) { [self.extensionContext setWidgetLargestAvailableDisplayMode:NCWidgetDisplayModeExpanded]; } else { - self.preferredContentSize = CGSizeMake(0, 600.0); // iOS 10- + self.preferredContentSize = CGSizeMake(0, 400.0); } [self loadState]; } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpartial-availability" - (void)widgetActiveDisplayModeDidChange:(NCWidgetDisplayMode)activeDisplayMode withMaximumSize:(CGSize)maxSize { if (activeDisplayMode == NCWidgetDisplayModeExpanded) { - self.preferredContentSize = CGSizeMake(maxSize.width, 600.0); + self.preferredContentSize = CGSizeMake(maxSize.width, 400.0); } else if (activeDisplayMode == NCWidgetDisplayModeCompact) { self.preferredContentSize = maxSize; } } +#pragma clang diagnostic pop - (void)widgetPerformUpdateWithCompletionHandler:(void (^)(NCUpdateResult))completionHandler { // Perform any setup necessary in order to update the view. diff --git a/Examples/Example-iOS_Swift-Carthage/Example.xcodeproj/project.pbxproj b/Examples/Example-iOS_Swift-Carthage/Example.xcodeproj/project.pbxproj index 99724e0b6..652315182 100644 --- a/Examples/Example-iOS_Swift-Carthage/Example.xcodeproj/project.pbxproj +++ b/Examples/Example-iOS_Swift-Carthage/Example.xcodeproj/project.pbxproj @@ -330,7 +330,7 @@ "$(PROJECT_DIR)/Carthage/Build/iOS", ); INFOPLIST_FILE = Example_Extension/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 11.2; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "net.openid.appauth.Example.Example-Extension"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -351,7 +351,7 @@ "$(PROJECT_DIR)/Carthage/Build/iOS", ); INFOPLIST_FILE = Example_Extension/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 11.2; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "net.openid.appauth.Example.Example-Extension"; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/Examples/Example-iOS_Swift-Carthage/Example_Extension/Base.lproj/MainInterface.storyboard b/Examples/Example-iOS_Swift-Carthage/Example_Extension/Base.lproj/MainInterface.storyboard index 74d4f1fa2..170af8176 100644 --- a/Examples/Example-iOS_Swift-Carthage/Example_Extension/Base.lproj/MainInterface.storyboard +++ b/Examples/Example-iOS_Swift-Carthage/Example_Extension/Base.lproj/MainInterface.storyboard @@ -18,37 +18,37 @@ - - + + - - - - + + + + + - - + + - diff --git a/Examples/Example-iOS_Swift-Carthage/Example_Extension/TodayViewController.swift b/Examples/Example-iOS_Swift-Carthage/Example_Extension/TodayViewController.swift index a62fd4907..d1b1c13d8 100644 --- a/Examples/Example-iOS_Swift-Carthage/Example_Extension/TodayViewController.swift +++ b/Examples/Example-iOS_Swift-Carthage/Example_Extension/TodayViewController.swift @@ -37,15 +37,16 @@ class TodayViewController: UIViewController, NCWidgetProviding { if #available(iOS 10.0, *) { self.extensionContext?.widgetLargestAvailableDisplayMode = .expanded } else { - self.preferredContentSize = CGSize(width: 0, height: 600.0) + self.preferredContentSize = CGSize(width: 0, height: 400.0) } self.loadState() } + @available(iOSApplicationExtension 10.0, *) func widgetActiveDisplayModeDidChange(_ activeDisplayMode: NCWidgetDisplayMode, withMaximumSize maxSize: CGSize) { if activeDisplayMode == .expanded { - preferredContentSize = CGSize(width: maxSize.width, height: 600.0) + preferredContentSize = CGSize(width: maxSize.width, height: 400.0) } else if activeDisplayMode == .compact { preferredContentSize = maxSize } From 10ad90e664e23cf890774b3c0d1a6bfc686455c7 Mon Sep 17 00:00:00 2001 From: Julien Bodet Date: Tue, 27 Mar 2018 22:41:30 -0400 Subject: [PATCH 23/81] Add NS_AVAILABLE_IOS(10.0) for widgetActiveDisplayModeDidChange:withMaximumSize: instead of #pragma --- .../Example_Extension/TodayViewController.m | 5 +---- .../Example-iOS_ObjC_Extension/TodayViewController.m | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/Examples/Example-iOS_ObjC-Carthage/Example_Extension/TodayViewController.m b/Examples/Example-iOS_ObjC-Carthage/Example_Extension/TodayViewController.m index 9da9c3aba..97f9eabdc 100644 --- a/Examples/Example-iOS_ObjC-Carthage/Example_Extension/TodayViewController.m +++ b/Examples/Example-iOS_ObjC-Carthage/Example_Extension/TodayViewController.m @@ -43,10 +43,8 @@ - (void)viewDidLoad { [self loadState]; } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wpartial-availability" - (void)widgetActiveDisplayModeDidChange:(NCWidgetDisplayMode)activeDisplayMode - withMaximumSize:(CGSize)maxSize { + withMaximumSize:(CGSize)maxSize NS_AVAILABLE_IOS(10.0) { if (activeDisplayMode == NCWidgetDisplayModeExpanded) { self.preferredContentSize = CGSizeMake(maxSize.width, 400.0); @@ -54,7 +52,6 @@ - (void)widgetActiveDisplayModeDidChange:(NCWidgetDisplayMode)activeDisplayMode self.preferredContentSize = maxSize; } } -#pragma clang diagnostic pop - (void)widgetPerformUpdateWithCompletionHandler:(void (^)(NCUpdateResult))completionHandler { // Perform any setup necessary in order to update the view. diff --git a/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.m b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.m index 5c86136f6..094601c49 100644 --- a/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.m +++ b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.m @@ -43,10 +43,8 @@ - (void)viewDidLoad { [self loadState]; } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wpartial-availability" - (void)widgetActiveDisplayModeDidChange:(NCWidgetDisplayMode)activeDisplayMode - withMaximumSize:(CGSize)maxSize { + withMaximumSize:(CGSize)maxSize NS_AVAILABLE_IOS(10.0) { if (activeDisplayMode == NCWidgetDisplayModeExpanded) { self.preferredContentSize = CGSizeMake(maxSize.width, 400.0); @@ -54,7 +52,6 @@ - (void)widgetActiveDisplayModeDidChange:(NCWidgetDisplayMode)activeDisplayMode self.preferredContentSize = maxSize; } } -#pragma clang diagnostic pop - (void)widgetPerformUpdateWithCompletionHandler:(void (^)(NCUpdateResult))completionHandler { // Perform any setup necessary in order to update the view. From 13b3f639f3f77cce4dcf51bc86965b46d82d4441 Mon Sep 17 00:00:00 2001 From: Julien Bodet Date: Mon, 19 Nov 2018 20:08:53 -0500 Subject: [PATCH 24/81] Fix indentation --- .../Example_Extension/TodayViewController.m | 288 +++++++++--------- .../TodayViewController.m | 288 +++++++++--------- 2 files changed, 288 insertions(+), 288 deletions(-) diff --git a/Examples/Example-iOS_ObjC-Carthage/Example_Extension/TodayViewController.m b/Examples/Example-iOS_ObjC-Carthage/Example_Extension/TodayViewController.m index 97f9eabdc..fbfb01380 100644 --- a/Examples/Example-iOS_ObjC-Carthage/Example_Extension/TodayViewController.m +++ b/Examples/Example-iOS_ObjC-Carthage/Example_Extension/TodayViewController.m @@ -32,191 +32,191 @@ @interface TodayViewController () 0) ? @"\n" : @"", - dateString, - log]; + // gets message as string + va_list argp; + va_start(argp, format); + NSString *log = [[NSString alloc] initWithFormat:format arguments:argp]; + va_end(argp); + + // outputs to stdout + NSLog(@"%@", log); + + // appends to output log + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + dateFormatter.dateFormat = @"hh:mm:ss"; + NSString *dateString = [dateFormatter stringFromDate:[NSDate date]]; + _logTextView.text = [NSString stringWithFormat:@"%@%@%@: %@", + _logTextView.text, + ([_logTextView.text length] > 0) ? @"\n" : @"", + dateString, + log]; } - (IBAction)clearLogTextView:(UIButton *)sender { - _logTextView.text = @""; + _logTextView.text = @""; } @end diff --git a/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.m b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.m index 094601c49..0db7017f2 100644 --- a/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.m +++ b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.m @@ -32,191 +32,191 @@ @interface TodayViewController () 0) ? @"\n" : @"", - dateString, - log]; + // gets message as string + va_list argp; + va_start(argp, format); + NSString *log = [[NSString alloc] initWithFormat:format arguments:argp]; + va_end(argp); + + // outputs to stdout + NSLog(@"%@", log); + + // appends to output log + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + dateFormatter.dateFormat = @"hh:mm:ss"; + NSString *dateString = [dateFormatter stringFromDate:[NSDate date]]; + _logTextView.text = [NSString stringWithFormat:@"%@%@%@: %@", + _logTextView.text, + ([_logTextView.text length] > 0) ? @"\n" : @"", + dateString, + log]; } - (IBAction)clearLogTextView:(UIButton *)sender { - _logTextView.text = @""; + _logTextView.text = @""; } @end From 8993d43d509c26c2a966d07819137a0552b585c4 Mon Sep 17 00:00:00 2001 From: Julien Bodet Date: Tue, 20 Nov 2018 20:04:03 -0500 Subject: [PATCH 25/81] Configure Carthage and update Podfile --- .../Example.xcodeproj/project.pbxproj | 28 +++++++++-- .../Example_Extension/TodayViewController.m | 2 +- .../project.pbxproj | 48 ------------------- .../TodayViewController.m | 2 +- Examples/Example-iOS_ObjC/Podfile | 6 +-- .../Example.xcodeproj/project.pbxproj | 33 +++++++++++-- .../TodayViewController.swift | 2 +- 7 files changed, 59 insertions(+), 62 deletions(-) diff --git a/Examples/Example-iOS_ObjC-Carthage/Example.xcodeproj/project.pbxproj b/Examples/Example-iOS_ObjC-Carthage/Example.xcodeproj/project.pbxproj index 88f29cf14..839e13e5b 100644 --- a/Examples/Example-iOS_ObjC-Carthage/Example.xcodeproj/project.pbxproj +++ b/Examples/Example-iOS_ObjC-Carthage/Example.xcodeproj/project.pbxproj @@ -7,11 +7,11 @@ objects = { /* Begin PBXBuildFile section */ + 06375C8521A4E46500338E3F /* AppAuthCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06375C8421A4E46500338E3F /* AppAuthCore.framework */; }; 06462457205ED68000072191 /* NotificationCenter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06462456205ED68000072191 /* NotificationCenter.framework */; }; 0646245B205ED68000072191 /* TodayViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0646245A205ED68000072191 /* TodayViewController.m */; }; 0646245E205ED68000072191 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0646245C205ED68000072191 /* MainInterface.storyboard */; }; 06462463205ED68000072191 /* Example_Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 06462455205ED68000072191 /* Example_Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; - 0646246A205EE25800072191 /* AppAuth.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5FEA25241E75C17E00C2D71B /* AppAuth.framework */; }; 346E916E1C29D42800D3620B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 346E916D1C29D42800D3620B /* main.m */; }; 346E91711C29D42800D3620B /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 346E91701C29D42800D3620B /* AppDelegate.m */; }; 346E91791C29D42800D3620B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 346E91781C29D42800D3620B /* Assets.xcassets */; }; @@ -47,6 +47,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 06375C8421A4E46500338E3F /* AppAuthCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppAuthCore.framework; path = Carthage/Build/iOS/AppAuthCore.framework; sourceTree = ""; }; 06462455205ED68000072191 /* Example_Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = Example_Extension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; 06462456205ED68000072191 /* NotificationCenter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NotificationCenter.framework; path = System/Library/Frameworks/NotificationCenter.framework; sourceTree = SDKROOT; }; 06462459205ED68000072191 /* TodayViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TodayViewController.h; sourceTree = ""; }; @@ -74,8 +75,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 06375C8521A4E46500338E3F /* AppAuthCore.framework in Frameworks */, 06462457205ED68000072191 /* NotificationCenter.framework in Frameworks */, - 0646246A205EE25800072191 /* AppAuth.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -106,6 +107,7 @@ 341564001C487ABA00ECA3D9 /* Frameworks */ = { isa = PBXGroup; children = ( + 06375C8421A4E46500338E3F /* AppAuthCore.framework */, 5FEA25241E75C17E00C2D71B /* AppAuth.framework */, 346E91981C2A245000D3620B /* SafariServices.framework */, 06462456205ED68000072191 /* NotificationCenter.framework */, @@ -159,6 +161,7 @@ 06462451205ED68000072191 /* Sources */, 06462452205ED68000072191 /* Frameworks */, 06462453205ED68000072191 /* Resources */, + 06375C8621A4E48800338E3F /* Carthage */, ); buildRules = ( ); @@ -258,6 +261,25 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 06375C8621A4E48800338E3F /* Carthage */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "$(SRCROOT)/Carthage/Build/iOS/AppAuth.framework", + ); + name = Carthage; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/usr/local/bin/carthage copy-frameworks\n"; + }; 5FEA25261E75C1CF00C2D71B /* Carthage */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -271,7 +293,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/usr/local/bin/carthage copy-frameworks"; + shellScript = "/usr/local/bin/carthage copy-frameworks\n"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/Examples/Example-iOS_ObjC-Carthage/Example_Extension/TodayViewController.m b/Examples/Example-iOS_ObjC-Carthage/Example_Extension/TodayViewController.m index fbfb01380..82681feb5 100644 --- a/Examples/Example-iOS_ObjC-Carthage/Example_Extension/TodayViewController.m +++ b/Examples/Example-iOS_ObjC-Carthage/Example_Extension/TodayViewController.m @@ -18,7 +18,7 @@ #import "TodayViewController.h" #import -#import +#import static NSString *const kAppAuthExampleAuthStateKey = @"authState"; diff --git a/Examples/Example-iOS_ObjC/Example-iOS_ObjC.xcodeproj/project.pbxproj b/Examples/Example-iOS_ObjC/Example-iOS_ObjC.xcodeproj/project.pbxproj index 276f53c3f..eb38b576d 100644 --- a/Examples/Example-iOS_ObjC/Example-iOS_ObjC.xcodeproj/project.pbxproj +++ b/Examples/Example-iOS_ObjC/Example-iOS_ObjC.xcodeproj/project.pbxproj @@ -215,7 +215,6 @@ 06D481292055C3D400D9DC32 /* Sources */, 06D4812A2055C3D400D9DC32 /* Frameworks */, 06D4812B2055C3D400D9DC32 /* Resources */, - F998F170E4D14F53FCAA2B07 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -252,8 +251,6 @@ 346E91651C29D42800D3620B /* Sources */, 346E91661C29D42800D3620B /* Frameworks */, 346E91671C29D42800D3620B /* Resources */, - 0B0B46F67786AB6E322D5F2B /* [CP] Embed Pods Frameworks */, - 3CB1FD4B438DD277394F39A7 /* [CP] Copy Pods Resources */, 06D4813E2055C3D400D9DC32 /* Embed App Extensions */, ); buildRules = ( @@ -348,36 +345,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 0B0B46F67786AB6E322D5F2B /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example-iOS_ObjC/Pods-Example-iOS_ObjC-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 3CB1FD4B438DD277394F39A7 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example-iOS_ObjC/Pods-Example-iOS_ObjC-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; 836219F293F319703A16E68D /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -414,21 +381,6 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - F998F170E4D14F53FCAA2B07 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example-iOS_ObjC_Extension/Pods-Example-iOS_ObjC_Extension-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.m b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.m index 0db7017f2..1bfbd96ed 100644 --- a/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.m +++ b/Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.m @@ -18,7 +18,7 @@ #import "TodayViewController.h" #import -#import +#import static NSString *const kAppAuthExampleAuthStateKey = @"authState"; diff --git a/Examples/Example-iOS_ObjC/Podfile b/Examples/Example-iOS_ObjC/Podfile index bf21b203a..a4354d010 100644 --- a/Examples/Example-iOS_ObjC/Podfile +++ b/Examples/Example-iOS_ObjC/Podfile @@ -7,7 +7,7 @@ target 'Example-iOS_ObjC' do end target 'Example-iOS_ObjC_Extension' do - # AppAuth Pod - # In production, just use `pod 'AppAuth'` without the path reference. - pod 'AppAuth', :path => '../../' + # AppAuth/Core Pod + # In production, just use `pod 'AppAuth/Core'` without the path reference. + pod 'AppAuth/Core', :path => '../../' end diff --git a/Examples/Example-iOS_Swift-Carthage/Example.xcodeproj/project.pbxproj b/Examples/Example-iOS_Swift-Carthage/Example.xcodeproj/project.pbxproj index 652315182..33f25f87b 100644 --- a/Examples/Example-iOS_Swift-Carthage/Example.xcodeproj/project.pbxproj +++ b/Examples/Example-iOS_Swift-Carthage/Example.xcodeproj/project.pbxproj @@ -7,11 +7,11 @@ objects = { /* Begin PBXBuildFile section */ + 06375C8821A4E50E00338E3F /* AppAuthCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06375C8721A4E50E00338E3F /* AppAuthCore.framework */; }; 0646249B205F026300072191 /* NotificationCenter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0646249A205F026300072191 /* NotificationCenter.framework */; }; 0646249E205F026300072191 /* TodayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0646249D205F026300072191 /* TodayViewController.swift */; }; 064624A1205F026300072191 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0646249F205F026300072191 /* MainInterface.storyboard */; }; 064624A5205F026300072191 /* Example_Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 06462499205F026300072191 /* Example_Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; - 064624AC205F02FA00072191 /* AppAuth.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F265BD91F9AE50400DC14BF /* AppAuth.framework */; }; 9F265BD11F9AC69300DC14BF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9F265BC91F9AC69300DC14BF /* Assets.xcassets */; }; 9F265BD31F9AC69300DC14BF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9F265BCB1F9AC69300DC14BF /* LaunchScreen.storyboard */; }; 9F265BD41F9AC69300DC14BF /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9F265BCD1F9AC69300DC14BF /* Main.storyboard */; }; @@ -45,6 +45,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 06375C8721A4E50E00338E3F /* AppAuthCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppAuthCore.framework; path = Carthage/Build/iOS/AppAuthCore.framework; sourceTree = ""; }; 06462499205F026300072191 /* Example_Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = Example_Extension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; 0646249A205F026300072191 /* NotificationCenter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NotificationCenter.framework; path = System/Library/Frameworks/NotificationCenter.framework; sourceTree = SDKROOT; }; 0646249D205F026300072191 /* TodayViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TodayViewController.swift; sourceTree = ""; }; @@ -67,7 +68,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 064624AC205F02FA00072191 /* AppAuth.framework in Frameworks */, + 06375C8821A4E50E00338E3F /* AppAuthCore.framework in Frameworks */, 0646249B205F026300072191 /* NotificationCenter.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -130,6 +131,7 @@ 9F265BD81F9AE4CA00DC14BF /* Frameworks */ = { isa = PBXGroup; children = ( + 06375C8721A4E50E00338E3F /* AppAuthCore.framework */, 9F265BD91F9AE50400DC14BF /* AppAuth.framework */, 0646249A205F026300072191 /* NotificationCenter.framework */, ); @@ -146,6 +148,7 @@ 06462495205F026300072191 /* Sources */, 06462496205F026300072191 /* Frameworks */, 06462497205F026300072191 /* Resources */, + 06375C8921A4E56B00338E3F /* Carthage */, ); buildRules = ( ); @@ -163,7 +166,7 @@ 9F265B931F9AC5D600DC14BF /* Sources */, 9F265B941F9AC5D600DC14BF /* Frameworks */, 9F265B951F9AC5D600DC14BF /* Resources */, - 9F265BDB1F9AE52C00DC14BF /* ShellScript */, + 9F265BDB1F9AE52C00DC14BF /* Carthage */, 064624A9205F026300072191 /* Embed App Extensions */, ); buildRules = ( @@ -247,7 +250,26 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 9F265BDB1F9AE52C00DC14BF /* ShellScript */ = { + 06375C8921A4E56B00338E3F /* Carthage */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "$(SRCROOT)/Carthage/Build/iOS/AppAuth.framework", + ); + name = Carthage; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/usr/local/bin/carthage copy-frameworks\n"; + }; + 9F265BDB1F9AE52C00DC14BF /* Carthage */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -255,11 +277,12 @@ inputPaths = ( "$(SRCROOT)/Carthage/Build/iOS/AppAuth.framework", ); + name = Carthage; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/usr/local/bin/carthage copy-frameworks"; + shellScript = "/usr/local/bin/carthage copy-frameworks\n"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/Examples/Example-iOS_Swift-Carthage/Example_Extension/TodayViewController.swift b/Examples/Example-iOS_Swift-Carthage/Example_Extension/TodayViewController.swift index d1b1c13d8..fc663d1bd 100644 --- a/Examples/Example-iOS_Swift-Carthage/Example_Extension/TodayViewController.swift +++ b/Examples/Example-iOS_Swift-Carthage/Example_Extension/TodayViewController.swift @@ -18,7 +18,7 @@ import UIKit import NotificationCenter -import AppAuth +import AppAuthCore /** NSCoding key for the authState property. From 88136c310534caa9c32da410bbdb2a877bd15d64 Mon Sep 17 00:00:00 2001 From: Souleiman Benhida Date: Fri, 14 Aug 2020 19:38:12 -0400 Subject: [PATCH 26/81] Rename TVAuthorizationEndpoint to deviceAuthorizationEndpoint --- .../AppAuthTVExampleViewController.m | 16 +++---- Source/AppAuthTV/OIDTVAuthorizationRequest.m | 2 +- Source/AppAuthTV/OIDTVServiceConfiguration.h | 15 +++--- Source/AppAuthTV/OIDTVServiceConfiguration.m | 28 +++++------ .../OIDTVAuthorizationRequestTests.h | 8 ++-- .../OIDTVAuthorizationRequestTests.m | 46 +++++++++---------- .../OIDTVAuthorizationResponseTests.m | 8 ++-- UnitTests/AppAuthTV/OIDTVTokenRequestTests.m | 22 ++++----- 8 files changed, 73 insertions(+), 72 deletions(-) diff --git a/Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.m b/Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.m index c65ee4e0d..3d461619d 100644 --- a/Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.m +++ b/Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.m @@ -22,7 +22,7 @@ #import /*! @brief Indicates whether YES to discover endpoints from @c kIssuer or NO to use the - @c kTVAuthorizationEndpoint, @c kTokenEndpoint, and @c kUserInfoEndpoint values defined + @c kDeviceAuthorizationEndpoint, @c kTokenEndpoint, and @c kUserInfoEndpoint values defined below. */ static BOOL const shouldDiscoverEndpoints = YES; @@ -41,7 +41,7 @@ /*! @brief Device authorization endpoint. */ -static NSString *const kTVAuthorizationEndpoint = @"https://www.example.com/device"; +static NSString *const kDeviceAuthorizationEndpoint = @"https://www.example.com/device"; /*! @brief Token endpoint. */ @@ -99,8 +99,8 @@ - (void)verifyConfig { "Instructions: " "https://github.com/openid/AppAuth-iOS/blob/master/Examples/Example-tvOS/README.md"); } else { - NSAssert(![kTVAuthorizationEndpoint isEqualToString:@"https://www.example.com/device"], - @"Update kTVAuthorizationEndpoint with your own TV authorization endpoint. " + NSAssert(![kDeviceAuthorizationEndpoint isEqualToString:@"https://www.example.com/device"], + @"Update kDeviceAuthorizationEndpoint with your own device authorization endpoint. " "Instructions: " "https://github.com/openid/AppAuth-iOS/blob/master/Examples/Example-tvOS/README.md"); @@ -155,12 +155,12 @@ - (IBAction)signin:(id)sender { [self performAuthorizationWithConfiguration:configuration]; }]; } else { - NSURL *TVAuthorizationEndpoint = [NSURL URLWithString:kTVAuthorizationEndpoint]; + NSURL *deviceAuthorizationEndpoint = [NSURL URLWithString:kDeviceAuthorizationEndpoint]; NSURL *tokenEndpoint = [NSURL URLWithString:kTokenEndpoint]; - OIDTVServiceConfiguration *configuration = - [[OIDTVServiceConfiguration alloc] initWithTVAuthorizationEndpoint:TVAuthorizationEndpoint - tokenEndpoint:tokenEndpoint]; + OIDTVServiceConfiguration *configuration = [[OIDTVServiceConfiguration alloc] + initWithDeviceAuthorizationEndpoint:deviceAuthorizationEndpoint + tokenEndpoint:tokenEndpoint]; // Perform authorization flow [self performAuthorizationWithConfiguration:configuration]; diff --git a/Source/AppAuthTV/OIDTVAuthorizationRequest.m b/Source/AppAuthTV/OIDTVAuthorizationRequest.m index 5d085beb2..da524d388 100644 --- a/Source/AppAuthTV/OIDTVAuthorizationRequest.m +++ b/Source/AppAuthTV/OIDTVAuthorizationRequest.m @@ -105,7 +105,7 @@ - (NSURLRequest *)URLRequest { OIDTVServiceConfiguration *tvConfiguration = (OIDTVServiceConfiguration *)self.configuration; NSMutableURLRequest *URLRequest = - [[NSURLRequest requestWithURL:tvConfiguration.TVAuthorizationEndpoint] mutableCopy]; + [[NSURLRequest requestWithURL:tvConfiguration.deviceAuthorizationEndpoint] mutableCopy]; URLRequest.HTTPMethod = kHTTPPost; [URLRequest setValue:kHTTPContentTypeHeaderValue forHTTPHeaderField:kHTTPContentTypeHeaderKey]; NSString *bodyString = [query URLEncodedParameters]; diff --git a/Source/AppAuthTV/OIDTVServiceConfiguration.h b/Source/AppAuthTV/OIDTVServiceConfiguration.h index bdedcdd10..2afea6cac 100644 --- a/Source/AppAuthTV/OIDTVServiceConfiguration.h +++ b/Source/AppAuthTV/OIDTVServiceConfiguration.h @@ -24,19 +24,19 @@ NS_ASSUME_NONNULL_BEGIN */ @interface OIDTVServiceConfiguration : OIDServiceConfiguration -/*! @brief The TV authorization endpoint URI. +/*! @brief The device authorization endpoint URI. */ -@property(nonatomic, readonly) NSURL *TVAuthorizationEndpoint; +@property(nonatomic, readonly) NSURL *deviceAuthorizationEndpoint; /*! @internal @brief Unavailable. Please use - @c initWithTVAuthorizationEndpoint:tokenEndpoint: + @c initWithDeviceAuthorizationEndpoint:tokenEndpoint: */ - (instancetype)init NS_UNAVAILABLE; /*! @internal @brief Unavailable. Please use - @c initWithTVAuthorizationEndpoint:tokenEndpoint: + @c initWithDeviceAuthorizationEndpoint:tokenEndpoint: */ - (instancetype)initWithAuthorizationEndpoint:(NSURL *)authorizationEndpoint tokenEndpoint:(NSURL *)tokenEndpoint NS_UNAVAILABLE; @@ -49,11 +49,12 @@ NS_ASSUME_NONNULL_BEGIN NS_DESIGNATED_INITIALIZER; /*! @brief Designated initializer. - @param TVAuthorizationEndpoint The TV authorization endpoint URI. + @param deviceAuthorizationEndpoint The device authorization endpoint URI. @param tokenEndpoint The token exchange and refresh endpoint URI. */ -- (instancetype)initWithTVAuthorizationEndpoint:(NSURL *)TVAuthorizationEndpoint - tokenEndpoint:(NSURL *)tokenEndpoint NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithDeviceAuthorizationEndpoint:(NSURL *)deviceAuthorizationEndpoint + tokenEndpoint:(NSURL *)tokenEndpoint + NS_DESIGNATED_INITIALIZER; @end diff --git a/Source/AppAuthTV/OIDTVServiceConfiguration.m b/Source/AppAuthTV/OIDTVServiceConfiguration.m index c20883d18..202aa9104 100644 --- a/Source/AppAuthTV/OIDTVServiceConfiguration.m +++ b/Source/AppAuthTV/OIDTVServiceConfiguration.m @@ -21,9 +21,9 @@ #import "OIDDefines.h" #import "OIDServiceDiscovery.h" -/*! @brief The key for the @c TVAuthorizationEndpoint property. +/*! @brief The key for the @c deviceAuthorizationEndpoint property. */ -static NSString *const kTVAuthorizationEndpointKey = @"TVAuthorizationEndpoint"; +static NSString *const kDeviceAuthorizationEndpointKey = @"deviceAuthorizationEndpoint"; NS_ASSUME_NONNULL_BEGIN @@ -39,11 +39,11 @@ - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIAL @implementation OIDTVServiceConfiguration - (instancetype)init - OID_UNAVAILABLE_USE_INITIALIZER(@selector(initWithTVAuthorizationEndpoint:tokenEndpoint:)) + OID_UNAVAILABLE_USE_INITIALIZER(@selector(initWithDeviceAuthorizationEndpoint:tokenEndpoint:)) - (instancetype)initWithAuthorizationEndpoint:(NSURL *)authorizationEndpoint tokenEndpoint:(NSURL *)tokenEndpoint - OID_UNAVAILABLE_USE_INITIALIZER(@selector(initWithTVAuthorizationEndpoint:tokenEndpoint:)) + OID_UNAVAILABLE_USE_INITIALIZER(@selector(initWithDeviceAuthorizationEndpoint:tokenEndpoint:)) - (instancetype)initWithDiscoveryDocument:(OIDServiceDiscovery *)discoveryDocument { self = [super initWithDiscoveryDocument:discoveryDocument]; @@ -53,18 +53,18 @@ - (instancetype)initWithDiscoveryDocument:(OIDServiceDiscovery *)discoveryDocume NSLog(@"Warning: Discovery document used to initialize %@ " @"does not contain device authorization endpoint.", self); } else { - _TVAuthorizationEndpoint = [discoveryDocument.deviceAuthorizationEndpoint copy]; + _deviceAuthorizationEndpoint = [discoveryDocument.deviceAuthorizationEndpoint copy]; } } return self; } -- (instancetype)initWithTVAuthorizationEndpoint:(NSURL *)TVAuthorizationEndpoint - tokenEndpoint:(NSURL *)tokenEndpoint { +- (instancetype)initWithDeviceAuthorizationEndpoint:(NSURL *)deviceAuthorizationEndpoint + tokenEndpoint:(NSURL *)tokenEndpoint { self = [super initWithAuthorizationEndpoint:[[NSURL alloc] initWithString:@""] tokenEndpoint:tokenEndpoint]; if (self) { - _TVAuthorizationEndpoint = [TVAuthorizationEndpoint copy]; + _deviceAuthorizationEndpoint = [deviceAuthorizationEndpoint copy]; } return self; } @@ -78,25 +78,25 @@ + (BOOL)supportsSecureCoding { - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder { self = [super initWithCoder:aDecoder]; if (self) { - NSURL *TVAuthorizationEndpoint = [aDecoder decodeObjectOfClass:[NSURL class] - forKey:kTVAuthorizationEndpointKey]; - _TVAuthorizationEndpoint = TVAuthorizationEndpoint; + NSURL *deviceAuthorizationEndpoint = + [aDecoder decodeObjectOfClass:[NSURL class] forKey:kDeviceAuthorizationEndpointKey]; + _deviceAuthorizationEndpoint = deviceAuthorizationEndpoint; } return self; } - (void)encodeWithCoder:(NSCoder *)aCoder { [super encodeWithCoder:aCoder]; - [aCoder encodeObject:_TVAuthorizationEndpoint forKey:kTVAuthorizationEndpointKey]; + [aCoder encodeObject:_deviceAuthorizationEndpoint forKey:kDeviceAuthorizationEndpointKey]; } #pragma mark - description - (NSString *)description { - return [NSString stringWithFormat:@"<%@: %p, TVAuthorizationEndpoint: %@ tokenEndpoint: %@>", + return [NSString stringWithFormat:@"<%@: %p, deviceAuthorizationEndpoint: %@ tokenEndpoint: %@>", NSStringFromClass([self class]), (void *)self, - _TVAuthorizationEndpoint, + _deviceAuthorizationEndpoint, self.tokenEndpoint]; } diff --git a/UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.h b/UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.h index 4a2fb49b0..d4198a448 100644 --- a/UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.h +++ b/UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.h @@ -33,14 +33,14 @@ NS_ASSUME_NONNULL_BEGIN - (void)testInitializer; /*! @brief Tests the @c NSCopying implementation by round-tripping an instance through the copying - * process and checking to make sure the source and destination both contain the - * @c TVAuthorizationEndpoint + * process and checking to make sure the source and destination both contain the + * @c deviceAuthorizationEndpoint */ - (void)testCopying; /*! @brief Tests the @c NSSecureCoding implementation by round-tripping an instance through the - * coding process and checking to make sure the source and destination both contain the - * @c TVAuthorizationEndpoint + * coding process and checking to make sure the source and destination both contain the + * @c deviceAuthorizationEndpoint */ - (void)testSecureCoding; diff --git a/UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.m b/UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.m index b86869c34..7b1d19c95 100644 --- a/UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.m +++ b/UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.m @@ -32,9 +32,9 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wgnu" -/*! @brief Test value for the @c TVAuthorizationEndpoint property. +/*! @brief Test value for the @c deviceAuthorizationEndpoint property. */ -static NSString *const kTestTVAuthorizationEndpoint = @"https://www.example.com/device/code"; +static NSString *const kTestDeviceAuthorizationEndpoint = @"https://www.example.com/device/code"; /*! @brief Test value for the @c tokenEndpoint property. */ @@ -89,10 +89,10 @@ @implementation OIDTVAuthorizationRequestTests - (OIDTVServiceConfiguration *)testServiceConfiguration { NSURL *tokenEndpoint = [NSURL URLWithString:kTestTokenEndpoint]; - NSURL *TVAuthorizationEndpoint = [NSURL URLWithString:kTestTVAuthorizationEndpoint]; + NSURL *deviceAuthorizationEndpoint = [NSURL URLWithString:kTestDeviceAuthorizationEndpoint]; OIDTVServiceConfiguration *configuration = - [[OIDTVServiceConfiguration alloc] initWithTVAuthorizationEndpoint:TVAuthorizationEndpoint + [[OIDTVServiceConfiguration alloc] initWithDeviceAuthorizationEndpoint:deviceAuthorizationEndpoint tokenEndpoint:tokenEndpoint]; return configuration; } @@ -131,8 +131,8 @@ - (void)testInitializer { scopes:testScopes additionalParameters:testAdditionalParameters]; - NSURL *authRequestTVAuthorizationEndpoint = - ((OIDTVServiceConfiguration *)authRequest.configuration).TVAuthorizationEndpoint; + NSURL *authRequestDeviceAuthorizationEndpoint = + ((OIDTVServiceConfiguration *)authRequest.configuration).deviceAuthorizationEndpoint; XCTAssertEqualObjects(authRequest.clientID, kTestClientID); XCTAssertEqualObjects(authRequest.clientSecret, kTestClientSecret); @@ -140,13 +140,13 @@ - (void)testInitializer { XCTAssertEqualObjects(authRequest.additionalParameters, testAdditionalParameters); XCTAssertEqualObjects(authRequest.responseType, OIDResponseTypeCode); XCTAssertEqualObjects(authRequest.redirectURL, [[NSURL alloc] initWithString:@""]); - XCTAssertEqualObjects(authRequestTVAuthorizationEndpoint, - serviceConfiguration.TVAuthorizationEndpoint); + XCTAssertEqualObjects(authRequestDeviceAuthorizationEndpoint, + serviceConfiguration.deviceAuthorizationEndpoint); } /*! @brief Tests the @c NSCopying implementation by round-tripping an instance through the copying - * process and checking to make sure the source and destination both contain the - * @c TVAuthorizationEndpoint + * process and checking to make sure the source and destination both contain the + * @c deviceAuthorizationEndpoint */ - (void)testCopying { OIDTVServiceConfiguration *serviceConfiguration = [self testServiceConfiguration]; @@ -159,16 +159,16 @@ - (void)testCopying { additionalParameters:nil]; OIDTVAuthorizationRequest *authRequestCopy = [authRequest copy]; - NSURL *authRequestCopyTVAuthorizationEndpoint = - ((OIDTVServiceConfiguration *)authRequestCopy.configuration).TVAuthorizationEndpoint; + NSURL *authRequestCopyDeviceAuthorizationEndpoint = + ((OIDTVServiceConfiguration *)authRequestCopy.configuration).deviceAuthorizationEndpoint; - XCTAssertEqualObjects(authRequestCopyTVAuthorizationEndpoint, - serviceConfiguration.TVAuthorizationEndpoint); + XCTAssertEqualObjects(authRequestCopyDeviceAuthorizationEndpoint, + serviceConfiguration.deviceAuthorizationEndpoint); } /*! @brief Tests the @c NSSecureCoding implementation by round-tripping an instance through the - * coding process and checking to make sure the source and destination both contain the - * @c TVAuthorizationEndpoint + * coding process and checking to make sure the source and destination both contain the + * @c deviceAuthorizationEndpoint */ - (void)testSecureCoding { OIDTVServiceConfiguration *serviceConfiguration = [self testServiceConfiguration]; @@ -183,11 +183,11 @@ - (void)testSecureCoding { NSData *data = [NSKeyedArchiver archivedDataWithRootObject:authRequest]; OIDTVAuthorizationRequest *authRequestCopy = [NSKeyedUnarchiver unarchiveObjectWithData:data]; - NSURL *authRequestCopyTVAuthorizationEndpoint = - ((OIDTVServiceConfiguration *)authRequestCopy.configuration).TVAuthorizationEndpoint; + NSURL *authRequestCopyDeviceAuthorizationEndpoint = + ((OIDTVServiceConfiguration *)authRequestCopy.configuration).deviceAuthorizationEndpoint; - XCTAssertEqualObjects(authRequestCopyTVAuthorizationEndpoint, - serviceConfiguration.TVAuthorizationEndpoint); + XCTAssertEqualObjects(authRequestCopyDeviceAuthorizationEndpoint, + serviceConfiguration.deviceAuthorizationEndpoint); } /*! @brief Tests the @c URLRequest method on a request with no scopes or additional parameters @@ -207,7 +207,7 @@ - (void)testURLRequestBasicClientAuth { XCTAssertEqualObjects(URLRequest.HTTPMethod, kHTTPPost); XCTAssertEqualObjects([URLRequest valueForHTTPHeaderField:kHTTPContentTypeHeaderKey], kHTTPContentTypeHeaderValue); - XCTAssertEqualObjects(URLRequest.URL, serviceConfiguration.TVAuthorizationEndpoint); + XCTAssertEqualObjects(URLRequest.URL, serviceConfiguration.deviceAuthorizationEndpoint); NSDictionary *bodyParameters = [self bodyParametersFromURLRequest:URLRequest]; @@ -238,7 +238,7 @@ - (void)testURLRequestScopes { XCTAssertEqualObjects([URLRequest HTTPMethod], kHTTPPost); XCTAssertEqualObjects([URLRequest valueForHTTPHeaderField:kHTTPContentTypeHeaderKey], kHTTPContentTypeHeaderValue); - XCTAssertEqualObjects(URLRequest.URL, serviceConfiguration.TVAuthorizationEndpoint); + XCTAssertEqualObjects(URLRequest.URL, serviceConfiguration.deviceAuthorizationEndpoint); NSDictionary *bodyParameters = [self bodyParametersFromURLRequest:URLRequest]; @@ -269,7 +269,7 @@ - (void)testURLRequestAdditionalParams { XCTAssertEqualObjects([URLRequest HTTPMethod], kHTTPPost); XCTAssertEqualObjects([URLRequest valueForHTTPHeaderField:kHTTPContentTypeHeaderKey], kHTTPContentTypeHeaderValue); - XCTAssertEqualObjects(URLRequest.URL, serviceConfiguration.TVAuthorizationEndpoint); + XCTAssertEqualObjects(URLRequest.URL, serviceConfiguration.deviceAuthorizationEndpoint); NSDictionary *bodyParameters = [self bodyParametersFromURLRequest:URLRequest]; diff --git a/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.m b/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.m index 00612fd8f..555f6e177 100644 --- a/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.m +++ b/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.m @@ -29,9 +29,9 @@ #import "Source/AppAuthTV/OIDTVTokenRequest.h" #endif -/*! @brief Test value for the @c TVAuthorizationEndpoint property. +/*! @brief Test value for the @c deviceAuthorizationEndpoint property. */ -static NSString *const kTestTVAuthorizationEndpoint = @"https://www.example.com/device/code"; +static NSString *const kTestDeviceAuthorizationEndpoint = @"https://www.example.com/device/code"; /*! @brief Test value for the @c tokenEndpoint property. */ @@ -110,10 +110,10 @@ @implementation OIDTVAuthorizationResponseTests - (OIDTVServiceConfiguration *)testServiceConfiguration { NSURL *tokenEndpoint = [NSURL URLWithString:kTestTokenEndpoint]; - NSURL *TVAuthorizationEndpoint = [NSURL URLWithString:kTestTVAuthorizationEndpoint]; + NSURL *deviceAuthorizationEndpoint = [NSURL URLWithString:kTestDeviceAuthorizationEndpoint]; OIDTVServiceConfiguration *configuration = - [[OIDTVServiceConfiguration alloc] initWithTVAuthorizationEndpoint:TVAuthorizationEndpoint + [[OIDTVServiceConfiguration alloc] initWithDeviceAuthorizationEndpoint:deviceAuthorizationEndpoint tokenEndpoint:tokenEndpoint]; return configuration; } diff --git a/UnitTests/AppAuthTV/OIDTVTokenRequestTests.m b/UnitTests/AppAuthTV/OIDTVTokenRequestTests.m index eecb48d35..cf0bf4963 100644 --- a/UnitTests/AppAuthTV/OIDTVTokenRequestTests.m +++ b/UnitTests/AppAuthTV/OIDTVTokenRequestTests.m @@ -33,9 +33,9 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wgnu" -/*! @brief Test value for the @c TVAuthorizationEndpoint property. +/*! @brief Test value for the @c deviceAuthorizationEndpoint property. */ -static NSString *const kTestTVAuthorizationEndpoint = +static NSString *const kTestDeviceAuthorizationEndpoint = @"https://www.example.com/device/code"; /*! @brief Test value for the @c tokenEndpoint property. @@ -106,11 +106,11 @@ @implementation OIDTVTokenRequestTests - (OIDTVServiceConfiguration *)testServiceConfiguration { NSURL *tokenEndpoint = [NSURL URLWithString:kTestTokenEndpoint]; - NSURL *TVAuthorizationEndpoint = [NSURL URLWithString:kTestTVAuthorizationEndpoint]; + NSURL *deviceAuthorizationEndpoint = [NSURL URLWithString:kTestDeviceAuthorizationEndpoint]; - OIDTVServiceConfiguration *configuration = - [[OIDTVServiceConfiguration alloc] initWithTVAuthorizationEndpoint:TVAuthorizationEndpoint - tokenEndpoint:tokenEndpoint]; + OIDTVServiceConfiguration *configuration = [[OIDTVServiceConfiguration alloc] + initWithDeviceAuthorizationEndpoint:deviceAuthorizationEndpoint + tokenEndpoint:tokenEndpoint]; return configuration; } @@ -128,11 +128,11 @@ - (OIDTVTokenRequest *)testTokenRequest { */ - (void)testInitializer { OIDTVTokenRequest *request = [self testTokenRequest]; - NSURL *requestTVAuthorizationEndpoint = - ((OIDTVServiceConfiguration *)request.configuration).TVAuthorizationEndpoint; - - XCTAssertEqualObjects(requestTVAuthorizationEndpoint, - [self testServiceConfiguration].TVAuthorizationEndpoint); + NSURL *requestDeviceAuthorizationEndpoint = + ((OIDTVServiceConfiguration *)request.configuration).deviceAuthorizationEndpoint; + + XCTAssertEqualObjects(requestDeviceAuthorizationEndpoint, + [self testServiceConfiguration].deviceAuthorizationEndpoint); XCTAssertEqualObjects(request.deviceCode, kDeviceCodeValue); XCTAssertEqualObjects(request.grantType, kOIDTVDeviceTokenGrantType); XCTAssertEqualObjects(request.clientID, kTestClientID); From e191b1beadf3041259652e6e464eaceff16e5fbb Mon Sep 17 00:00:00 2001 From: Souleiman Benhida Date: Fri, 14 Aug 2020 19:57:07 -0400 Subject: [PATCH 27/81] Document tvOS support in READMEs - Create a tvOS example README - Document tvOS support in main README - Link to tvOS example from the example README - Add Google IdP tvOS details --- Examples/Example-tvOS/README.md | 64 ++++++++++++++ Examples/README-Google.md | 12 ++- Examples/README.md | 1 + README.md | 143 +++++++++++++++++++++++++++++--- 4 files changed, 207 insertions(+), 13 deletions(-) create mode 100644 Examples/Example-tvOS/README.md diff --git a/Examples/Example-tvOS/README.md b/Examples/Example-tvOS/README.md new file mode 100644 index 000000000..4787247b6 --- /dev/null +++ b/Examples/Example-tvOS/README.md @@ -0,0 +1,64 @@ +# Example Project + +## Setup & Open the Project + +1. In the `Example-tvOS` folder, run the following command to install the AppAuth pod with the TV +subspec. + +``` +pod install +``` + +2. Open the `Example-tvOS.xcworkspace` workspace. + +``` +open Example-tvOS.xcworkspace +``` + +This workspace is configured to include AppAuth via CocoaPods. You can also include AppAuthTV using +Carthage or Swift Package Manager, please see the main [README](../../README.md) for instructions. + +## Configuration + +The example doesn't work out of the box; you need to configure it with your own client and IdP details. + +### Information You'll Need + +* Client ID +* Client Secret (optional) + +If you are choosing to automatically discover endpoints: + +* Issuer URL + +If you are choosing to manually specify endpoints: + +* Device Authorization Endpoint +* Token Endpoint +* User Info Endpoint + +How to get this information varies by IdP, but we have +[instructions](../README.md#openid-certified-providers) for some OpenID Certified providers. + +### Configure the Example + +#### In the file `AppAuthTVExampleViewController.m` + +1. Update `kClientID` with your new client ID. +2. Update `kClientSecret` with your client ID's secret, or set to `""` if not using. + +If you are choosing to automatically discover endpoints, also: + +1. Update `kIssuer` with the issuer URL. +2. Set `shouldDiscoverEndpoints` to `YES` + +If you are choosing to manually specify endpoints, also: + +1. Set `shouldDiscoverEndpoints` to `NO` +2. Update `kDeviceAuthorizationEndpoint` with the device authorization endpoint. +3. Update `kTokenEndpoint` with the token endpoint. +4. Update `kUserInfoEndpoint` with the token endpoint. + +### Running the Example + +Now your example should be ready to run. diff --git a/Examples/README-Google.md b/Examples/README-Google.md index 5a9c3f720..5b572b60b 100644 --- a/Examples/README-Google.md +++ b/Examples/README-Google.md @@ -21,7 +21,6 @@ Then, setup the example with your configuration: | Client ID | The value named `Client ID` in the console, has the format `IDENTIFIER.apps.googleusercontent.com`.| | Client Secret | Google's iOS clients do not have a secret.| | Redirect URI | The value for `iOS URL scheme` wil be the scheme of your redirect URI. This is the Client ID in reverse domain name notation, e.g. ` com.googleusercontent.apps.IDENTIFIER`. To construct the redirect URI, add your own path component. E.g. ` com.googleusercontent.apps.IDENTIFIER:/oauth2redirect/google`. Note that there is only a single slash (`/`) after the scheme.| -| ## macOS @@ -36,3 +35,14 @@ Then, setup the example with your configuration: | Client Secret | The value named `Client secret` in the console.| | Redirect URI | For macOS, you can use either the loopback interface (where AppAuth will generate the redirect URI for you), or a custom scheme. To create a custom scheme redirect URI, reverse the client id to get the URI scheme, for example ` com.googleusercontent.apps.IDENTIFIER` and, add your own path component. E.g. `com.googleusercontent.apps.IDENTIFIER:/oauth2redirect/google`. Note that there is only a single slash (`/`) after the scheme.| +## tvOS + +Select "TVs and Limited Input devices" as the application type. + +Then, setup the example with your configuration. + +| Configuration | Description | +|---------------------------|------------------| +| Issuer | `https://accounts.google.com` | +| Client ID | The value named `Client ID` in the console, has the format `IDENTIFIER.apps.googleusercontent.com`.| +| Client Secret | The value named `Client secret` in the console.| diff --git a/Examples/README.md b/Examples/README.md index 2361d3d49..820c0d5bb 100644 --- a/Examples/README.md +++ b/Examples/README.md @@ -11,6 +11,7 @@ Each example has docs on how to configure: * [Example for iOS (Objective-C)](Example-iOS_ObjC/README.md) * [Example for iOS w/ Carthage (Objective-C)](Example-iOS_ObjC-Carthage/README.md) * [Example for macOS](Example-macOS/README.md) +* [Example for tvOS](Example-tvOS/README.md) To get the Issuer, Client ID, and Redirect URI, for your particular IdP, you may view the IdP-specific information in the next section. diff --git a/README.md b/README.md index 50ffc204a..051223462 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![Pod Platform](https://img.shields.io/cocoapods/p/AppAuth.svg?style=flat)](https://cocoapods.org/pods/AppAuth) [![Catalyst compatible](https://img.shields.io/badge/Catalyst-compatible-brightgreen.svg?style=flat)](https://developer.apple.com/documentation/xcode/creating_a_mac_version_of_your_ipad_app) -AppAuth for iOS and macOS is a client SDK for communicating with +AppAuth for iOS and macOS, and tvOS is a client SDK for communicating with [OAuth 2.0](https://tools.ietf.org/html/rfc6749) and [OpenID Connect](http://openid.net/specs/openid-connect-core-1_0.html) providers. It strives to @@ -30,6 +30,9 @@ custom URI scheme redirects are used. The library is friendly to other extensions (standard or otherwise), with the ability to handle additional params in all protocol requests and responses. +For tvOS, AppAuth implements [OAuth 2.0 Device Authorization Grant +](https://tools.ietf.org/html/rfc8628) to allow for tvOS sign-ins through a secondary device. + ## Specification ### iOS @@ -70,6 +73,16 @@ either through custom URI schemes, or loopback HTTP redirects. Authorization servers that assume all clients are web-based, or require clients to maintain confidentiality of the client secrets may not work well. +### tvOS + +#### Supported Versions + +AppAuth supports tvOS 9.0 and above. Please note that while it is possible to run the standard AppAuth library on tvOS, the documentation below describes implementing [OAuth 2.0 Device Authorization Grant](https://tools.ietf.org/html/rfc8628) (AppAuthTV). + +#### Authorization Server Requirements + +AppAuthTV is designed for servers that support the device authorization flow as documented in [RFC 8628](https://tools.ietf.org/html/rfc8628). + ## Try Want to try out AppAuth? Just run: @@ -84,6 +97,20 @@ client info to try the demo). AppAuth supports four options for dependency management. +### CocoaPods + +With [CocoaPods](https://guides.cocoapods.org/using/getting-started.html), +add the following line to your `Podfile`: + + pod 'AppAuth' + +Then, run `pod install`. + +**tvOS:** Use the `TV` subspec: + + pod 'AppAuth/TV' + + ### Swift Package Manager With [Swift Package Manager](https://swift.org/package-manager), @@ -95,14 +122,7 @@ dependencies: [ ] ``` -### CocoaPods - -With [CocoaPods](https://guides.cocoapods.org/using/getting-started.html), -add the following line to your `Podfile`: - - pod 'AppAuth' - -Then, run `pod install`. +**tvOS:** Use the `AppAuthTV` target. ### Carthage @@ -113,6 +133,8 @@ line to your `Cartfile`: Then, run `carthage bootstrap`. +**tvOS:** Use the `AppAuthTV` framework. + ### Static Library You can also use AppAuth as a static library. This requires linking the library @@ -125,6 +147,8 @@ Linked Framework and Libraries" section of your target). 4. Add `AppAuth-iOS/Source` to your search paths of your target ("Build Settings -> "Header Search Paths"). +*Note: There is no static library for AppAuthTV.* + ## Auth Flow AppAuth supports both manual interaction with the authorization server @@ -166,6 +190,24 @@ let configuration = OIDServiceConfiguration(authorizationEndpoint: authorization // perform the auth request... ``` +**tvOS** + +Objective-C +```objc +NSURL *deviceAuthorizationEndpoint = + [NSURL URLWithString:@"https://oauth2.googleapis.com/device/code"]; +NSURL *tokenEndpoint = + [NSURL URLWithString:@"https://www.googleapis.com/oauth2/v4/token"]; + +OIDTVServiceConfiguration *configuration = + [[OIDTVServiceConfiguration alloc] + initWithDeviceAuthorizationEndpoint:deviceAuthorizationEndpoint + tokenEndpoint:tokenEndpoint]; + +// perform the auth request... +``` + + Or through discovery: Objective-C @@ -201,6 +243,26 @@ OIDAuthorizationService.discoverConfiguration(forIssuer: issuer) { configuration } ``` +**tvOS** + +Objective-C +```objc +NSURL *issuer = [NSURL URLWithString:@"https://accounts.google.com"]; + +[OIDTVAuthorizationService discoverServiceConfigurationForIssuer:issuer + completion:^(OIDTVServiceConfiguration *_Nullable configuration, + NSError *_Nullable error) { + + if (!configuration) { + NSLog(@"Error retrieving discovery document: %@", + [error localizedDescription]); + return; + } + + // perform the auth request... +}]; +``` + ### Authorizing – iOS First, you need to have a property in your `UIApplicationDelegate` @@ -428,6 +490,63 @@ _redirectHTTPHandler.currentAuthorizationFlow = }]; ``` + +### Authorizing – tvOS + +Ensure that your main class is a delegate of `OIDAuthStateChangeDelegate`, `OIDAuthStateErrorDelegate`, implement the corresponding methods, and include the following property and instance variable: + +Objective-C +```objc +// property of the containing class +@property(nonatomic, strong, nullable) OIDAuthState *authState; + +// instance variable of the containing class +OIDTVAuthorizationCancelBlock _cancelBlock; +``` + +Then, build and perform the authorization request. + +Objective-C +```objc +// builds authentication request +__weak __typeof(self) weakSelf = self; + +OIDTVAuthorizationRequest *request = + [[OIDTVAuthorizationRequest alloc] initWithConfiguration:configuration + clientId:kClientID + clientSecret:kClientSecret + scopes:@[ OIDScopeOpenID, OIDScopeProfile ] + additionalParameters:nil]; + +// performs authentication request +OIDTVAuthorizationInitialization initBlock = + ^(OIDTVAuthorizationResponse *_Nullable response, NSError *_Nullable error) { + if (response) { + // process authorization response + NSLog(@"Got authorization response: %@", response); + } else { + // handle initialization error + NSLog(@"Error: %@", error); + } + }; + +OIDTVAuthorizationCompletion completionBlock = + ^(OIDAuthState *_Nullable authState, NSError *_Nullable error) { + weakSelf.signInView.hidden = YES; + if (authState) { + NSLog(@"Token response: %@", authState.lastTokenResponse); + [weakSelf setAuthState:authState]; + } else { + NSLog(@"Error: %@", error); + [weakSelf setAuthState:nil]; + } + }; + +_cancelBlock = [OIDTVAuthorizationService authorizeTVRequest:request + initialization:initBlock + completion:completionBlock]; +``` + ### Making API Calls AppAuth gives you the raw token information, if you need it. However, we @@ -470,7 +589,7 @@ self.authState?.performAction() { (accessToken, idToken, error) in } ``` -### Custom User-Agents +### Custom User-Agents (iOS and macOS) Each OAuth flow involves presenting an external user-agent to the user, that allows them to interact with the OAuth authorization server. Typical examples @@ -522,7 +641,7 @@ Include the `EnterpriseUserAgent` subspec alongside any pods/subspecs you were a Make sure to import `AppAuthEnterpriseUserAgent.h` in addition to `AppAuth.h` if you are using the full `AppAuth` functionality. ##### Carthage -Use the `AppAuthEnterpriseUserAgent` Framework, which includes all the headers of the `AppAuth` framework. +Use the `AppAuthEnterpriseUserAgent` framework, which includes all the headers of the `AppAuth` framework. Make sure to import ``. This includes all the files included by AppAuth/AppAuthCore, so only this import is necessary. ##### Swift Package Manager @@ -616,4 +735,4 @@ Browse the [API documentation](http://openid.github.io/AppAuth-iOS/docs/latest/a ## Included Samples -Sample apps that explore core AppAuth features are available for iOS and macOS; follow the instructions in [Examples/README.md](Examples/README.md) to get started. +Sample apps that explore core AppAuth features are available for iOS, macOS and tvOS; follow the instructions in [Examples/README.md](Examples/README.md) to get started. From d17f5867fcd45220591d2fbb2b894b1fac5cbf63 Mon Sep 17 00:00:00 2001 From: Daniel Blakemore Date: Thu, 24 Jun 2021 10:39:50 -0700 Subject: [PATCH 28/81] Remove OIDTVTokenRequestTests from sources for AppAuth-iOS scheme. AppleTV test file was included in a source target which did not have XCTest dependencies and was causing builds to fail. --- AppAuth.xcodeproj/project.pbxproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/AppAuth.xcodeproj/project.pbxproj b/AppAuth.xcodeproj/project.pbxproj index 27449610b..6b0073603 100644 --- a/AppAuth.xcodeproj/project.pbxproj +++ b/AppAuth.xcodeproj/project.pbxproj @@ -158,7 +158,6 @@ 2DA8D82624C6190400FDFB34 /* OIDTVAuthorizationResponseTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DA8D82424C6190300FDFB34 /* OIDTVAuthorizationResponseTests.m */; }; 2DEB065624CA1D9300DF47E7 /* OIDTVTokenRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DEB065424CA1D9300DF47E7 /* OIDTVTokenRequest.h */; }; 2DEB065724CA1D9300DF47E7 /* OIDTVTokenRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DEB065524CA1D9300DF47E7 /* OIDTVTokenRequest.m */; }; - 2DEB066124CF5CE000DF47E7 /* OIDTVTokenRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DEB066024CF5CE000DF47E7 /* OIDTVTokenRequestTests.m */; }; 2DEB066224CF5CFB00DF47E7 /* OIDTVTokenRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DEB066024CF5CE000DF47E7 /* OIDTVTokenRequestTests.m */; }; 340DAE571D5821A100EC285B /* OIDAuthorizationService+Mac.m in Sources */ = {isa = PBXBuildFile; fileRef = 340DAE261D581FE700EC285B /* OIDAuthorizationService+Mac.m */; }; 340DAE581D5821A100EC285B /* OIDExternalUserAgentMac.m in Sources */ = {isa = PBXBuildFile; fileRef = 340DAE281D581FE700EC285B /* OIDExternalUserAgentMac.m */; }; @@ -2353,7 +2352,6 @@ 340DAECB1D582DE100EC285B /* OIDAuthorizationService+IOS.m in Sources */, 341741E31C5D8243000EF209 /* OIDResponseTypes.m in Sources */, 341741E41C5D8243000EF209 /* OIDScopes.m in Sources */, - 2DEB066124CF5CE000DF47E7 /* OIDTVTokenRequestTests.m in Sources */, 341741E71C5D8243000EF209 /* OIDServiceDiscovery.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; From cceee2552dfed90822875544da9c3af110dfa44c Mon Sep 17 00:00:00 2001 From: Peter Andrews Date: Tue, 30 Nov 2021 11:35:00 -0800 Subject: [PATCH 29/81] Get tests running again (#666) * Add GitHub Actions CI workflow. * Skip conformance tests until we migrate to new backend. --- .github/workflows/tests.yml | 21 +++++++++++++++++++++ UnitTests/OIDRPProfileCode.m | 3 +++ 2 files changed, 24 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 000000000..2279874a4 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,21 @@ +name: tests + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + + spm-build-test: + runs-on: macOS-latest + steps: + - uses: actions/checkout@v2 + - name: Build unit test target + run: swift build + - name: Run unit test target + run: swift test diff --git a/UnitTests/OIDRPProfileCode.m b/UnitTests/OIDRPProfileCode.m index 0bb61fe95..1c37b1f30 100644 --- a/UnitTests/OIDRPProfileCode.m +++ b/UnitTests/OIDRPProfileCode.m @@ -118,10 +118,12 @@ typedef void (^UserInfoCompletion)(OIDAuthState *_Nullable authState, @implementation OIDRPProfileCode - (void)setUp { + XCTSkip("Need to migrate to the new OpenID conformance testing system."); [super setUp]; } - (void)tearDown { + XCTSkip("Need to migrate to the new OpenID conformance testing system."); [super tearDown]; [self endCertificationTest]; @@ -264,6 +266,7 @@ - (void)codeFlowWithExchangeExpectSuccessForTest:(NSString *)test { } - (void)testRP_response_type_code { + XCTSkip("Not working at the moment."); NSString *testName = @"rp-response_type-code"; [self startCertificationTest:testName]; [self codeFlowWithExchangeExpectSuccessForTest:testName]; From fce32e889abe87f0f74f012d6270fb3b9d123b75 Mon Sep 17 00:00:00 2001 From: danblakemore Date: Tue, 30 Nov 2021 11:45:51 -0800 Subject: [PATCH 30/81] Update init unavailable doc on OIDServiceDiscovery (#640) Initially referred to a non-existent serviceDiscoveryWithURL:callback: method. --- Source/AppAuthCore/OIDServiceDiscovery.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/AppAuthCore/OIDServiceDiscovery.h b/Source/AppAuthCore/OIDServiceDiscovery.h index 3998fa12b..1a4929c53 100644 --- a/Source/AppAuthCore/OIDServiceDiscovery.h +++ b/Source/AppAuthCore/OIDServiceDiscovery.h @@ -326,7 +326,7 @@ NS_ASSUME_NONNULL_BEGIN /*! @internal @brief Unavailable. Please use @c initWithDictionary:error:, @c initWithJSON:error, or the - @c serviceDiscoveryWithURL:callback: factory method. + @c discoverServiceConfigurationForDiscoveryURL:callback: from @c OIDAuthorizationService. */ - (nonnull instancetype)init NS_UNAVAILABLE; From 73180f7b09e3468308c358a4299de7e8b946e624 Mon Sep 17 00:00:00 2001 From: Peter Andrews Date: Tue, 30 Nov 2021 11:47:37 -0800 Subject: [PATCH 31/81] Fix branch name --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2279874a4..cb8a13186 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,10 +3,10 @@ name: tests on: push: branches: - - main + - master pull_request: branches: - - main + - master workflow_dispatch: jobs: From 77f36f2c9410298b742247a7c4023a99c8c67ba9 Mon Sep 17 00:00:00 2001 From: danblakemore Date: Tue, 30 Nov 2021 11:50:30 -0800 Subject: [PATCH 32/81] Remove unmatched diagnostic pop (#641) There seems to be a hanging diagnostic pop that has no push which is causing Travis to fail. It's been in this file throughout the history of the repo with no matching push so I deleted it. --- UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.m | 2 -- 1 file changed, 2 deletions(-) diff --git a/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.m b/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.m index 555f6e177..a6d1bb2f5 100644 --- a/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.m +++ b/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.m @@ -281,5 +281,3 @@ - (void)testTokenPollRequestWithAdditionalParameters { } @end - -#pragma GCC diagnostic pop From 70ddc9704e52eace5df4955830549b88fc4d5850 Mon Sep 17 00:00:00 2001 From: dmaclach Date: Tue, 30 Nov 2021 12:30:20 -0800 Subject: [PATCH 33/81] Fix up type in designated initializer (#662) Move from OIDServiceDiscovery to NSURL --- Source/AppAuthCore/OIDServiceConfiguration.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/AppAuthCore/OIDServiceConfiguration.m b/Source/AppAuthCore/OIDServiceConfiguration.m index ca48a8c33..a5aa43e7a 100644 --- a/Source/AppAuthCore/OIDServiceConfiguration.m +++ b/Source/AppAuthCore/OIDServiceConfiguration.m @@ -72,7 +72,7 @@ - (instancetype)initWithAuthorizationEndpoint:(NSURL *)authorizationEndpoint tokenEndpoint:(NSURL *)tokenEndpoint issuer:(nullable NSURL *)issuer registrationEndpoint:(nullable NSURL *)registrationEndpoint - endSessionEndpoint:(nullable OIDServiceDiscovery *)endSessionEndpoint + endSessionEndpoint:(nullable NSURL *)endSessionEndpoint discoveryDocument:(nullable OIDServiceDiscovery *)discoveryDocument { self = [super init]; From fc4339451e9657b0b428f26c6b1d659d39e0903d Mon Sep 17 00:00:00 2001 From: pinlu Date: Wed, 2 Feb 2022 13:21:54 -0800 Subject: [PATCH 34/81] Use TARGET_OS_OSX for macOS rather than TARGET_OS_MAC (#681) --- Source/AppAuth.h | 2 +- Source/AppAuth/macOS/OIDExternalUserAgentMac.m | 2 +- Source/AppAuth/macOS/OIDRedirectHTTPHandler.m | 2 +- Source/Framework/AppAuth.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/AppAuth.h b/Source/AppAuth.h index 0b68463fb..a313a75ad 100644 --- a/Source/AppAuth.h +++ b/Source/AppAuth.h @@ -50,7 +50,7 @@ #import "OIDAuthorizationService+IOS.h" #import "OIDExternalUserAgentIOS.h" #import "OIDExternalUserAgentCatalyst.h" -#elif TARGET_OS_MAC +#elif TARGET_OS_OSX #import "OIDAuthState+Mac.h" #import "OIDAuthorizationService+Mac.h" #import "OIDExternalUserAgentMac.h" diff --git a/Source/AppAuth/macOS/OIDExternalUserAgentMac.m b/Source/AppAuth/macOS/OIDExternalUserAgentMac.m index c35a7a327..3409f5f5e 100644 --- a/Source/AppAuth/macOS/OIDExternalUserAgentMac.m +++ b/Source/AppAuth/macOS/OIDExternalUserAgentMac.m @@ -78,4 +78,4 @@ - (void)cleanUp { NS_ASSUME_NONNULL_END -#endif // TARGET_OS_MAC +#endif // TARGET_OS_OSX diff --git a/Source/AppAuth/macOS/OIDRedirectHTTPHandler.m b/Source/AppAuth/macOS/OIDRedirectHTTPHandler.m index 8a3df6cc2..3d0d765d8 100644 --- a/Source/AppAuth/macOS/OIDRedirectHTTPHandler.m +++ b/Source/AppAuth/macOS/OIDRedirectHTTPHandler.m @@ -174,4 +174,4 @@ - (void)dealloc { @end -#endif // TARGET_OS_MAC +#endif // TARGET_OS_OSX diff --git a/Source/Framework/AppAuth.h b/Source/Framework/AppAuth.h index d53ed1347..3139df37f 100644 --- a/Source/Framework/AppAuth.h +++ b/Source/Framework/AppAuth.h @@ -58,7 +58,7 @@ FOUNDATION_EXPORT const unsigned char AppAuthVersionString[]; #import #import #import "AppAuth/OIDExternalUserAgentCatalyst.h" -#elif TARGET_OS_MAC +#elif TARGET_OS_OSX #import #import #import From 9ae7c245694c38b24635c31689fb5063fa181686 Mon Sep 17 00:00:00 2001 From: pinlu Date: Mon, 14 Feb 2022 15:29:42 -0800 Subject: [PATCH 35/81] Add ASWebAuthenticationSession support in OIDExternalUserAgentMac. (#675) * Add ASWebAuthenticationSession support in OIDExternalUserAgentMac. * Incorporate OIDExternalUserAgentMac change in OIDState+Mac and modify the macOS example app. * Incorporate OIDExternalUserAgentMac change in OIDAuthorization+Mac and modify the macOS example app. * Clean APIs and add more API documentations. * Fix indentations in macOS example --- AppAuth.podspec | 3 +- .../Source/AppAuthExampleViewController.m | 22 ++--- Source/AppAuth/macOS/OIDAuthState+Mac.h | 17 ++++ Source/AppAuth/macOS/OIDAuthState+Mac.m | 10 +++ .../macOS/OIDAuthorizationService+Mac.h | 17 +++- .../macOS/OIDAuthorizationService+Mac.m | 9 +++ .../AppAuth/macOS/OIDExternalUserAgentMac.h | 8 ++ .../AppAuth/macOS/OIDExternalUserAgentMac.m | 80 ++++++++++++++++++- 8 files changed, 154 insertions(+), 12 deletions(-) diff --git a/AppAuth.podspec b/AppAuth.podspec index d4191ad79..5fc3cd71a 100644 --- a/AppAuth.podspec +++ b/AppAuth.podspec @@ -57,8 +57,9 @@ It follows the OAuth 2.0 for Native Apps best current practice externalUserAgent.ios.weak_frameworks = "AuthenticationServices" # macOS - externalUserAgent.osx.source_files = "Source/AppAuth/macOS/**/*.{h,m}" + externalUserAgent.osx.source_files = "Source/AppAuth/macOS/**/*.{h,m}" externalUserAgent.osx.deployment_target = '10.9' + externalUserAgent.osx.weak_frameworks = "AuthenticationServices" end s.subspec 'EnterpriseUserAgent' do |enterpriseUserAgent| diff --git a/Examples/Example-macOS/Source/AppAuthExampleViewController.m b/Examples/Example-macOS/Source/AppAuthExampleViewController.m index 0cc8064b5..38235cd17 100644 --- a/Examples/Example-macOS/Source/AppAuthExampleViewController.m +++ b/Examples/Example-macOS/Source/AppAuthExampleViewController.m @@ -214,8 +214,9 @@ - (IBAction)authWithAutoCodeExchange:(nullable id)sender { // performs authentication request self.appDelegate.currentAuthorizationFlow = [OIDAuthState authStateByPresentingAuthorizationRequest:request - callback:^(OIDAuthState *_Nullable authState, - NSError *_Nullable error) { + presentingWindow:self.view.window + callback:^(OIDAuthState *_Nullable authState, + NSError *_Nullable error) { if (authState) { [self setAuthState:authState]; [self logMessage:@"Got authorization tokens. Access token: %@", @@ -282,8 +283,8 @@ - (IBAction)authWithAutoCodeExchangeHTTP:(nullable id)sender { __weak __typeof(self) weakSelf = self; _redirectHTTPHandler.currentAuthorizationFlow = [OIDAuthState authStateByPresentingAuthorizationRequest:request - callback:^(OIDAuthState *_Nullable authState, - NSError *_Nullable error) { + presentingWindow:self.view.window + callback:^(OIDAuthState *_Nullable authState, NSError *_Nullable error) { // Brings this app to the foreground. [[NSRunningApplication currentApplication] activateWithOptions:(NSApplicationActivateAllWindows | @@ -329,11 +330,12 @@ - (IBAction)authNoCodeExchange:(nullable id)sender { additionalParameters:nil]; // performs authentication request [self logMessage:@"Initiating authorization request %@", request]; + self.appDelegate.currentAuthorizationFlow = [OIDAuthorizationService presentAuthorizationRequest:request - callback:^(OIDAuthorizationResponse *_Nullable authorizationResponse, - NSError *_Nullable error) { - + presentingWindow:self.view.window + callback:^(OIDAuthorizationResponse *_Nullable authorizationResponse, + NSError *_Nullable error) { if (authorizationResponse) { OIDAuthState *authState = [[OIDAuthState alloc] initWithAuthorizationResponse:authorizationResponse]; @@ -412,7 +414,7 @@ - (IBAction)userinfo:(nullable id)sender { [request addValue:authorizationHeaderValue forHTTPHeaderField:@"Authorization"]; NSURLSessionConfiguration *configuration = - [NSURLSessionConfiguration defaultSessionConfiguration]; + [NSURLSessionConfiguration defaultSessionConfiguration]; NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration delegate:nil delegateQueue:nil]; @@ -488,7 +490,9 @@ - (void)logMessage:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2) { NSString *dateString = [dateFormatter stringFromDate:[NSDate date]]; NSString *logLine = [NSString stringWithFormat:@"\n%@: %@", dateString, log]; NSAttributedString* logLineAttr = [[NSAttributedString alloc] initWithString:logLine]; - [[_logTextView textStorage] appendAttributedString:logLineAttr]; + dispatch_async(dispatch_get_main_queue(), ^{ + [[_logTextView textStorage] appendAttributedString:logLineAttr]; + }); } @end diff --git a/Source/AppAuth/macOS/OIDAuthState+Mac.h b/Source/AppAuth/macOS/OIDAuthState+Mac.h index f32d27c08..debde1318 100644 --- a/Source/AppAuth/macOS/OIDAuthState+Mac.h +++ b/Source/AppAuth/macOS/OIDAuthState+Mac.h @@ -20,6 +20,7 @@ #if TARGET_OS_OSX +#import #import "OIDAuthState.h" NS_ASSUME_NONNULL_BEGIN @@ -35,15 +36,31 @@ NS_ASSUME_NONNULL_BEGIN and update the OIDAuthState with the results (@c OIDAuthState.updateWithTokenResponse:error:). @param authorizationRequest The authorization request to present. + @param presentingWindow The window to present the authentication flow. @param callback The method called when the request has completed or failed. @return A @c OIDExternalUserAgentSession instance which will terminate when it receives a @c OIDExternalUserAgentSession.cancel message, or after processing a @c OIDExternalUserAgentSession.resumeExternalUserAgentFlowWithURL: message. + @discussion This method adopts ASWebAuthenticationSession for macOS 10.15 and above or the default browser otherwise. */ + (id) authStateByPresentingAuthorizationRequest:(OIDAuthorizationRequest *)authorizationRequest + presentingWindow:(NSWindow *)presentingWindow callback:(OIDAuthStateAuthorizationCallback)callback; +/*! @param authorizationRequest The authorization request to present. + @param callback The method called when the request has completed or failed. + @return A @c OIDExternalUserAgentSession instance which will terminate when it + receives a @c OIDExternalUserAgentSession.cancel message, or after processing a + @c OIDExternalUserAgentSession.resumeExternalUserAgentFlowWithURL: message. + @discussion This method uses the default browser to present the authentication flow. + */ ++ (id) + authStateByPresentingAuthorizationRequest:(OIDAuthorizationRequest *)authorizationRequest + callback:(OIDAuthStateAuthorizationCallback)callback + __deprecated_msg("For macOS 10.15 and above please use " + "authStateByPresentingAuthorizationRequest:presentingWindow:callback:"); + @end NS_ASSUME_NONNULL_END diff --git a/Source/AppAuth/macOS/OIDAuthState+Mac.m b/Source/AppAuth/macOS/OIDAuthState+Mac.m index 16b061724..2796223c1 100644 --- a/Source/AppAuth/macOS/OIDAuthState+Mac.m +++ b/Source/AppAuth/macOS/OIDAuthState+Mac.m @@ -26,6 +26,16 @@ @implementation OIDAuthState (Mac) ++ (id) + authStateByPresentingAuthorizationRequest:(OIDAuthorizationRequest *)authorizationRequest + presentingWindow:(NSWindow *)presentingWindow + callback:(OIDAuthStateAuthorizationCallback)callback { + OIDExternalUserAgentMac *externalUserAgent = [[OIDExternalUserAgentMac alloc] initWithPresentingWindow:presentingWindow]; + return [self authStateByPresentingAuthorizationRequest:authorizationRequest + externalUserAgent:externalUserAgent + callback:callback]; +} + + (id) authStateByPresentingAuthorizationRequest:(OIDAuthorizationRequest *)authorizationRequest callback:(OIDAuthStateAuthorizationCallback)callback { diff --git a/Source/AppAuth/macOS/OIDAuthorizationService+Mac.h b/Source/AppAuth/macOS/OIDAuthorizationService+Mac.h index 37de63f16..ec3c9c890 100644 --- a/Source/AppAuth/macOS/OIDAuthorizationService+Mac.h +++ b/Source/AppAuth/macOS/OIDAuthorizationService+Mac.h @@ -20,6 +20,7 @@ #if TARGET_OS_OSX +#import #import "OIDAuthorizationService.h" NS_ASSUME_NONNULL_BEGIN @@ -28,6 +29,19 @@ NS_ASSUME_NONNULL_BEGIN */ @interface OIDAuthorizationService (Mac) +/*! @brief Perform an authorization flow. + @param request The authorization request. + @param presentingWindow The window to present the authentication flow. + @param callback The method called when the request has completed or failed. + @return A @c OIDExternalUserAgentSession instance which will terminate when it + receives a @c OIDExternalUserAgentSession.cancel message, or after processing a + @c OIDExternalUserAgentSession.resumeExternalUserAgentFlowWithURL: message. + @discussion This method adopts ASWebAuthenticationSession for macOS 10.15 and above or the default browser otherwise. + */ ++ (id) presentAuthorizationRequest:(OIDAuthorizationRequest *)request + presentingWindow:(NSWindow *)presentingWindow + callback:(OIDAuthorizationCallback)callback; + /*! @brief Perform an authorization flow using the default browser. @param request The authorization request. @param callback The method called when the request has completed or failed. @@ -36,7 +50,8 @@ NS_ASSUME_NONNULL_BEGIN @c OIDExternalUserAgentSession.resumeExternalUserAgentFlowWithURL: message. */ + (id)presentAuthorizationRequest:(OIDAuthorizationRequest *)request - callback:(OIDAuthorizationCallback)callback; + callback:(OIDAuthorizationCallback)callback + __deprecated_msg("For macOS 10.15 and above please use presentAuthorizationRequest:presentingWindow:callback:"); @end diff --git a/Source/AppAuth/macOS/OIDAuthorizationService+Mac.m b/Source/AppAuth/macOS/OIDAuthorizationService+Mac.m index c0abec8a4..af93186f9 100644 --- a/Source/AppAuth/macOS/OIDAuthorizationService+Mac.m +++ b/Source/AppAuth/macOS/OIDAuthorizationService+Mac.m @@ -28,6 +28,15 @@ @implementation OIDAuthorizationService (Mac) ++ (id) presentAuthorizationRequest:(OIDAuthorizationRequest *)request + presentingWindow:(NSWindow *)presentingWindow + callback:(OIDAuthorizationCallback)callback { + OIDExternalUserAgentMac *externalUserAgent = [[OIDExternalUserAgentMac alloc] initWithPresentingWindow:presentingWindow]; + return [self presentAuthorizationRequest:request + externalUserAgent:externalUserAgent + callback:callback]; +} + + (id) presentAuthorizationRequest:(OIDAuthorizationRequest *)request callback:(OIDAuthorizationCallback)callback { OIDExternalUserAgentMac *externalUserAgent = [[OIDExternalUserAgentMac alloc] init]; diff --git a/Source/AppAuth/macOS/OIDExternalUserAgentMac.h b/Source/AppAuth/macOS/OIDExternalUserAgentMac.h index b7122aee0..cb864e1cc 100644 --- a/Source/AppAuth/macOS/OIDExternalUserAgentMac.h +++ b/Source/AppAuth/macOS/OIDExternalUserAgentMac.h @@ -20,6 +20,7 @@ #if TARGET_OS_OSX +#import #import "OIDExternalUserAgent.h" NS_ASSUME_NONNULL_BEGIN @@ -29,6 +30,13 @@ NS_ASSUME_NONNULL_BEGIN */ @interface OIDExternalUserAgentMac : NSObject +/*! @brief The designated initializer. + @param presentingWindow The window from which to present the ASWebAuthenticationSession. + */ +- (instancetype)initWithPresentingWindow:(NSWindow *)presentingWindow NS_DESIGNATED_INITIALIZER; + +- (instancetype)init __deprecated_msg("Use initWithPresentingWindow for macOS 10.15 and above."); + @end NS_ASSUME_NONNULL_END diff --git a/Source/AppAuth/macOS/OIDExternalUserAgentMac.m b/Source/AppAuth/macOS/OIDExternalUserAgentMac.m index 3409f5f5e..301a24af7 100644 --- a/Source/AppAuth/macOS/OIDExternalUserAgentMac.m +++ b/Source/AppAuth/macOS/OIDExternalUserAgentMac.m @@ -27,12 +27,38 @@ #import "OIDErrorUtilities.h" #import "OIDExternalUserAgentSession.h" #import "OIDExternalUserAgentRequest.h" +#import + NS_ASSUME_NONNULL_BEGIN +@interface OIDExternalUserAgentMac () +@end + @implementation OIDExternalUserAgentMac { BOOL _externalUserAgentFlowInProgress; __weak id _session; + + NSWindow *_presentingWindow; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpartial-availability" + ASWebAuthenticationSession *_webAuthenticationSession; +#pragma clang diagnostic pop +} + +- (instancetype)initWithPresentingWindow:(NSWindow *)presentingWindow { + self = [super init]; + if (self) { + _presentingWindow = presentingWindow; + } + return self; +} + +- (instancetype)init { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnonnull" + return [self initWithPresentingWindow:nil]; +#pragma clang diagnostic pop } - (BOOL)presentExternalUserAgentRequest:(id)request @@ -46,6 +72,38 @@ - (BOOL)presentExternalUserAgentRequest:(id)request _session = session; NSURL *requestURL = [request externalUserAgentRequestURL]; + if (@available(macOS 10.15, *)) { + if (_presentingWindow) { + __weak OIDExternalUserAgentMac *weakSelf = self; + NSString *redirectScheme = request.redirectScheme; + ASWebAuthenticationSession *authenticationSession = + [[ASWebAuthenticationSession alloc] initWithURL:requestURL + callbackURLScheme:redirectScheme + completionHandler:^(NSURL * _Nullable callbackURL, + NSError * _Nullable error) { + __strong OIDExternalUserAgentMac *strongSelf = weakSelf; + if (!strongSelf) { + return; + } + strongSelf->_webAuthenticationSession = nil; + if (callbackURL) { + [strongSelf->_session resumeExternalUserAgentFlowWithURL:callbackURL]; + } else { + NSError *safariError = + [OIDErrorUtilities errorWithCode:OIDErrorCodeUserCanceledAuthorizationFlow + underlyingError:error + description:nil]; + [strongSelf->_session failExternalUserAgentFlowWithError:safariError]; + } + }]; + + authenticationSession.presentationContextProvider = self; + + _webAuthenticationSession = authenticationSession; + return [authenticationSession start]; + } + } + BOOL openedBrowser = [[NSWorkspace sharedWorkspace] openURL:requestURL]; if (!openedBrowser) { [self cleanUp]; @@ -63,15 +121,35 @@ - (void)dismissExternalUserAgentAnimated:(BOOL)animated completion:(void (^)(voi if (completion) completion(); return; } + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpartial-availability" + ASWebAuthenticationSession *webAuthenticationSession = _webAuthenticationSession; +#pragma clang diagnostic pop + // Ideally the browser tab with the URL should be closed here, but the AppAuth library does not // control the browser. [self cleanUp]; - if (completion) completion(); + if (webAuthenticationSession) { + // dismiss the ASWebAuthenticationSession + [webAuthenticationSession cancel]; + if (completion) completion(); + } else if (completion) { + completion(); + } } - (void)cleanUp { _session = nil; _externalUserAgentFlowInProgress = NO; + _webAuthenticationSession = nil; +} + +#pragma mark - ASWebAuthenticationPresentationContextProviding + +- (ASPresentationAnchor)presentationAnchorForWebAuthenticationSession:(ASWebAuthenticationSession *)session + API_AVAILABLE(macosx(10.15)) { + return _presentingWindow; } @end From ddaa0ced4d8a74ed047cbecf4552384e113d28c0 Mon Sep 17 00:00:00 2001 From: William Denniss Date: Fri, 4 Mar 2022 15:19:17 -0800 Subject: [PATCH 36/81] Document the design principles behind AppAuth Originally drafted June 1, 2018. --- DESIGN.md | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 DESIGN.md diff --git a/DESIGN.md b/DESIGN.md new file mode 100644 index 000000000..ac2dcb87b --- /dev/null +++ b/DESIGN.md @@ -0,0 +1,120 @@ +# AppAuth Project Design Principles + +## About this Doc + +The goal of this doc is to define a scope for AppAuth that we can reference when rejecting or +accepting feature requests, and give clarity to extension creators for what features should be +developed outside of the core project. + +## What is AppAuth + +### OAuth and OpenID Connect standards that support native apps + +The goal of AppAuth is to provide a client library that follows best current practices for native +apps to use the OAuth and OpenID Connect authorization and authentication standards. We aim to +implement standards that are designed for, or work well with native apps and are in common use (and +will implement just those components of these standards that are commonly used). + +These standards are currently supported: +1. [OAuth 2.0](https://tools.ietf.org/html/rfc67490) +2. [Proof Key for Code Exchange by OAuth Public Clients (PKCE)](https://tools.ietf.org/html/rfc7636) +3. [OAuth 2.0 for Native Apps](https://tools.ietf.org/html/rfc8252) +4. [OpenID Connect Core 1.0](http://openid.net/specs/openid-connect-core-1_0.html) +5. [Open ID Connect Discovery 1.0](https://openid.net/specs/openid-connect-discovery-1_0.html) +6. [OpenID Connect Dynamic Client Registration 1.0](https://openid.net/specs/openid-connect-registration-1_0.html) + +Support for the following standards is also considered in-scope (see the below section on +prioritization): +1. [OAuth 2.0 Incremental Auth](https://tools.ietf.org/html/draft-ietf-oauth-incremental-auth) +2. [OAuth 2.0 Device Flow for Browserless and Input Constrained Devices](https://tools.ietf.org/html/rfc8628) +3. [OpenID Connect Front-Channel Logout 1.0](http://openid.net/specs/openid-connect-frontchannel-1_0.html) + +### Design Principle + +AppAuth aims to present as close to a 1:1 mapping of the spec as is possible, while following +language-specific idioms (like parameter capitalization). It performs some of the heavy lifting for +you so you don’t need to implement the spec yourself, but it does not hide the complexity of the +underlying specs. + +Providers who want extremely simple user-friendly libraries aimed at developers who know nothing +about authorization and authentication standards are encouraged to wrap AppAuth in their own +purpose-built libraries. + +### Extensibility + +AppAuth aims to be as extensible as possible. Just as you can extend OAuth by adding parameters to a +URL (for example), the same should be possible in AppAuth. + +This helps reduce the surface area of the library, as not everything needs to be hardcoded in as a +first-class citizen. + +## What is out-of-scope for AppAuth + +### Non-best-practice patterns + +AppAuth is a best-practice library, it’s why we built it. We will not support things like embedded +WebViews, that are not considered a best practice. Please don’t ask. + +### Implementing *every* spec parameter or branch + +AppAuth exposes some required and popular parameters directly in its data model. It is a non-goal to +offer this support for every single parameter in the specifications. Less popular parameters, or +ones that simply don’t need special handling can be passed using the “additionalParameters” dictionary. + +Likewise, some specifications document several different sub-protocols. We don’t aim to implement +every single branch of the spec. + +### Non-standard protocols and parameters + +Non-standard protocols and parameters are not supported by AppAuth. However, AppAuth, like the +specs it implements, is largely extensible and you may be able to achieve what you need through +these extension points. For example, simple additional parameters can be passed in the +“additionalParameters” dictionary, and the TokenRequest can support other grant types. + +By way of example, the tvOS device flow support (which may actually be considered in-scope one day) +was initially implemented on top of these extension points without needing to change AppAuth. + +### Provider-specific workarounds, hacks or features + +AppAuth implements the pure authentication and authorization standards. Where these standards are +clear in their meaning, errors in provider implementations are not supported or worked around by +AppAuth. + +Identity standards are well specified, and typically undergo years of review, including security +review before publication. If we accept every provider-specific idiosyncrasy then we are changing +the surface area in ways that are harder to maintain, and are less researched from a security +perspective. There is generally no reason providers can’t offer correct standards-based +implementations, so this is what we expect. + +When all providers follow the standards correctly, interoperability is improved for everyone. The +OpenID Connect foundation has been particularly active in supporting certification efforts to verify +implementations, and the test suits for these are available at no charge. + +If the spec itself has a bug that cannot be worked around, then changes should be proposed through +the IETF and/or OpenID Foundation channels. AppAuth may implement such proposals, even while they +are in the early stages, if they are well received. + +### Provider-specific examples + +As AppAuth is pure standards-based, there is no need for provider-specific samples. Instead, we +encourage providers who have proved their compliance with the relevant standards to provide a +customized readme so their users can configure their own samples. + +We also encourage providers to host their own AppAuth samples, in their own repositories. + +## A word on feature requests + +### Priorities + +Just because something is in-scope, does not mean that the maintainers of AppAuth will add support +for it, or rapidly integrate pull requests. + +The priority of AppAuth is stability and quality, not rapidly integrating feature requests. Pull +requests are thoroughly reviewed for style, the quality of the API, and future maintainability. + +### Review Time + +Expect review periods of 6 months to a year for integrating major new in-scope features. Our +priority as previously stated is stability and quality, not adding features as quickly as possible. +While you work with us to integrate your feature, we highly encourage you to maintain your own fork +so you and others can use the feature immediately – and gain valuable implementation experience. From de08e7847ec9bbc064eda107399d20b423c0e076 Mon Sep 17 00:00:00 2001 From: Peter Andrews Date: Wed, 16 Mar 2022 10:06:47 -0700 Subject: [PATCH 37/81] Set min iOS version to 9 for SPM (#690) --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 563bdfdde..55bf7dfb8 100644 --- a/Package.swift +++ b/Package.swift @@ -24,7 +24,7 @@ let package = Package( name: "AppAuth", platforms: [ .macOS(.v10_10), - .iOS(.v8), + .iOS(.v9), .tvOS(.v9), .watchOS(.v2) ], From cd55670ca44c707aa0110faee2af123d507cdeca Mon Sep 17 00:00:00 2001 From: Peter Andrews Date: Thu, 17 Mar 2022 21:41:03 -0700 Subject: [PATCH 38/81] Update tests badge. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 051223462..7651dbe9d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ![AppAuth for iOS and macOS](https://rawgit.com/openid/AppAuth-iOS/master/appauth_lockup.svg) -[![Build Status](https://travis-ci.org/openid/AppAuth-iOS.svg?branch=master)](https://travis-ci.org/openid/AppAuth-iOS) +[![tests](https://github.com/openid/AppAuth-iOS/actions/workflows/tests.yml/badge.svg?event=push)](https://github.com/openid/AppAuth-iOS/actions/workflows/tests.yml) [![codecov](https://codecov.io/gh/openid/AppAuth-iOS/branch/master/graph/badge.svg)](https://codecov.io/gh/openid/AppAuth-iOS) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-brightgreen.svg?style=flat)](https://github.com/Carthage/Carthage) [![SwiftPM compatible](https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg?style=flat)](https://swift.org/package-manager) From 63996b0c77e981b3632a3c6408e6ad41cdec8488 Mon Sep 17 00:00:00 2001 From: Peter Andrews Date: Fri, 18 Mar 2022 00:38:13 -0700 Subject: [PATCH 39/81] Reenable Codecov. --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cb8a13186..c97998169 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,3 +19,5 @@ jobs: run: swift build - name: Run unit test target run: swift test + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v2 From 5198a96e7e5bcb07d02f7dd49a4d802257b83cca Mon Sep 17 00:00:00 2001 From: Peter Andrews Date: Fri, 18 Mar 2022 01:05:42 -0700 Subject: [PATCH 40/81] Have swift test generate code coverage. --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c97998169..2658cd290 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,6 +18,6 @@ jobs: - name: Build unit test target run: swift build - name: Run unit test target - run: swift test + run: swift test --enable-code-coverage - name: Upload coverage to Codecov uses: codecov/codecov-action@v2 From 4faf43645b8f8725485750799bfd478c72fa32ec Mon Sep 17 00:00:00 2001 From: Peter Andrews Date: Fri, 18 Mar 2022 09:44:13 -0700 Subject: [PATCH 41/81] Run pod lib lint tests (#695) * Add Bundler config for pod on Actions. * Add pod lib lint tests. --- .github/workflows/tests.yml | 18 +++++++ Gemfile | 3 ++ Gemfile.lock | 97 +++++++++++++++++++++++++++++++++++++ 3 files changed, 118 insertions(+) create mode 100644 Gemfile create mode 100644 Gemfile.lock diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2658cd290..66771e146 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,6 +11,24 @@ on: jobs: + pod-lib-lint: + runs-on: macOS-latest + strategy: + matrix: + flags: [ + '', + '--use-libraries', + '--use-static-frameworks' + ] + steps: + - uses: actions/checkout@v2 + - name: Update Bundler + run: bundle update --bundler + - name: Install Ruby gems with Bundler + run: bundle install + - name: Lint podspec using local source + run: pod lib lint --verbose ${{ matrix.flags }} + spm-build-test: runs-on: macOS-latest steps: diff --git a/Gemfile b/Gemfile new file mode 100644 index 000000000..4e9ba5251 --- /dev/null +++ b/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'cocoapods', '1.11.3' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 000000000..2f9cb67a2 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,97 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.5) + rexml + activesupport (6.1.5) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) + addressable (2.8.0) + public_suffix (>= 2.0.2, < 5.0) + algoliasearch (1.27.5) + httpclient (~> 2.8, >= 2.8.3) + json (>= 1.5.1) + atomos (0.1.3) + claide (1.1.0) + cocoapods (1.11.3) + addressable (~> 2.8) + claide (>= 1.0.2, < 2.0) + cocoapods-core (= 1.11.3) + cocoapods-deintegrate (>= 1.0.3, < 2.0) + cocoapods-downloader (>= 1.4.0, < 2.0) + cocoapods-plugins (>= 1.0.0, < 2.0) + cocoapods-search (>= 1.0.0, < 2.0) + cocoapods-trunk (>= 1.4.0, < 2.0) + cocoapods-try (>= 1.1.0, < 2.0) + colored2 (~> 3.1) + escape (~> 0.0.4) + fourflusher (>= 2.3.0, < 3.0) + gh_inspector (~> 1.0) + molinillo (~> 0.8.0) + nap (~> 1.0) + ruby-macho (>= 1.0, < 3.0) + xcodeproj (>= 1.21.0, < 2.0) + cocoapods-core (1.11.3) + activesupport (>= 5.0, < 7) + addressable (~> 2.8) + algoliasearch (~> 1.0) + concurrent-ruby (~> 1.1) + fuzzy_match (~> 2.0.4) + nap (~> 1.0) + netrc (~> 0.11) + public_suffix (~> 4.0) + typhoeus (~> 1.0) + cocoapods-deintegrate (1.0.5) + cocoapods-downloader (1.5.1) + cocoapods-plugins (1.0.0) + nap + cocoapods-search (1.0.1) + cocoapods-trunk (1.6.0) + nap (>= 0.8, < 2.0) + netrc (~> 0.11) + cocoapods-try (1.2.0) + colored2 (3.1.2) + concurrent-ruby (1.1.9) + escape (0.0.4) + ethon (0.15.0) + ffi (>= 1.15.0) + ffi (1.15.5) + fourflusher (2.3.1) + fuzzy_match (2.0.4) + gh_inspector (1.1.3) + httpclient (2.8.3) + i18n (1.10.0) + concurrent-ruby (~> 1.0) + json (2.6.1) + minitest (5.15.0) + molinillo (0.8.0) + nanaimo (0.3.0) + nap (1.1.0) + netrc (0.11.0) + public_suffix (4.0.6) + rexml (3.2.5) + ruby-macho (2.5.1) + typhoeus (1.4.0) + ethon (>= 0.9.0) + tzinfo (2.0.4) + concurrent-ruby (~> 1.0) + xcodeproj (1.21.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.3.0) + rexml (~> 3.2.4) + zeitwerk (2.5.4) + +PLATFORMS + ruby + +DEPENDENCIES + cocoapods (= 1.11.3) + +BUNDLED WITH + 1.17.2 From ac3e1e06bbbdf089e01449e1398c4bcbe9348283 Mon Sep 17 00:00:00 2001 From: Peter Andrews Date: Fri, 18 Mar 2022 10:30:27 -0700 Subject: [PATCH 42/81] Run tests against the Xcode project (#696) * Update tests.yml * Use macosx12.1 sdk. * Use latest simulator SDK versions. --- .github/workflows/tests.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 66771e146..166a260f7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,6 +11,26 @@ on: jobs: + xcode-project-test: + runs-on: macOS-latest + strategy: + matrix: + flags: [ + "-scheme AppAuth-iOS -destination 'platform=iOS Simulator,name=iPhone 11,OS=15.2' -sdk 'iphonesimulator15.2'", + "-scheme AppAuth-macOS -destination 'platform=macOS,arch=x86_64' -sdk 'macosx12.1'", + "-scheme AppAuth_macOS -destination 'platform=macOS,arch=x86_64' -sdk 'macosx12.1'", + "-scheme AppAuth-tvOS -destination 'platform=tvOS Simulator,name=Apple TV,OS=15.2' -sdk 'appletvsimulator15.2'", + "-scheme AppAuth_tvOS -destination 'platform=tvOS Simulator,name=Apple TV,OS=15.2' -sdk 'appletvsimulator15.2'", + "-scheme AppAuthTV -destination 'platform=tvOS Simulator,name=Apple TV,OS=15.2' -sdk 'appletvsimulator15.2'" + ] + steps: + - uses: actions/checkout@v2 + - name: Run unit test targets + run: | + xcodebuild test \ + -project AppAuth.xcodeproj \ + ${{ matrix.flags }} + pod-lib-lint: runs-on: macOS-latest strategy: From 6f48321e04ca3ad6417717246f085dc73d307369 Mon Sep 17 00:00:00 2001 From: Peter Andrews Date: Fri, 18 Mar 2022 11:07:21 -0700 Subject: [PATCH 43/81] Rollback the EnterpriseUserAgent target. (#693) --- AppAuth.podspec | 7 - AppAuth.xcodeproj/project.pbxproj | 264 +----------------- .../AppAuthEnterpriseUserAgent.xcscheme | 67 ----- Package.swift | 13 - README.md | 21 -- Source/AppAuth.h | 1 + .../OIDExternalUserAgentIOSCustomBrowser.h | 0 .../OIDExternalUserAgentIOSCustomBrowser.m | 0 Source/AppAuthEnterpriseUserAgent.h | 21 -- .../AppAuthEnterpriseUserAgent.h | 59 ---- .../EnterpriseUserAgentFramework/Info.plist | 26 -- Source/Framework/AppAuth.h | 1 + 12 files changed, 16 insertions(+), 464 deletions(-) delete mode 100644 AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuthEnterpriseUserAgent.xcscheme rename Source/{AppAuthEnterpriseUserAgent => AppAuth}/iOS/OIDExternalUserAgentIOSCustomBrowser.h (100%) rename Source/{AppAuthEnterpriseUserAgent => AppAuth}/iOS/OIDExternalUserAgentIOSCustomBrowser.m (100%) delete mode 100644 Source/AppAuthEnterpriseUserAgent.h delete mode 100644 Source/EnterpriseUserAgentFramework/AppAuthEnterpriseUserAgent.h delete mode 100644 Source/EnterpriseUserAgentFramework/Info.plist diff --git a/AppAuth.podspec b/AppAuth.podspec index 5fc3cd71a..40470c7b7 100644 --- a/AppAuth.podspec +++ b/AppAuth.podspec @@ -62,13 +62,6 @@ It follows the OAuth 2.0 for Native Apps best current practice externalUserAgent.osx.weak_frameworks = "AuthenticationServices" end - s.subspec 'EnterpriseUserAgent' do |enterpriseUserAgent| - enterpriseUserAgent.dependency 'AppAuth/Core' - - enterpriseUserAgent.ios.source_files = "Source/AppAuthEnterpriseUserAgent.h", "Source/AppAuthEnterpriseUserAgent/iOS/**/*.{h,m}" - enterpriseUserAgent.ios.deployment_target = "7.0" - end - # Subspec for the full AppAuth library, including platform-dependant external user agents. s.subspec 'TV' do |tv| tv.source_files = "Source/AppAuthTV.h", "Source/AppAuthTV/*.{h,m}" diff --git a/AppAuth.xcodeproj/project.pbxproj b/AppAuth.xcodeproj/project.pbxproj index 6b0073603..2f4dcaaf5 100644 --- a/AppAuth.xcodeproj/project.pbxproj +++ b/AppAuth.xcodeproj/project.pbxproj @@ -13,7 +13,6 @@ 06C19E9B22B474A200C19CE1 /* OIDEndSessionResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = CF6431F31F228A980075B6B5 /* OIDEndSessionResponse.m */; }; 06C19E9C22B474A600C19CE1 /* OIDEndSessionRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = CF37C06B1F1FC21A00662E41 /* OIDEndSessionRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; 06C19E9D22B474AD00C19CE1 /* OIDEndSessionRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = CF37C06C1F1FC21A00662E41 /* OIDEndSessionRequest.m */; }; - 2D0BB86C249D5BAF005BA653 /* AppAuthEnterpriseUserAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D0BB86B249D5BAF005BA653 /* AppAuthEnterpriseUserAgent.h */; settings = {ATTRIBUTES = (Public, ); }; }; 2D47AAE1249A87020059B5A4 /* OIDTVAuthorizationResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D47AAD8249A87010059B5A4 /* OIDTVAuthorizationResponse.m */; }; 2D47AAE4249A87020059B5A4 /* OIDTVServiceConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D47AADA249A87010059B5A4 /* OIDTVServiceConfiguration.m */; }; 2D47AAE8249A87020059B5A4 /* OIDTVAuthorizationRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D47AADD249A87010059B5A4 /* OIDTVAuthorizationRequest.m */; }; @@ -36,66 +35,6 @@ 2D81121424C103F300984DA7 /* OIDRegistrationRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 60140F821DE43BAF00DA0DC3 /* OIDRegistrationRequestTests.m */; }; 2D81121524C103F300984DA7 /* OIDRegistrationResponseTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 60140F851DE43CC700DA0DC3 /* OIDRegistrationResponseTests.m */; }; 2D81121624C103F300984DA7 /* OIDRPProfileCode.m in Sources */ = {isa = PBXBuildFile; fileRef = 34A6638A1E8865090060B664 /* OIDRPProfileCode.m */; }; - 2D91B81F249053190005B197 /* OIDExternalUserAgentIOS.m in Sources */ = {isa = PBXBuildFile; fileRef = A6DEABA82018E5B50022AC32 /* OIDExternalUserAgentIOS.m */; }; - 2D91B820249053190005B197 /* OIDExternalUserAgentCatalyst.m in Sources */ = {isa = PBXBuildFile; fileRef = F9A7082D2355ED74004B3E6D /* OIDExternalUserAgentCatalyst.m */; }; - 2D91B821249053190005B197 /* OIDFieldMapping.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741C41C5D8243000EF209 /* OIDFieldMapping.m */; }; - 2D91B822249053190005B197 /* OIDIDToken.m in Sources */ = {isa = PBXBuildFile; fileRef = 34A663271E871DD40060B664 /* OIDIDToken.m */; }; - 2D91B823249053190005B197 /* OIDEndSessionResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = CF6431F31F228A980075B6B5 /* OIDEndSessionResponse.m */; }; - 2D91B824249053190005B197 /* OIDAuthState.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741BB1C5D8243000EF209 /* OIDAuthState.m */; }; - 2D91B825249053190005B197 /* OIDAuthState+IOS.m in Sources */ = {isa = PBXBuildFile; fileRef = F6F60FB01D2BFEFE00325CB3 /* OIDAuthState+IOS.m */; }; - 2D91B826249053190005B197 /* OIDTokenResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741D41C5D8243000EF209 /* OIDTokenResponse.m */; }; - 2D91B827249053190005B197 /* OIDErrorUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741C21C5D8243000EF209 /* OIDErrorUtilities.m */; }; - 2D91B828249053190005B197 /* OIDURLQueryComponent.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741D81C5D8243000EF209 /* OIDURLQueryComponent.m */; }; - 2D91B829249053190005B197 /* OIDAuthorizationRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741B51C5D8243000EF209 /* OIDAuthorizationRequest.m */; }; - 2D91B82A249053190005B197 /* OIDAuthorizationService.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741B91C5D8243000EF209 /* OIDAuthorizationService.m */; }; - 2D91B82B249053190005B197 /* OIDClientMetadataParameters.m in Sources */ = {isa = PBXBuildFile; fileRef = 60140F791DE4276800DA0DC3 /* OIDClientMetadataParameters.m */; }; - 2D91B82C249053190005B197 /* OIDTokenUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741D61C5D8243000EF209 /* OIDTokenUtilities.m */; }; - 2D91B82D249053190005B197 /* OIDServiceDiscovery.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741D01C5D8243000EF209 /* OIDServiceDiscovery.m */; }; - 2D91B82E249053190005B197 /* OIDTokenRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741D21C5D8243000EF209 /* OIDTokenRequest.m */; }; - 2D91B82F249053190005B197 /* OIDExternalUserAgentIOSCustomBrowser.m in Sources */ = {isa = PBXBuildFile; fileRef = 345AE745202D526800738D22 /* OIDExternalUserAgentIOSCustomBrowser.m */; }; - 2D91B830249053190005B197 /* OIDEndSessionRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = CF37C06C1F1FC21A00662E41 /* OIDEndSessionRequest.m */; }; - 2D91B831249053190005B197 /* OIDAuthorizationService+IOS.m in Sources */ = {isa = PBXBuildFile; fileRef = F6F60FB11D2BFEFE00325CB3 /* OIDAuthorizationService+IOS.m */; }; - 2D91B832249053190005B197 /* OIDServiceConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741CE1C5D8243000EF209 /* OIDServiceConfiguration.m */; }; - 2D91B833249053190005B197 /* OIDRegistrationResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 60140F7F1DE4344200DA0DC3 /* OIDRegistrationResponse.m */; }; - 2D91B834249053190005B197 /* OIDURLSessionProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 039697451FA8258D003D1FB2 /* OIDURLSessionProvider.m */; }; - 2D91B835249053190005B197 /* OIDScopes.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741CA1C5D8243000EF209 /* OIDScopes.m */; }; - 2D91B836249053190005B197 /* OIDScopeUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741CC1C5D8243000EF209 /* OIDScopeUtilities.m */; }; - 2D91B837249053190005B197 /* OIDGrantTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741C61C5D8243000EF209 /* OIDGrantTypes.m */; }; - 2D91B838249053190005B197 /* OIDRegistrationRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 60140F7B1DE42E1000DA0DC3 /* OIDRegistrationRequest.m */; }; - 2D91B839249053190005B197 /* OIDResponseTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741C81C5D8243000EF209 /* OIDResponseTypes.m */; }; - 2D91B83A249053190005B197 /* OIDAuthorizationResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741B71C5D8243000EF209 /* OIDAuthorizationResponse.m */; }; - 2D91B83B249053190005B197 /* OIDError.m in Sources */ = {isa = PBXBuildFile; fileRef = 341741C01C5D8243000EF209 /* OIDError.m */; }; - 2D91B83E249053190005B197 /* OIDAuthorizationResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741B61C5D8243000EF209 /* OIDAuthorizationResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B83F249053190005B197 /* OIDScopes.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741C91C5D8243000EF209 /* OIDScopes.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B840249053190005B197 /* OIDExternalUserAgentRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = A6DEAB9A2018E4A20022AC32 /* OIDExternalUserAgentRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B841249053190005B197 /* OIDAuthStateChangeDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741BC1C5D8243000EF209 /* OIDAuthStateChangeDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B842249053190005B197 /* OIDExternalUserAgentIOSCustomBrowser.h in Headers */ = {isa = PBXBuildFile; fileRef = 345AE746202D526800738D22 /* OIDExternalUserAgentIOSCustomBrowser.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B844249053190005B197 /* OIDExternalUserAgentCatalyst.h in Headers */ = {isa = PBXBuildFile; fileRef = F9A7082C2355ED74004B3E6D /* OIDExternalUserAgentCatalyst.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B845249053190005B197 /* OIDIDToken.h in Headers */ = {isa = PBXBuildFile; fileRef = 34A663261E871DD40060B664 /* OIDIDToken.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B846249053190005B197 /* OIDResponseTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741C71C5D8243000EF209 /* OIDResponseTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B847249053190005B197 /* OIDTokenRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741D11C5D8243000EF209 /* OIDTokenRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B848249053190005B197 /* OIDScopeUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741CB1C5D8243000EF209 /* OIDScopeUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B849249053190005B197 /* OIDTokenResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741D31C5D8243000EF209 /* OIDTokenResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B84A249053190005B197 /* OIDEndSessionResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = CF6431F21F228A980075B6B5 /* OIDEndSessionResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B84B249053190005B197 /* OIDServiceDiscovery.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741CF1C5D8243000EF209 /* OIDServiceDiscovery.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B84C249053190005B197 /* OIDGrantTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741C51C5D8243000EF209 /* OIDGrantTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B84D249053190005B197 /* OIDURLSessionProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 039697441FA8258D003D1FB2 /* OIDURLSessionProvider.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B84E249053190005B197 /* OIDAuthState+IOS.h in Headers */ = {isa = PBXBuildFile; fileRef = F6F60FB51D2BFEFE00325CB3 /* OIDAuthState+IOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B84F249053190005B197 /* OIDRegistrationResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 60140F7E1DE4335200DA0DC3 /* OIDRegistrationResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B850249053190005B197 /* OIDExternalUserAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = A6DEAB982018E4A20022AC32 /* OIDExternalUserAgent.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B851249053190005B197 /* OIDExternalUserAgentSession.h in Headers */ = {isa = PBXBuildFile; fileRef = A6DEAB992018E4A20022AC32 /* OIDExternalUserAgentSession.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B852249053190005B197 /* OIDServiceConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741CD1C5D8243000EF209 /* OIDServiceConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B853249053190005B197 /* OIDAuthStateErrorDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741BD1C5D8243000EF209 /* OIDAuthStateErrorDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B854249053190005B197 /* OIDAuthorizationService.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741B81C5D8243000EF209 /* OIDAuthorizationService.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B855249053190005B197 /* OIDRegistrationRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 60140F7D1DE42E3000DA0DC3 /* OIDRegistrationRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B856249053190005B197 /* OIDEndSessionRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = CF37C06B1F1FC21A00662E41 /* OIDEndSessionRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B857249053190005B197 /* OIDAuthState.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741BA1C5D8243000EF209 /* OIDAuthState.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B858249053190005B197 /* OIDErrorUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741C11C5D8243000EF209 /* OIDErrorUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B859249053190005B197 /* OIDAuthorizationService+IOS.h in Headers */ = {isa = PBXBuildFile; fileRef = F6F60FB31D2BFEFE00325CB3 /* OIDAuthorizationService+IOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B85A249053190005B197 /* OIDAuthorizationRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741B41C5D8243000EF209 /* OIDAuthorizationRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B85B249053190005B197 /* OIDTokenUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741D51C5D8243000EF209 /* OIDTokenUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B85C249053190005B197 /* OIDError.h in Headers */ = {isa = PBXBuildFile; fileRef = 341741BF1C5D8243000EF209 /* OIDError.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D91B85D249053190005B197 /* OIDExternalUserAgentIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = A6DEABA92018E5B50022AC32 /* OIDExternalUserAgentIOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; 2D9385DE24B3861E009A12D7 /* AppAuthTV.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D9385B924B37CAD009A12D7 /* AppAuthTV.h */; settings = {ATTRIBUTES = (Public, ); }; }; 2D9385DF24B38646009A12D7 /* OIDTVAuthorizationRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D47AAD9249A87010059B5A4 /* OIDTVAuthorizationRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; 2D9385E024B38658009A12D7 /* OIDTVAuthorizationResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D47AADC249A87010059B5A4 /* OIDTVAuthorizationResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -653,6 +592,9 @@ A6DEABB52018ECF30022AC32 /* OIDEndSessionResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = CF6431F21F228A980075B6B5 /* OIDEndSessionResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; A6DEABB62018ECF30022AC32 /* OIDEndSessionResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = CF6431F21F228A980075B6B5 /* OIDEndSessionResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; A6DEABB72018ECF40022AC32 /* OIDEndSessionResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = CF6431F21F228A980075B6B5 /* OIDEndSessionResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C14E3B6827E3BEFB00CF05A9 /* OIDExternalUserAgentIOSCustomBrowser.h in Headers */ = {isa = PBXBuildFile; fileRef = C14E3B6627E3BEFB00CF05A9 /* OIDExternalUserAgentIOSCustomBrowser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C14E3B6927E3BEFB00CF05A9 /* OIDExternalUserAgentIOSCustomBrowser.m in Sources */ = {isa = PBXBuildFile; fileRef = C14E3B6727E3BEFB00CF05A9 /* OIDExternalUserAgentIOSCustomBrowser.m */; }; + C14E3B6A27E3BFB800CF05A9 /* OIDExternalUserAgentIOSCustomBrowser.m in Sources */ = {isa = PBXBuildFile; fileRef = C14E3B6727E3BEFB00CF05A9 /* OIDExternalUserAgentIOSCustomBrowser.m */; }; CF37C06E1F1FC21A00662E41 /* OIDEndSessionRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = CF37C06C1F1FC21A00662E41 /* OIDEndSessionRequest.m */; }; CF37C06F1F1FC21A00662E41 /* OIDEndSessionRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = CF37C06C1F1FC21A00662E41 /* OIDEndSessionRequest.m */; }; CF37C0701F1FC21A00662E41 /* OIDEndSessionRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = CF37C06C1F1FC21A00662E41 /* OIDEndSessionRequest.m */; }; @@ -755,8 +697,6 @@ 039697441FA8258D003D1FB2 /* OIDURLSessionProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDURLSessionProvider.h; sourceTree = ""; }; 039697451FA8258D003D1FB2 /* OIDURLSessionProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OIDURLSessionProvider.m; sourceTree = ""; }; 0396974C1FA827AD003D1FB2 /* OIDURLSessionProviderTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OIDURLSessionProviderTests.m; sourceTree = ""; }; - 2D0BB86A249D5B75005BA653 /* AppAuthEnterpriseUserAgent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppAuthEnterpriseUserAgent.h; sourceTree = ""; }; - 2D0BB86B249D5BAF005BA653 /* AppAuthEnterpriseUserAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppAuthEnterpriseUserAgent.h; sourceTree = ""; }; 2D47AAD8249A87010059B5A4 /* OIDTVAuthorizationResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OIDTVAuthorizationResponse.m; sourceTree = ""; }; 2D47AAD9249A87010059B5A4 /* OIDTVAuthorizationRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDTVAuthorizationRequest.h; sourceTree = ""; }; 2D47AADA249A87010059B5A4 /* OIDTVServiceConfiguration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OIDTVServiceConfiguration.m; sourceTree = ""; }; @@ -769,8 +709,6 @@ 2D8111F524C0FD4C00984DA7 /* AppAuthTVTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AppAuthTVTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 2D81120024C1036700984DA7 /* OIDTVAuthorizationRequestTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OIDTVAuthorizationRequestTests.m; sourceTree = ""; }; 2D81120324C1036700984DA7 /* OIDTVAuthorizationRequestTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDTVAuthorizationRequestTests.h; sourceTree = ""; }; - 2D91B862249053190005B197 /* AppAuthEnterpriseUserAgent.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AppAuthEnterpriseUserAgent.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 2D91B868249177180005B197 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 2D9385B724B37CAD009A12D7 /* AppAuthTV.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AppAuthTV.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 2D9385B924B37CAD009A12D7 /* AppAuthTV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppAuthTV.h; sourceTree = ""; }; 2D9385BA24B37CAD009A12D7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -899,6 +837,8 @@ A6DEAB9A2018E4A20022AC32 /* OIDExternalUserAgentRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDExternalUserAgentRequest.h; sourceTree = ""; }; A6DEABA82018E5B50022AC32 /* OIDExternalUserAgentIOS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OIDExternalUserAgentIOS.m; sourceTree = ""; }; A6DEABA92018E5B50022AC32 /* OIDExternalUserAgentIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDExternalUserAgentIOS.h; sourceTree = ""; }; + C14E3B6627E3BEFB00CF05A9 /* OIDExternalUserAgentIOSCustomBrowser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDExternalUserAgentIOSCustomBrowser.h; sourceTree = ""; }; + C14E3B6727E3BEFB00CF05A9 /* OIDExternalUserAgentIOSCustomBrowser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OIDExternalUserAgentIOSCustomBrowser.m; sourceTree = ""; }; CF37C06B1F1FC21A00662E41 /* OIDEndSessionRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDEndSessionRequest.h; sourceTree = ""; }; CF37C06C1F1FC21A00662E41 /* OIDEndSessionRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OIDEndSessionRequest.m; sourceTree = ""; }; CF6431F21F228A980075B6B5 /* OIDEndSessionResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDEndSessionResponse.h; sourceTree = ""; }; @@ -920,13 +860,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 2D91B83C249053190005B197 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; 2D9385B424B37CAD009A12D7 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -1106,15 +1039,6 @@ path = AppAuthTV; sourceTree = ""; }; - 2D91B867249177180005B197 /* EnterpriseUserAgentFramework */ = { - isa = PBXGroup; - children = ( - 2D0BB86B249D5BAF005BA653 /* AppAuthEnterpriseUserAgent.h */, - 2D91B868249177180005B197 /* Info.plist */, - ); - path = EnterpriseUserAgentFramework; - sourceTree = ""; - }; 2D9385B824B37CAD009A12D7 /* TVFramework */ = { isa = PBXGroup; children = ( @@ -1172,7 +1096,6 @@ 342F42C32177B1FC00574F24 /* AppAuthCore.framework */, 348970972177B3B000ABEED4 /* AppAuthCoreTests.xctest */, 2D9385B724B37CAD009A12D7 /* AppAuthTV.framework */, - 2D91B862249053190005B197 /* AppAuthEnterpriseUserAgent.framework */, 2D8111F524C0FD4C00984DA7 /* AppAuthTVTests.xctest */, ); name = Products; @@ -1182,7 +1105,6 @@ isa = PBXGroup; children = ( 2D47AAD2249988770059B5A4 /* AppAuthEnterpriseUserAgent */, - 2D91B867249177180005B197 /* EnterpriseUserAgentFramework */, 348970992178F40600ABEED4 /* CoreFramework */, 343AAA4C1E8345B600F9D36E /* Framework */, 2D9385B824B37CAD009A12D7 /* TVFramework */, @@ -1192,7 +1114,6 @@ 341741AF1C5D8243000EF209 /* AppAuth.h */, 3489709E21791B0C00ABEED4 /* AppAuthCore.h */, 2D47AADB249A87010059B5A4 /* AppAuthTV.h */, - 2D0BB86A249D5B75005BA653 /* AppAuthEnterpriseUserAgent.h */, ); path = Source; sourceTree = ""; @@ -1348,6 +1269,8 @@ F6F60FAF1D2BFEF000325CB3 /* iOS */ = { isa = PBXGroup; children = ( + C14E3B6627E3BEFB00CF05A9 /* OIDExternalUserAgentIOSCustomBrowser.h */, + C14E3B6727E3BEFB00CF05A9 /* OIDExternalUserAgentIOSCustomBrowser.m */, F6F60FB31D2BFEFE00325CB3 /* OIDAuthorizationService+IOS.h */, F6F60FB11D2BFEFE00325CB3 /* OIDAuthorizationService+IOS.m */, F6F60FB51D2BFEFE00325CB3 /* OIDAuthState+IOS.h */, @@ -1363,45 +1286,6 @@ /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ - 2D91B83D249053190005B197 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D0BB86C249D5BAF005BA653 /* AppAuthEnterpriseUserAgent.h in Headers */, - 2D91B842249053190005B197 /* OIDExternalUserAgentIOSCustomBrowser.h in Headers */, - 2D91B83E249053190005B197 /* OIDAuthorizationResponse.h in Headers */, - 2D91B83F249053190005B197 /* OIDScopes.h in Headers */, - 2D91B840249053190005B197 /* OIDExternalUserAgentRequest.h in Headers */, - 2D91B841249053190005B197 /* OIDAuthStateChangeDelegate.h in Headers */, - 2D91B845249053190005B197 /* OIDIDToken.h in Headers */, - 2D91B846249053190005B197 /* OIDResponseTypes.h in Headers */, - 2D91B847249053190005B197 /* OIDTokenRequest.h in Headers */, - 2D91B848249053190005B197 /* OIDScopeUtilities.h in Headers */, - 2D91B849249053190005B197 /* OIDTokenResponse.h in Headers */, - 2D91B84A249053190005B197 /* OIDEndSessionResponse.h in Headers */, - 2D91B84B249053190005B197 /* OIDServiceDiscovery.h in Headers */, - 2D91B84C249053190005B197 /* OIDGrantTypes.h in Headers */, - 2D91B84D249053190005B197 /* OIDURLSessionProvider.h in Headers */, - 2D91B84F249053190005B197 /* OIDRegistrationResponse.h in Headers */, - 2D91B850249053190005B197 /* OIDExternalUserAgent.h in Headers */, - 2D91B851249053190005B197 /* OIDExternalUserAgentSession.h in Headers */, - 2D91B852249053190005B197 /* OIDServiceConfiguration.h in Headers */, - 2D91B853249053190005B197 /* OIDAuthStateErrorDelegate.h in Headers */, - 2D91B854249053190005B197 /* OIDAuthorizationService.h in Headers */, - 2D91B855249053190005B197 /* OIDRegistrationRequest.h in Headers */, - 2D91B856249053190005B197 /* OIDEndSessionRequest.h in Headers */, - 2D91B857249053190005B197 /* OIDAuthState.h in Headers */, - 2D91B858249053190005B197 /* OIDErrorUtilities.h in Headers */, - 2D91B85A249053190005B197 /* OIDAuthorizationRequest.h in Headers */, - 2D91B85B249053190005B197 /* OIDTokenUtilities.h in Headers */, - 2D91B85C249053190005B197 /* OIDError.h in Headers */, - 2D91B859249053190005B197 /* OIDAuthorizationService+IOS.h in Headers */, - 2D91B84E249053190005B197 /* OIDAuthState+IOS.h in Headers */, - 2D91B85D249053190005B197 /* OIDExternalUserAgentIOS.h in Headers */, - 2D91B844249053190005B197 /* OIDExternalUserAgentCatalyst.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 2D9385B224B37CAD009A12D7 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -1518,6 +1402,7 @@ 343AAAE31E83499000F9D36E /* OIDAuthorizationRequest.h in Headers */, 343AAAF91E83499000F9D36E /* OIDTokenUtilities.h in Headers */, 343AAAEC1E83499000F9D36E /* OIDError.h in Headers */, + C14E3B6827E3BEFB00CF05A9 /* OIDExternalUserAgentIOSCustomBrowser.h in Headers */, A6DEABAB2018E5C50022AC32 /* OIDExternalUserAgentIOS.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1650,24 +1535,6 @@ productReference = 2D8111F524C0FD4C00984DA7 /* AppAuthTVTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; - 2D91B81D249053190005B197 /* AppAuthEnterpriseUserAgent */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2D91B85F249053190005B197 /* Build configuration list for PBXNativeTarget "AppAuthEnterpriseUserAgent" */; - buildPhases = ( - 2D91B81E249053190005B197 /* Sources */, - 2D91B83C249053190005B197 /* Frameworks */, - 2D91B83D249053190005B197 /* Headers */, - 2D91B85E249053190005B197 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = AppAuthEnterpriseUserAgent; - productName = AppAuth_iOS; - productReference = 2D91B862249053190005B197 /* AppAuthEnterpriseUserAgent.framework */; - productType = "com.apple.product-type.framework"; - }; 2D9385B624B37CAD009A12D7 /* AppAuthTV */ = { isa = PBXNativeTarget; buildConfigurationList = 2D9385C824B37CAD009A12D7 /* Build configuration list for PBXNativeTarget "AppAuthTV" */; @@ -2073,7 +1940,6 @@ 342F42842177B1FC00574F24 /* AppAuthCore */, 3489707D2177B3B000ABEED4 /* AppAuthCoreTests */, 2D9385B624B37CAD009A12D7 /* AppAuthTV */, - 2D91B81D249053190005B197 /* AppAuthEnterpriseUserAgent */, 2D8111F424C0FD4C00984DA7 /* AppAuthTVTests */, ); }; @@ -2087,13 +1953,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 2D91B85E249053190005B197 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; 2D9385B524B37CAD009A12D7 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -2214,42 +2073,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 2D91B81E249053190005B197 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D91B82F249053190005B197 /* OIDExternalUserAgentIOSCustomBrowser.m in Sources */, - 2D91B821249053190005B197 /* OIDFieldMapping.m in Sources */, - 2D91B822249053190005B197 /* OIDIDToken.m in Sources */, - 2D91B823249053190005B197 /* OIDEndSessionResponse.m in Sources */, - 2D91B824249053190005B197 /* OIDAuthState.m in Sources */, - 2D91B826249053190005B197 /* OIDTokenResponse.m in Sources */, - 2D91B827249053190005B197 /* OIDErrorUtilities.m in Sources */, - 2D91B828249053190005B197 /* OIDURLQueryComponent.m in Sources */, - 2D91B829249053190005B197 /* OIDAuthorizationRequest.m in Sources */, - 2D91B82A249053190005B197 /* OIDAuthorizationService.m in Sources */, - 2D91B82B249053190005B197 /* OIDClientMetadataParameters.m in Sources */, - 2D91B82C249053190005B197 /* OIDTokenUtilities.m in Sources */, - 2D91B82D249053190005B197 /* OIDServiceDiscovery.m in Sources */, - 2D91B82E249053190005B197 /* OIDTokenRequest.m in Sources */, - 2D91B830249053190005B197 /* OIDEndSessionRequest.m in Sources */, - 2D91B832249053190005B197 /* OIDServiceConfiguration.m in Sources */, - 2D91B833249053190005B197 /* OIDRegistrationResponse.m in Sources */, - 2D91B834249053190005B197 /* OIDURLSessionProvider.m in Sources */, - 2D91B835249053190005B197 /* OIDScopes.m in Sources */, - 2D91B836249053190005B197 /* OIDScopeUtilities.m in Sources */, - 2D91B837249053190005B197 /* OIDGrantTypes.m in Sources */, - 2D91B838249053190005B197 /* OIDRegistrationRequest.m in Sources */, - 2D91B839249053190005B197 /* OIDResponseTypes.m in Sources */, - 2D91B83A249053190005B197 /* OIDAuthorizationResponse.m in Sources */, - 2D91B83B249053190005B197 /* OIDError.m in Sources */, - 2D91B825249053190005B197 /* OIDAuthState+IOS.m in Sources */, - 2D91B831249053190005B197 /* OIDAuthorizationService+IOS.m in Sources */, - 2D91B81F249053190005B197 /* OIDExternalUserAgentIOS.m in Sources */, - 2D91B820249053190005B197 /* OIDExternalUserAgentCatalyst.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 2D9385B324B37CAD009A12D7 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -2326,6 +2149,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + C14E3B6A27E3BFB800CF05A9 /* OIDExternalUserAgentIOSCustomBrowser.m in Sources */, A6DEABAA2018E5B50022AC32 /* OIDExternalUserAgentIOS.m in Sources */, 341741E01C5D8243000EF209 /* OIDErrorUtilities.m in Sources */, 34A6632D1E871DD40060B664 /* OIDIDToken.m in Sources */, @@ -2502,6 +2326,7 @@ F9A7082F2355ED74004B3E6D /* OIDExternalUserAgentCatalyst.m in Sources */, 343AAA881E83478900F9D36E /* OIDFieldMapping.m in Sources */, 34A663311E871DD40060B664 /* OIDIDToken.m in Sources */, + C14E3B6927E3BEFB00CF05A9 /* OIDExternalUserAgentIOSCustomBrowser.m in Sources */, A6DEAB862017A7060022AC32 /* OIDEndSessionResponse.m in Sources */, 343AAA841E83478900F9D36E /* OIDAuthState.m in Sources */, 343AAA701E83467D00F9D36E /* OIDAuthState+IOS.m in Sources */, @@ -2829,58 +2654,6 @@ }; name = Release; }; - 2D91B860249053190005B197 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CODE_SIGN_IDENTITY = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Source/EnterpriseUserAgentFramework/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = net.openid.AppAuthEnterpriseUserAgent; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SUPPORTS_MACCATALYST = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 2D91B861249053190005B197 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CODE_SIGN_IDENTITY = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Source/EnterpriseUserAgentFramework/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = net.openid.AppAuthEnterpriseUserAgent; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SUPPORTS_MACCATALYST = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; 2D9385C924B37CAD009A12D7 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -3024,7 +2797,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MACOSX_DEPLOYMENT_TARGET = 10.9; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; @@ -3080,7 +2853,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MACOSX_DEPLOYMENT_TARGET = 10.9; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; @@ -3112,7 +2885,7 @@ CLANG_ENABLE_MODULES = YES; HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/"; INFOPLIST_FILE = UnitTests/UnitTestsInfo.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = net.openid.appauth.AppAuthTests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -3129,7 +2902,7 @@ CLANG_ENABLE_MODULES = YES; HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/"; INFOPLIST_FILE = UnitTests/UnitTestsInfo.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = net.openid.appauth.AppAuthTests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -3639,15 +3412,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 2D91B85F249053190005B197 /* Build configuration list for PBXNativeTarget "AppAuthEnterpriseUserAgent" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2D91B860249053190005B197 /* Debug */, - 2D91B861249053190005B197 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; 2D9385C824B37CAD009A12D7 /* Build configuration list for PBXNativeTarget "AppAuthTV" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuthEnterpriseUserAgent.xcscheme b/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuthEnterpriseUserAgent.xcscheme deleted file mode 100644 index 3c18d8b46..000000000 --- a/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuthEnterpriseUserAgent.xcscheme +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Package.swift b/Package.swift index 55bf7dfb8..b031680df 100644 --- a/Package.swift +++ b/Package.swift @@ -35,9 +35,6 @@ let package = Package( .library( name: "AppAuth", targets: ["AppAuth"]), - .library( - name: "AppAuthEnterpriseUserAgent", - targets: ["AppAuthEnterpriseUserAgent"]), .library( name: "AppAuthTV", targets: ["AppAuthTV"]) @@ -61,16 +58,6 @@ let package = Package( .headerSearchPath("macOS/LoopbackHTTPServer"), ] ), - .target( - name: "AppAuthEnterpriseUserAgent", - dependencies: ["AppAuthCore"], - path: "Source/AppAuthEnterpriseUserAgent", - sources: ["iOS"], - publicHeadersPath: "", - cSettings: [ - .headerSearchPath("iOS"), - ] - ), .target( name: "AppAuthTV", dependencies: ["AppAuthCore"], diff --git a/README.md b/README.md index 7651dbe9d..78f79959f 100644 --- a/README.md +++ b/README.md @@ -631,24 +631,6 @@ try, or use as a reference for your own implementation. One of them, enables you to use a different browser for authentication, like Chrome for iOS or Firefox for iOS. -##### CocoaPods -Include the `EnterpriseUserAgent` subspec alongside any pods/subspecs you were already using, e.g.: -``` - pod 'AppAuth' - pod 'AppAuth/EnterpriseUserAgent' -``` - -Make sure to import `AppAuthEnterpriseUserAgent.h` in addition to `AppAuth.h` if you are using the full `AppAuth` functionality. - -##### Carthage -Use the `AppAuthEnterpriseUserAgent` framework, which includes all the headers of the `AppAuth` framework. -Make sure to import ``. This includes all the files included by AppAuth/AppAuthCore, so only this import is necessary. - -##### Swift Package Manager -Include the `AppAuthEnterpriseUserAgent` target alongside any targets you were already using. - -Make sure to import `AppAuthEnterpriseUserAgent.h` in addition to `AppAuth.h` if you are using the full `AppAuth` functionality. - Here's how to configure AppAuth to use a custom browser using the `OIDExternalUserAgentIOSCustomBrowser` user agent: @@ -669,9 +651,6 @@ This is required so that AppAuth can test for the browser and open the app store if it's not installed (the default behavior of this user-agent). You only need to include the URL scheme of the actual browser you intend to use. -Next, make sure to import the correct header file. -If using CocoaPods/Swift Package manager, make sure to import AppAuthEnterpriseUserAgent alongside AppAuth/AppAuthCore. - Objective-C ```objc // performs authentication request diff --git a/Source/AppAuth.h b/Source/AppAuth.h index a313a75ad..19abc55e1 100644 --- a/Source/AppAuth.h +++ b/Source/AppAuth.h @@ -49,6 +49,7 @@ #import "OIDAuthState+IOS.h" #import "OIDAuthorizationService+IOS.h" #import "OIDExternalUserAgentIOS.h" +#import "OIDExternalUserAgentIOSCustomBrowser.h" #import "OIDExternalUserAgentCatalyst.h" #elif TARGET_OS_OSX #import "OIDAuthState+Mac.h" diff --git a/Source/AppAuthEnterpriseUserAgent/iOS/OIDExternalUserAgentIOSCustomBrowser.h b/Source/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.h similarity index 100% rename from Source/AppAuthEnterpriseUserAgent/iOS/OIDExternalUserAgentIOSCustomBrowser.h rename to Source/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.h diff --git a/Source/AppAuthEnterpriseUserAgent/iOS/OIDExternalUserAgentIOSCustomBrowser.m b/Source/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.m similarity index 100% rename from Source/AppAuthEnterpriseUserAgent/iOS/OIDExternalUserAgentIOSCustomBrowser.m rename to Source/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.m diff --git a/Source/AppAuthEnterpriseUserAgent.h b/Source/AppAuthEnterpriseUserAgent.h deleted file mode 100644 index 3bc505418..000000000 --- a/Source/AppAuthEnterpriseUserAgent.h +++ /dev/null @@ -1,21 +0,0 @@ -/*! @file AppAuthEnterpriseUserAgent.h - @brief AppAuth iOS SDK - @copyright - Copyright 2020 Google Inc. All Rights Reserved. - @copydetails - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -#import "AppAuthCore.h" - -#import "OIDExternalUserAgentIOSCustomBrowser.h" diff --git a/Source/EnterpriseUserAgentFramework/AppAuthEnterpriseUserAgent.h b/Source/EnterpriseUserAgentFramework/AppAuthEnterpriseUserAgent.h deleted file mode 100644 index 70c152deb..000000000 --- a/Source/EnterpriseUserAgentFramework/AppAuthEnterpriseUserAgent.h +++ /dev/null @@ -1,59 +0,0 @@ -/*! @file AppAuthEnterpriseUserAgentEnterpriseUserAgent.h - @brief AppAuthEnterpriseUserAgent iOS SDK - @copyright - Copyright 2020 Google Inc. All Rights Reserved. - @copydetails - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -#import - -//! Project version number for AppAuthEnterpriseUserAgentEnterpriseUserAgentFramework. -FOUNDATION_EXPORT double AppAuthEnterpriseUserAgentEnterpriseUserAgentVersionNumber; - -//! Project version string for AppAuthEnterpriseUserAgentEnterpriseUserAgentFramework. -FOUNDATION_EXPORT const unsigned char AppAuthEnterpriseUserAgentEnterpriseUserAgentVersionString[]; - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -#import -#import -#import -#import "AppAuthEnterpriseUserAgent/OIDExternalUserAgentCatalyst.h" - -#import diff --git a/Source/EnterpriseUserAgentFramework/Info.plist b/Source/EnterpriseUserAgentFramework/Info.plist deleted file mode 100644 index fdd42e8ac..000000000 --- a/Source/EnterpriseUserAgentFramework/Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSHumanReadableCopyright - Copyright © 2020 The AppAuth Authors - NSPrincipalClass - - - diff --git a/Source/Framework/AppAuth.h b/Source/Framework/AppAuth.h index 3139df37f..f1916de77 100644 --- a/Source/Framework/AppAuth.h +++ b/Source/Framework/AppAuth.h @@ -57,6 +57,7 @@ FOUNDATION_EXPORT const unsigned char AppAuthVersionString[]; #import #import #import +#import #import "AppAuth/OIDExternalUserAgentCatalyst.h" #elif TARGET_OS_OSX #import From 33660c271c961f8ce1084cc13f2ea8195e864f7d Mon Sep 17 00:00:00 2001 From: Peter Andrews Date: Fri, 18 Mar 2022 11:15:14 -0700 Subject: [PATCH 44/81] Prepare for 1.5.0 release (#692) * Bump podspec version for 1.5.0 release. * Update changelog for 1.5.0 release. --- AppAuth.podspec | 2 +- CHANGELOG.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/AppAuth.podspec b/AppAuth.podspec index 40470c7b7..c4b573b05 100644 --- a/AppAuth.podspec +++ b/AppAuth.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "AppAuth" - s.version = "1.4.0" + s.version = "1.5.0" s.summary = "AppAuth for iOS and macOS is a client SDK for communicating with OAuth 2.0 and OpenID Connect providers." s.description = <<-DESC diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ebb29dee..fc68c324b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # AppAuth for iOS and macOS Changelog +## 1.5.0 +- Improved tvOS support. ([#111](https://github.com/openid/AppAuth-iOS/issues/111)) +- ASWebAuthencationSession on macOS. ([#675](https://github.com/openid/AppAuth-iOS/pull/675)) + ## 1.4.0 ### Added From 25f44d131cedb5d5808211dbebe8648320f513ba Mon Sep 17 00:00:00 2001 From: Peter Andrews Date: Fri, 18 Mar 2022 22:11:02 -0700 Subject: [PATCH 45/81] Fix changelog typo. --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc68c324b..0ac138f0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 1.5.0 - Improved tvOS support. ([#111](https://github.com/openid/AppAuth-iOS/issues/111)) -- ASWebAuthencationSession on macOS. ([#675](https://github.com/openid/AppAuth-iOS/pull/675)) +- ASWebAuthenticationSession on macOS. ([#675](https://github.com/openid/AppAuth-iOS/pull/675)) ## 1.4.0 From d49491a5ec8613ead20cf3ab5ec80a1b87996c1d Mon Sep 17 00:00:00 2001 From: Peter Andrews Date: Thu, 31 Mar 2022 08:57:49 -0700 Subject: [PATCH 46/81] Remove empty AppAuthEnterpriseUserAgent folder from Xcode project. (#697) --- AppAuth.xcodeproj/project.pbxproj | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/AppAuth.xcodeproj/project.pbxproj b/AppAuth.xcodeproj/project.pbxproj index 2f4dcaaf5..1a945644d 100644 --- a/AppAuth.xcodeproj/project.pbxproj +++ b/AppAuth.xcodeproj/project.pbxproj @@ -803,8 +803,6 @@ 343AAAAE1E83489A00F9D36E /* AppAuth_tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AppAuth_tvOSTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 343AAAC21E8348A900F9D36E /* AppAuth.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AppAuth.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 343AAACA1E8348AA00F9D36E /* AppAuth_macOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AppAuth_macOSTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 345AE745202D526800738D22 /* OIDExternalUserAgentIOSCustomBrowser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OIDExternalUserAgentIOSCustomBrowser.m; sourceTree = ""; }; - 345AE746202D526800738D22 /* OIDExternalUserAgentIOSCustomBrowser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDExternalUserAgentIOSCustomBrowser.h; sourceTree = ""; }; 347423F61E7F4B5600D3E6D6 /* libAppAuth-watchOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libAppAuth-watchOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 348970972177B3B000ABEED4 /* AppAuthCoreTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AppAuthCoreTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 3489709A2178F40600ABEED4 /* AppAuthCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppAuthCore.h; sourceTree = ""; }; @@ -992,23 +990,6 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 2D47AAD2249988770059B5A4 /* AppAuthEnterpriseUserAgent */ = { - isa = PBXGroup; - children = ( - 2D47AAD3249988B90059B5A4 /* iOS */, - ); - path = AppAuthEnterpriseUserAgent; - sourceTree = ""; - }; - 2D47AAD3249988B90059B5A4 /* iOS */ = { - isa = PBXGroup; - children = ( - 345AE746202D526800738D22 /* OIDExternalUserAgentIOSCustomBrowser.h */, - 345AE745202D526800738D22 /* OIDExternalUserAgentIOSCustomBrowser.m */, - ); - path = iOS; - sourceTree = ""; - }; 2D47AAD7249A86E30059B5A4 /* AppAuthTV */ = { isa = PBXGroup; children = ( @@ -1104,7 +1085,6 @@ 341741AE1C5D8243000EF209 /* Source */ = { isa = PBXGroup; children = ( - 2D47AAD2249988770059B5A4 /* AppAuthEnterpriseUserAgent */, 348970992178F40600ABEED4 /* CoreFramework */, 343AAA4C1E8345B600F9D36E /* Framework */, 2D9385B824B37CAD009A12D7 /* TVFramework */, From 0612db562911ee813733ed9255181f1cd5ed78fa Mon Sep 17 00:00:00 2001 From: Peter Andrews Date: Fri, 1 Apr 2022 00:57:58 -0700 Subject: [PATCH 47/81] Update issue templates (#699) --- .github/ISSUE_TEMPLATE/bug_report.md | 6 +++--- .github/ISSUE_TEMPLATE/feature_request.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index a598b7fbf..dd84ea782 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,12 +1,12 @@ --- name: Bug report about: Create a report to help us improve +title: '' +labels: '' +assignees: '' --- -**Are you filing an issue about iOS 12?** -You can find preliminary support for iOS 12 in the (ios12beta branch)[https://github.com/openid/AppAuth-iOS/tree/ios12beta] and background information in (the associated pull request)[https://github.com/openid/AppAuth-iOS/pull/246]. Please review these materials before filing iOS 12 issues. Thanks. - **Describe the bug** A clear and concise description of what the bug is. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 5ad6b46bf..bbcbbe7d6 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,12 +1,12 @@ --- name: Feature request about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' --- -**Are you filing an issue about iOS 12?** -You can find preliminary support for iOS 12 in the (ios12beta branch)[https://github.com/openid/AppAuth-iOS/tree/ios12beta] and background information in (the associated pull request)[https://github.com/openid/AppAuth-iOS/pull/246]. Please review these materials before filing iOS 12 issues. Thanks. - **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] From 98ed5e15ceedcacc0b3fd6c3521a22411acc2212 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 7 Apr 2022 08:45:49 -0700 Subject: [PATCH 48/81] Bump cocoapods-downloader from 1.5.1 to 1.6.3 (#700) Bumps [cocoapods-downloader](https://github.com/CocoaPods/cocoapods-downloader) from 1.5.1 to 1.6.3. - [Release notes](https://github.com/CocoaPods/cocoapods-downloader/releases) - [Changelog](https://github.com/CocoaPods/cocoapods-downloader/blob/master/CHANGELOG.md) - [Commits](https://github.com/CocoaPods/cocoapods-downloader/compare/1.5.1...1.6.3) --- updated-dependencies: - dependency-name: cocoapods-downloader dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2f9cb67a2..9ed5f1d66 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -45,7 +45,7 @@ GEM public_suffix (~> 4.0) typhoeus (~> 1.0) cocoapods-deintegrate (1.0.5) - cocoapods-downloader (1.5.1) + cocoapods-downloader (1.6.3) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.1) From 8582608849acbd2a434307a19da3a4f8f7267564 Mon Sep 17 00:00:00 2001 From: Peter Andrews Date: Wed, 1 Jun 2022 15:55:27 -0700 Subject: [PATCH 49/81] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index dd84ea782..107a71184 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,6 +1,6 @@ --- name: Bug report -about: Create a report to help us improve +about: Create a bug report to help us improve title: '' labels: '' assignees: '' @@ -23,16 +23,10 @@ A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. -**Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] - -**Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] +**Environment** +- Device: [ e.g. iPhone 13, MacBook Pro, etc ] +- OS: [ e.g. iOS 15, macOS 11, etc ] +- Browser: [ e.g. Safari, Chrome, etc ] **Additional context** Add any other context about the problem here. From a4473150393702c4009c6ea73df69bba85811eae Mon Sep 17 00:00:00 2001 From: Peter Andrews Date: Wed, 17 Aug 2022 15:43:22 -0700 Subject: [PATCH 50/81] Update ObjC style guide link. --- CONTRIBUTING.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 51537d3a0..d4fe7b6fc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,8 +48,7 @@ discussing your proposal, or email the ## Coding Standards The AppAuth library follows the -[Google Coding Style](https://google.github.io/styleguide/objcguide.xml) for -the Objective-C language. Please review your own code for adherence to the +[Google Objective-C Style Guide](https://github.com/google/styleguide/blob/gh-pages/objcguide.md). Please review your own code for adherence to the standard. ## Pull Request Reviews From c1a5080e5fe60579ba8f4c753535e18a248eb5b0 Mon Sep 17 00:00:00 2001 From: danblakemore Date: Thu, 18 Aug 2022 19:09:04 -0700 Subject: [PATCH 51/81] Add prefersEphemeralSession parameter for external user-agents (#645) * Add emphemeral browser option iOS/Catalyst user agents. Adds BOOL properties to iOS/Catalyst-related methods which allow setting the ASWebAuthenticationSession property prefersEphemeralWebBrowserSession. * Add emphemeral browser option to macOS user agent. Adds BOOL arguments to macOS-related methods which allow setting the ASWebAuthenticationSession property prefersEphemeralWebBrowserSession. * Update doc comments based on review feedback. Also fixes some formatting and code symbol annotation to support Xcode Quick Help. * Replace 'Catalyst' with 'external' in method brief --- Source/AppAuth/iOS/OIDAuthState+IOS.h | 27 ++++++++++++++++--- Source/AppAuth/iOS/OIDAuthState+IOS.m | 20 ++++++++++++++ .../AppAuth/iOS/OIDAuthorizationService+IOS.h | 23 +++++++++++++--- .../AppAuth/iOS/OIDAuthorizationService+IOS.m | 16 +++++++++++ .../iOS/OIDExternalUserAgentCatalyst.h | 9 +++++++ .../iOS/OIDExternalUserAgentCatalyst.m | 12 +++++++++ Source/AppAuth/iOS/OIDExternalUserAgentIOS.h | 20 ++++++++++++-- Source/AppAuth/iOS/OIDExternalUserAgentIOS.m | 14 +++++++++- Source/AppAuth/macOS/OIDAuthState+Mac.h | 26 +++++++++++++++++- Source/AppAuth/macOS/OIDAuthState+Mac.m | 12 +++++++++ .../macOS/OIDAuthorizationService+Mac.h | 20 +++++++++++++- .../macOS/OIDAuthorizationService+Mac.m | 12 +++++++++ .../AppAuth/macOS/OIDExternalUserAgentMac.h | 12 ++++++++- .../AppAuth/macOS/OIDExternalUserAgentMac.m | 11 ++++++++ 14 files changed, 222 insertions(+), 12 deletions(-) diff --git a/Source/AppAuth/iOS/OIDAuthState+IOS.h b/Source/AppAuth/iOS/OIDAuthState+IOS.h index 99ca45734..1a1ee63a0 100644 --- a/Source/AppAuth/iOS/OIDAuthState+IOS.h +++ b/Source/AppAuth/iOS/OIDAuthState+IOS.h @@ -37,9 +37,7 @@ NS_ASSUME_NONNULL_BEGIN and update the OIDAuthState with the results (@c OIDAuthState.updateWithTokenResponse:error:). @param authorizationRequest The authorization request to present. - @param presentingViewController The view controller from which to present the - @c SFSafariViewController. On iOS 13, the window of this UIViewController - is used as the ASPresentationAnchor. + @param presentingViewController The view controller to use for presenting the authentication UI. @param callback The method called when the request has completed or failed. @return A @c OIDExternalUserAgentSession instance which will terminate when it receives a @c OIDExternalUserAgentSession.cancel message, or after processing a @@ -50,6 +48,29 @@ NS_ASSUME_NONNULL_BEGIN presentingViewController:(UIViewController *)presentingViewController callback:(OIDAuthStateAuthorizationCallback)callback; +/*! @brief Convenience method to create a @c OIDAuthState by presenting an authorization request + (optionally using an emphemeral browser session that shares no cookies or data with the + normal browser session) and performing the authorization code exchange in the case of code + flow requests. For the hybrid flow, the caller should validate the id_token and c_hash, then + perform the token request (@c OIDAuthorizationService.performTokenRequest:callback:) + and update the OIDAuthState with the results (@c + OIDAuthState.updateWithTokenResponse:error:). + @param authorizationRequest The authorization request to present. + @param presentingViewController The view controller to use for presenting the authentication UI. + @param prefersEphemeralSession Whether the caller prefers to use a private authentication + session. See @c ASWebAuthenticationSession.prefersEphemeralWebBrowserSession for more. + @param callback The method called when the request has completed or failed. + @return A @c OIDExternalUserAgentSession instance which will terminate when it + receives a @c OIDExternalUserAgentSession.cancel message, or after processing a + @c OIDExternalUserAgentSession.resumeExternalUserAgentFlowWithURL: message. + */ ++ (id) + authStateByPresentingAuthorizationRequest:(OIDAuthorizationRequest *)authorizationRequest + presentingViewController:(UIViewController *)presentingViewController + prefersEphemeralSession:(BOOL)prefersEphemeralSession + callback:(OIDAuthStateAuthorizationCallback)callback + API_AVAILABLE(ios(13)); + + (id) authStateByPresentingAuthorizationRequest:(OIDAuthorizationRequest *)authorizationRequest callback:(OIDAuthStateAuthorizationCallback)callback API_AVAILABLE(ios(11)) API_UNAVAILABLE(macCatalyst) diff --git a/Source/AppAuth/iOS/OIDAuthState+IOS.m b/Source/AppAuth/iOS/OIDAuthState+IOS.m index 9f3a4e8c8..c474a77d1 100644 --- a/Source/AppAuth/iOS/OIDAuthState+IOS.m +++ b/Source/AppAuth/iOS/OIDAuthState+IOS.m @@ -42,6 +42,26 @@ @implementation OIDAuthState (IOS) callback:callback]; } ++ (id) + authStateByPresentingAuthorizationRequest:(OIDAuthorizationRequest *)authorizationRequest + presentingViewController:(UIViewController *)presentingViewController + prefersEphemeralSession:(BOOL)prefersEphemeralSession + callback:(OIDAuthStateAuthorizationCallback)callback { + id externalUserAgent; +#if TARGET_OS_MACCATALYST + externalUserAgent = [[OIDExternalUserAgentCatalyst alloc] + initWithPresentingViewController:presentingViewController + prefersEphemeralSession:prefersEphemeralSession]; +#else // TARGET_OS_MACCATALYST + externalUserAgent = [[OIDExternalUserAgentIOS alloc] + initWithPresentingViewController:presentingViewController + prefersEphemeralSession:prefersEphemeralSession]; +#endif // TARGET_OS_MACCATALYST + return [self authStateByPresentingAuthorizationRequest:authorizationRequest + externalUserAgent:externalUserAgent + callback:callback]; +} + #if !TARGET_OS_MACCATALYST + (id) authStateByPresentingAuthorizationRequest:(OIDAuthorizationRequest *)authorizationRequest diff --git a/Source/AppAuth/iOS/OIDAuthorizationService+IOS.h b/Source/AppAuth/iOS/OIDAuthorizationService+IOS.h index c6e14f194..c7c685d28 100644 --- a/Source/AppAuth/iOS/OIDAuthorizationService+IOS.h +++ b/Source/AppAuth/iOS/OIDAuthorizationService+IOS.h @@ -31,10 +31,10 @@ NS_ASSUME_NONNULL_BEGIN */ @interface OIDAuthorizationService (IOS) -/*! @brief Perform an authorization flow using \SFSafariViewController. +/*! @brief Perform an authorization flow, presenting an appropriate browser for the user to + authenticate. @param request The authorization request. - @param presentingViewController The view controller from which to present the - \SFSafariViewController. + @param presentingViewController The view controller from which to present authentication UI. @param callback The method called when the request has completed or failed. @return A @c OIDExternalUserAgentSession instance which will terminate when it receives a @c OIDExternalUserAgentSession.cancel message, or after processing a @@ -43,6 +43,23 @@ NS_ASSUME_NONNULL_BEGIN + (id) presentAuthorizationRequest:(OIDAuthorizationRequest *)request presentingViewController:(UIViewController *)presentingViewController callback:(OIDAuthorizationCallback)callback; + +/*! @brief Perform an authorization flow using the @c ASWebAuthenticationSession optionally using an + emphemeral browser session that shares no cookies or data with the normal browser session. + @param request The authorization request. + @param presentingViewController The view controller from which to present authentication UI. + @param prefersEphemeralSession Whether the caller prefers to use a private authentication + session. See @c ASWebAuthenticationSession.prefersEphemeralWebBrowserSession for more. + @param callback The method called when the request has completed or failed. + @return A @c OIDExternalUserAgentSession instance which will terminate when it + receives a @c OIDExternalUserAgentSession.cancel message, or after processing a + @c OIDExternalUserAgentSession.resumeExternalUserAgentFlowWithURL: message. + */ ++ (id) presentAuthorizationRequest:(OIDAuthorizationRequest *)request + presentingViewController:(UIViewController *)presentingViewController + prefersEphemeralSession:(BOOL)prefersEphemeralSession + callback:(OIDAuthorizationCallback)callback API_AVAILABLE(ios(13)); + @end NS_ASSUME_NONNULL_END diff --git a/Source/AppAuth/iOS/OIDAuthorizationService+IOS.m b/Source/AppAuth/iOS/OIDAuthorizationService+IOS.m index 05ccff5db..4ca07c55e 100644 --- a/Source/AppAuth/iOS/OIDAuthorizationService+IOS.m +++ b/Source/AppAuth/iOS/OIDAuthorizationService+IOS.m @@ -41,6 +41,22 @@ @implementation OIDAuthorizationService (IOS) return [self presentAuthorizationRequest:request externalUserAgent:externalUserAgent callback:callback]; } ++ (id) presentAuthorizationRequest:(OIDAuthorizationRequest *)request + presentingViewController:(UIViewController *)presentingViewController + prefersEphemeralSession:(BOOL)prefersEphemeralSession + callback:(OIDAuthorizationCallback)callback { + id externalUserAgent; +#if TARGET_OS_MACCATALYST + externalUserAgent = [[OIDExternalUserAgentCatalyst alloc] + initWithPresentingViewController:presentingViewController + prefersEphemeralSession:prefersEphemeralSession]; +#else // TARGET_OS_MACCATALYST + externalUserAgent = [[OIDExternalUserAgentIOS alloc] initWithPresentingViewController:presentingViewController + prefersEphemeralSession:prefersEphemeralSession]; +#endif // TARGET_OS_MACCATALYST + return [self presentAuthorizationRequest:request externalUserAgent:externalUserAgent callback:callback]; +} + @end NS_ASSUME_NONNULL_END diff --git a/Source/AppAuth/iOS/OIDExternalUserAgentCatalyst.h b/Source/AppAuth/iOS/OIDExternalUserAgentCatalyst.h index d98d4413c..910d0bb86 100644 --- a/Source/AppAuth/iOS/OIDExternalUserAgentCatalyst.h +++ b/Source/AppAuth/iOS/OIDExternalUserAgentCatalyst.h @@ -45,6 +45,15 @@ API_AVAILABLE(macCatalyst(13)) API_UNAVAILABLE(ios) (UIViewController *)presentingViewController NS_DESIGNATED_INITIALIZER; +/*! @brief Create an external user-agent which optionally uses a private authentication session. + @param presentingViewController The view controller from which to present the browser. + @param prefersEphemeralSession Whether the caller prefers to use a private authentication + session. See @c ASWebAuthenticationSession.prefersEphemeralWebBrowserSession for more. + */ +- (nullable instancetype)initWithPresentingViewController: + (UIViewController *)presentingViewController + prefersEphemeralSession:(BOOL)prefersEphemeralSession; + @end NS_ASSUME_NONNULL_END diff --git a/Source/AppAuth/iOS/OIDExternalUserAgentCatalyst.m b/Source/AppAuth/iOS/OIDExternalUserAgentCatalyst.m index fc9cef5c0..d6771b3e9 100644 --- a/Source/AppAuth/iOS/OIDExternalUserAgentCatalyst.m +++ b/Source/AppAuth/iOS/OIDExternalUserAgentCatalyst.m @@ -38,6 +38,7 @@ @interface OIDExternalUserAgentCatalyst () _session; @@ -53,6 +54,16 @@ - (nullable instancetype)initWithPresentingViewController: return self; } +- (nullable instancetype)initWithPresentingViewController: + (UIViewController *)presentingViewController + prefersEphemeralSession:(BOOL)prefersEphemeralSession { + self = [self initWithPresentingViewController:presentingViewController]; + if (self) { + _prefersEphemeralSession = prefersEphemeralSession; + } + return self; +} + - (BOOL)presentExternalUserAgentRequest:(id)request session:(id)session { if (_externalUserAgentFlowInProgress) { @@ -89,6 +100,7 @@ - (BOOL)presentExternalUserAgentRequest:(id)request }]; authenticationVC.presentationContextProvider = self; + authenticationVC.prefersEphemeralWebBrowserSession = _prefersEphemeralSession; _webAuthenticationVC = authenticationVC; openedUserAgent = [authenticationVC start]; diff --git a/Source/AppAuth/iOS/OIDExternalUserAgentIOS.h b/Source/AppAuth/iOS/OIDExternalUserAgentIOS.h index 7261c050d..ae0773c69 100644 --- a/Source/AppAuth/iOS/OIDExternalUserAgentIOS.h +++ b/Source/AppAuth/iOS/OIDExternalUserAgentIOS.h @@ -39,13 +39,29 @@ API_UNAVAILABLE(macCatalyst) "initWithPresentingViewController:presentingViewController"); /*! @brief The designated initializer. - @param presentingViewController The view controller from which to present the - \SFSafariViewController. + @param presentingViewController The view controller from which to present the authentication UI. + @discussion The specific authentication UI used depends on the iOS version and accessibility + options. iOS 8 uses the system browser, iOS 9-10 use @c SFSafariViewController, iOS 11 uses + @c SFAuthenticationSession + (unless Guided Access is on which does not work) or uses @c SFSafariViewController, and iOS + 12+ uses @c ASWebAuthenticationSession (unless Guided Access is on). */ - (nullable instancetype)initWithPresentingViewController: (UIViewController *)presentingViewController NS_DESIGNATED_INITIALIZER; +/*! @brief Create an external user-agent which optionally uses a private authentication session. + @param presentingViewController The view controller from which to present the browser. + @param prefersEphemeralSession Whether the caller prefers to use a private authentication + session. See @c ASWebAuthenticationSession.prefersEphemeralWebBrowserSession for more. + @discussion Authentication is performed with @c ASWebAuthenticationSession (unless Guided Access + is on), setting the ephemerality based on the argument. + */ +- (nullable instancetype)initWithPresentingViewController: + (UIViewController *)presentingViewController + prefersEphemeralSession:(BOOL)prefersEphemeralSession + API_AVAILABLE(ios(13)); + @end NS_ASSUME_NONNULL_END diff --git a/Source/AppAuth/iOS/OIDExternalUserAgentIOS.m b/Source/AppAuth/iOS/OIDExternalUserAgentIOS.m index 728f0868d..eab7aa3cb 100644 --- a/Source/AppAuth/iOS/OIDExternalUserAgentIOS.m +++ b/Source/AppAuth/iOS/OIDExternalUserAgentIOS.m @@ -43,6 +43,7 @@ @interface OIDExternalUserAgentIOS () @implementation OIDExternalUserAgentIOS { UIViewController *_presentingViewController; + BOOL _prefersEphemeralSession; BOOL _externalUserAgentFlowInProgress; __weak id _session; @@ -75,6 +76,16 @@ - (nullable instancetype)initWithPresentingViewController: return self; } +- (nullable instancetype)initWithPresentingViewController: + (UIViewController *)presentingViewController + prefersEphemeralSession:(BOOL)prefersEphemeralSession { + self = [self initWithPresentingViewController:presentingViewController]; + if (self) { + _prefersEphemeralSession = prefersEphemeralSession; + } + return self; +} + - (BOOL)presentExternalUserAgentRequest:(id)request session:(id)session { if (_externalUserAgentFlowInProgress) { @@ -115,7 +126,8 @@ - (BOOL)presentExternalUserAgentRequest:(id)request }]; #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 if (@available(iOS 13.0, *)) { - authenticationVC.presentationContextProvider = self; + authenticationVC.presentationContextProvider = self; + authenticationVC.prefersEphemeralWebBrowserSession = _prefersEphemeralSession; } #endif _webAuthenticationVC = authenticationVC; diff --git a/Source/AppAuth/macOS/OIDAuthState+Mac.h b/Source/AppAuth/macOS/OIDAuthState+Mac.h index debde1318..71e56f22a 100644 --- a/Source/AppAuth/macOS/OIDAuthState+Mac.h +++ b/Source/AppAuth/macOS/OIDAuthState+Mac.h @@ -41,13 +41,37 @@ NS_ASSUME_NONNULL_BEGIN @return A @c OIDExternalUserAgentSession instance which will terminate when it receives a @c OIDExternalUserAgentSession.cancel message, or after processing a @c OIDExternalUserAgentSession.resumeExternalUserAgentFlowWithURL: message. - @discussion This method adopts ASWebAuthenticationSession for macOS 10.15 and above or the default browser otherwise. + @discussion This method adopts @c ASWebAuthenticationSession for macOS 10.15 and above or the + default browser otherwise. */ + (id) authStateByPresentingAuthorizationRequest:(OIDAuthorizationRequest *)authorizationRequest presentingWindow:(NSWindow *)presentingWindow callback:(OIDAuthStateAuthorizationCallback)callback; +/*! @brief Convenience method to create a @c OIDAuthState by presenting an authorization request + (optionally using an emphemeral browser session that shares no cookies or data with the + normal browser session) and performing the authorization code exchange in the case of code + flow requests. For the hybrid flow, the caller should validate the id_token and c_hash, then + perform the token request (@c OIDAuthorizationService.performTokenRequest:callback:) + and update the OIDAuthState with the results using + @c OIDAuthState.updateWithTokenResponse:error:. + @param authorizationRequest The authorization request to present. + @param presentingWindow The window to present the @c ASWebAuthenticationSession UI. + @param prefersEphemeralSession Whether the caller prefers to use a private authentication + session. See @c ASWebAuthenticationSession.prefersEphemeralWebBrowserSession for more. + @param callback The method called when the request has completed or failed. + @return A @c OIDExternalUserAgentSession instance which will terminate when it + receives a @c OIDExternalUserAgentSession.cancel message, or after processing a + @c OIDExternalUserAgentSession.resumeExternalUserAgentFlowWithURL: message. + */ ++ (id) + authStateByPresentingAuthorizationRequest:(OIDAuthorizationRequest *)authorizationRequest + presentingWindow:(NSWindow *)presentingWindow + prefersEphemeralSession:(BOOL)prefersEphemeralSession + callback:(OIDAuthStateAuthorizationCallback)callback + API_AVAILABLE(macos(10.15)); + /*! @param authorizationRequest The authorization request to present. @param callback The method called when the request has completed or failed. @return A @c OIDExternalUserAgentSession instance which will terminate when it diff --git a/Source/AppAuth/macOS/OIDAuthState+Mac.m b/Source/AppAuth/macOS/OIDAuthState+Mac.m index 2796223c1..f2894daaf 100644 --- a/Source/AppAuth/macOS/OIDAuthState+Mac.m +++ b/Source/AppAuth/macOS/OIDAuthState+Mac.m @@ -35,6 +35,18 @@ @implementation OIDAuthState (Mac) externalUserAgent:externalUserAgent callback:callback]; } ++ (id) + authStateByPresentingAuthorizationRequest:(OIDAuthorizationRequest *)authorizationRequest + presentingWindow:(NSWindow *)presentingWindow + prefersEphemeralSession:(BOOL)prefersEphemeralSession + callback:(OIDAuthStateAuthorizationCallback)callback { + OIDExternalUserAgentMac *externalUserAgent = + [[OIDExternalUserAgentMac alloc] initWithPresentingWindow:presentingWindow + prefersEphemeralSession:prefersEphemeralSession]; + return [self authStateByPresentingAuthorizationRequest:authorizationRequest + externalUserAgent:externalUserAgent + callback:callback]; +} + (id) authStateByPresentingAuthorizationRequest:(OIDAuthorizationRequest *)authorizationRequest diff --git a/Source/AppAuth/macOS/OIDAuthorizationService+Mac.h b/Source/AppAuth/macOS/OIDAuthorizationService+Mac.h index ec3c9c890..0a34faf28 100644 --- a/Source/AppAuth/macOS/OIDAuthorizationService+Mac.h +++ b/Source/AppAuth/macOS/OIDAuthorizationService+Mac.h @@ -36,12 +36,30 @@ NS_ASSUME_NONNULL_BEGIN @return A @c OIDExternalUserAgentSession instance which will terminate when it receives a @c OIDExternalUserAgentSession.cancel message, or after processing a @c OIDExternalUserAgentSession.resumeExternalUserAgentFlowWithURL: message. - @discussion This method adopts ASWebAuthenticationSession for macOS 10.15 and above or the default browser otherwise. + @discussion This method adopts @c ASWebAuthenticationSession for macOS 10.15 and above or the + default browser otherwise. */ + (id) presentAuthorizationRequest:(OIDAuthorizationRequest *)request presentingWindow:(NSWindow *)presentingWindow callback:(OIDAuthorizationCallback)callback; +/*! @brief Perform an authorization flow using the @c ASWebAuthenticationSession optionally using an + emphemeral browser session that shares no cookies or data with the normal browser session. + @param request The authorization request. + @param presentingWindow The window to present the authentication flow. + @param prefersEphemeralSession Whether the caller prefers to use a private authentication + session. See @c ASWebAuthenticationSession.prefersEphemeralWebBrowserSession for more. + @param callback The method called when the request has completed or failed. + @return A @c OIDExternalUserAgentSession instance which will terminate when it + receives a @c OIDExternalUserAgentSession.cancel message, or after processing a + @c OIDExternalUserAgentSession.resumeExternalUserAgentFlowWithURL: message. + */ ++ (id) presentAuthorizationRequest:(OIDAuthorizationRequest *)request + presentingWindow:(NSWindow *)presentingWindow + prefersEphemeralSession:(BOOL)prefersEphemeralSession + callback:(OIDAuthorizationCallback)callback + API_AVAILABLE(macos(10.15)); + /*! @brief Perform an authorization flow using the default browser. @param request The authorization request. @param callback The method called when the request has completed or failed. diff --git a/Source/AppAuth/macOS/OIDAuthorizationService+Mac.m b/Source/AppAuth/macOS/OIDAuthorizationService+Mac.m index af93186f9..4d3d9a038 100644 --- a/Source/AppAuth/macOS/OIDAuthorizationService+Mac.m +++ b/Source/AppAuth/macOS/OIDAuthorizationService+Mac.m @@ -37,6 +37,18 @@ @implementation OIDAuthorizationService (Mac) callback:callback]; } ++ (id) presentAuthorizationRequest:(OIDAuthorizationRequest *)request + presentingWindow:(NSWindow *)presentingWindow + prefersEphemeralSession:(BOOL)prefersEphemeralSession + callback:(OIDAuthorizationCallback)callback { + OIDExternalUserAgentMac *externalUserAgent = + [[OIDExternalUserAgentMac alloc] initWithPresentingWindow:presentingWindow + prefersEphemeralSession:prefersEphemeralSession]; + return [self presentAuthorizationRequest:request + externalUserAgent:externalUserAgent + callback:callback]; +} + + (id) presentAuthorizationRequest:(OIDAuthorizationRequest *)request callback:(OIDAuthorizationCallback)callback { OIDExternalUserAgentMac *externalUserAgent = [[OIDExternalUserAgentMac alloc] init]; diff --git a/Source/AppAuth/macOS/OIDExternalUserAgentMac.h b/Source/AppAuth/macOS/OIDExternalUserAgentMac.h index cb864e1cc..360c44ad6 100644 --- a/Source/AppAuth/macOS/OIDExternalUserAgentMac.h +++ b/Source/AppAuth/macOS/OIDExternalUserAgentMac.h @@ -31,10 +31,20 @@ NS_ASSUME_NONNULL_BEGIN @interface OIDExternalUserAgentMac : NSObject /*! @brief The designated initializer. - @param presentingWindow The window from which to present the ASWebAuthenticationSession. + @param presentingWindow The window from which to present the @c ASWebAuthenticationSession on + macOS 10.15 and above. Older macOS versions use the system browser. */ - (instancetype)initWithPresentingWindow:(NSWindow *)presentingWindow NS_DESIGNATED_INITIALIZER; +/*! @brief Create an external user-agent which optionally uses a private authentication session. + @param presentingWindow The window from which to present the @c ASWebAuthenticationSession. + @param prefersEphemeralSession Whether the caller prefers to use a private authentication + session. See @c ASWebAuthenticationSession.prefersEphemeralWebBrowserSession for more. + */ +- (nullable instancetype)initWithPresentingWindow:(NSWindow *)presentingWindow + prefersEphemeralSession:(BOOL)prefersEphemeralSession + API_AVAILABLE(macos(10.15)); + - (instancetype)init __deprecated_msg("Use initWithPresentingWindow for macOS 10.15 and above."); @end diff --git a/Source/AppAuth/macOS/OIDExternalUserAgentMac.m b/Source/AppAuth/macOS/OIDExternalUserAgentMac.m index 301a24af7..d1e08f902 100644 --- a/Source/AppAuth/macOS/OIDExternalUserAgentMac.m +++ b/Source/AppAuth/macOS/OIDExternalUserAgentMac.m @@ -38,6 +38,7 @@ @interface OIDExternalUserAgentMac () _session; + BOOL _prefersEphemeralSession; NSWindow *_presentingWindow; #pragma clang diagnostic push @@ -54,6 +55,15 @@ - (instancetype)initWithPresentingWindow:(NSWindow *)presentingWindow { return self; } +- (nullable instancetype)initWithPresentingWindow:(NSWindow *)presentingWindow + prefersEphemeralSession:(BOOL)prefersEphemeralSession { + self = [self initWithPresentingWindow:presentingWindow]; + if (self) { + _prefersEphemeralSession = prefersEphemeralSession; + } + return self; +} + - (instancetype)init { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wnonnull" @@ -100,6 +110,7 @@ - (BOOL)presentExternalUserAgentRequest:(id)request authenticationSession.presentationContextProvider = self; _webAuthenticationSession = authenticationSession; + _webAuthenticationSession.prefersEphemeralWebBrowserSession = _prefersEphemeralSession; return [authenticationSession start]; } } From d35a616cdb4139314395c7dc00e210b1989d9a5f Mon Sep 17 00:00:00 2001 From: Yinli ZHU Date: Fri, 9 Sep 2022 21:03:21 +0200 Subject: [PATCH 52/81] Update OIDServiceConfiguration.m (#656) Fix for Unarchive with unarchivedObjectOfClass:fromData:error: --- Source/AppAuthCore/OIDServiceConfiguration.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/AppAuthCore/OIDServiceConfiguration.m b/Source/AppAuthCore/OIDServiceConfiguration.m index a5aa43e7a..2cffbf73a 100644 --- a/Source/AppAuthCore/OIDServiceConfiguration.m +++ b/Source/AppAuthCore/OIDServiceConfiguration.m @@ -185,7 +185,7 @@ - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder { return nil; } - OIDServiceDiscovery *discoveryDocument = [aDecoder decodeObjectOfClass:[OIDServiceDiscovery class] + OIDServiceDiscovery *discoveryDocument = [aDecoder decodeObjectOfClasses:[NSSet setWithObjects:[OIDServiceDiscovery class], [NSArray class], nil] forKey:kDiscoveryDocumentKey]; return [self initWithAuthorizationEndpoint:authorizationEndpoint From c6879807e503b3154c07d03eb0e14372e0b7e8e6 Mon Sep 17 00:00:00 2001 From: Peter Andrews Date: Fri, 9 Sep 2022 15:41:11 -0700 Subject: [PATCH 53/81] Correct OIDServiceDiscovery's NSCoding implementation (#721) * Improve NSCoding implementation. * Test new and old encodings. * Ensure that we're handling the old encoding without errors. * No need to supply an empty failure string. * Provide forward compatibility. --- Source/AppAuthCore/OIDServiceConfiguration.m | 13 +- Source/AppAuthCore/OIDServiceDiscovery.m | 28 +++- UnitTests/OIDServiceDiscoveryTests.m | 131 ++++++++++++++++++- 3 files changed, 165 insertions(+), 7 deletions(-) diff --git a/Source/AppAuthCore/OIDServiceConfiguration.m b/Source/AppAuthCore/OIDServiceConfiguration.m index 2cffbf73a..0e5c1197a 100644 --- a/Source/AppAuthCore/OIDServiceConfiguration.m +++ b/Source/AppAuthCore/OIDServiceConfiguration.m @@ -185,8 +185,17 @@ - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder { return nil; } - OIDServiceDiscovery *discoveryDocument = [aDecoder decodeObjectOfClasses:[NSSet setWithObjects:[OIDServiceDiscovery class], [NSArray class], nil] - forKey:kDiscoveryDocumentKey]; + NSSet *allowedClasses = [NSSet setWithArray:@[[OIDServiceDiscovery class], + // The following classes are required in + // order to support secure decoding of the + // old OIDServiceDiscovery encoding. + [NSDictionary class], + [NSArray class], + [NSString class], + [NSNumber class], + [NSNull class]]]; + OIDServiceDiscovery *discoveryDocument = [aDecoder decodeObjectOfClasses:allowedClasses + forKey:kDiscoveryDocumentKey]; return [self initWithAuthorizationEndpoint:authorizationEndpoint tokenEndpoint:tokenEndpoint diff --git a/Source/AppAuthCore/OIDServiceDiscovery.m b/Source/AppAuthCore/OIDServiceDiscovery.m index 739275251..4d96f9db3 100644 --- a/Source/AppAuthCore/OIDServiceDiscovery.m +++ b/Source/AppAuthCore/OIDServiceDiscovery.m @@ -23,6 +23,10 @@ NS_ASSUME_NONNULL_BEGIN +/*! @brief The key for the @c discoveryDictionary property. + */ +static NSString *const kDiscoveryDictionaryKey = @"discoveryDictionary"; + /*! Field keys associated with an OpenID Connect Discovery Document. */ static NSString *const kIssuerKey = @"issuer"; static NSString *const kAuthorizationEndpointKey = @"authorization_endpoint"; @@ -192,7 +196,27 @@ + (BOOL)supportsSecureCoding { - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder { NSError *error; - NSDictionary *dictionary = [[NSDictionary alloc] initWithCoder:aDecoder]; + NSDictionary *dictionary; + if ([aDecoder containsValueForKey:kDiscoveryDictionaryKey]) { + // We're decoding a collection type (NSDictionary) from NSJSONSerialization's + // +JSONObjectWithData, so we need to include all classes that could potentially be contained + // within. + NSSet *allowedClasses = [NSSet setWithArray:@[[NSDictionary class], + [NSArray class], + [NSString class], + [NSNumber class], + [NSNull class]]]; + dictionary = [aDecoder decodeObjectOfClasses:allowedClasses + forKey:kDiscoveryDictionaryKey]; + } else { + // Decode using the old encoding which delegated to NSDictionary's encodeWithCoder: + // implementation: + // + // - (void)encodeWithCoder:(NSCoder *)aCoder { + // [_discoveryDictionary encodeWithCoder:aCoder]; + // } + dictionary = [[NSDictionary alloc] initWithCoder:aDecoder]; + } self = [self initWithDictionary:dictionary error:&error]; if (error) { return nil; @@ -201,6 +225,8 @@ - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder { } - (void)encodeWithCoder:(NSCoder *)aCoder { + [aCoder encodeObject:_discoveryDictionary forKey:kDiscoveryDictionaryKey]; + // Provide forward compatibilty by continuing to add the old encoding. [_discoveryDictionary encodeWithCoder:aCoder]; } diff --git a/UnitTests/OIDServiceDiscoveryTests.m b/UnitTests/OIDServiceDiscoveryTests.m index 17d6cd19e..6329feab3 100644 --- a/UnitTests/OIDServiceDiscoveryTests.m +++ b/UnitTests/OIDServiceDiscoveryTests.m @@ -30,6 +30,42 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wgnu" +// Define a subclass of @c OIDServiceDiscovery that provides the old NSCoding decoding +// implementation. +@interface OIDServiceDiscoveryOldDecoding : OIDServiceDiscovery +@end + +@implementation OIDServiceDiscoveryOldDecoding + ++ (BOOL)supportsSecureCoding { + return YES; +} + +- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder { + NSError *error; + NSDictionary *dictionary = [[NSDictionary alloc] initWithCoder:aDecoder]; + self = [self initWithDictionary:dictionary error:&error]; + if (error) { + return nil; + } + return self; +} + +@end + +// Define a subclass of @c OIDServiceDiscovery that provides the old NSCoding encoding +// implementation. +@interface OIDServiceDiscoveryOldEncoding : OIDServiceDiscovery +@end + +@implementation OIDServiceDiscoveryOldEncoding + +- (void)encodeWithCoder:(NSCoder *)coder { + [self.discoveryDictionary encodeWithCoder:coder]; +} + +@end + /*! Testing URL used when testing URL conversions. */ static NSString *const kTestURL = @"http://www.google.com/"; @@ -110,7 +146,7 @@ + (NSDictionary *)completeServiceDiscoveryDictionary { kJWKSURLKey : @"http://www.example.com/jwks", kRegistrationEndpointKey : @"Registration Endpoint", kEndSessionEndpointKey : @"https://www.example.com/logout", - kScopesSupportedKey : @"Scopes Supported", + kScopesSupportedKey : @[ @"scope1", @"scope2" ], kResponseTypesSupportedKey : @"Response Types Supported", kResponseModesSupportedKey : @"Response Modes Supported", kGrantTypesSupportedKey : @"Grant Types Supported", @@ -411,10 +447,97 @@ - (void)testSecureCoding { OIDServiceDiscovery *discovery = [[OIDServiceDiscovery alloc] initWithDictionary:serviceDiscoveryDictionary error:&error]; - NSData *data = [NSKeyedArchiver archivedDataWithRootObject:discovery]; - OIDServiceDiscovery *unarchived = [NSKeyedUnarchiver unarchiveObjectWithData:data]; + NSData *data; + if (@available(iOS 11.0, macOS 10.13, tvOS 11.0, watchOS 4.0, *)) { + data = [NSKeyedArchiver archivedDataWithRootObject:discovery + requiringSecureCoding:YES + error:&error]; + } else { + data = [NSKeyedArchiver archivedDataWithRootObject:discovery]; + } + + OIDServiceDiscovery *unarchived; + if (@available(iOS 11.0, macOS 10.13, tvOS 11.0, watchOS 4.0, *)) { + unarchived = [NSKeyedUnarchiver unarchivedObjectOfClass:[OIDServiceDiscovery class] + fromData:data + error:&error]; + } else { + unarchived = [NSKeyedUnarchiver unarchiveObjectWithData:data]; + } + + XCTAssertEqualObjects(discovery.discoveryDictionary, unarchived.discoveryDictionary); +} - XCTAssertEqualObjects(discovery.discoveryDictionary, unarchived.discoveryDictionary, @""); +/*! @brief To ensure backward compatibility, test our ability to decode the old encoding of + @c OIDServiceDiscovery. + */ +- (void)testSecureCodingDecodeOld { + NSError *error; + NSDictionary *serviceDiscoveryDictionary = [[self class] completeServiceDiscoveryDictionary]; + OIDServiceDiscoveryOldEncoding *discovery = + [[OIDServiceDiscoveryOldEncoding alloc] initWithDictionary:serviceDiscoveryDictionary + error:&error]; + NSData *data; + if (@available(iOS 11.0, macOS 10.13, tvOS 11.0, watchOS 4.0, *)) { + data = [NSKeyedArchiver archivedDataWithRootObject:discovery + requiringSecureCoding:YES + error:&error]; + } else { + data = [NSKeyedArchiver archivedDataWithRootObject:discovery]; + } + + OIDServiceDiscovery *unarchived; + if (@available(iOS 11.0, macOS 10.13, tvOS 11.0, watchOS 4.0, *)) { + NSSet *allowedClasses = [NSSet setWithArray:@[[OIDServiceDiscovery class], + [NSDictionary class], + [NSArray class], + [NSString class], + [NSNumber class], + [NSNull class]]]; + unarchived = [NSKeyedUnarchiver unarchivedObjectOfClasses:allowedClasses + fromData:data + error:&error]; + } else { + unarchived = [NSKeyedUnarchiver unarchiveObjectWithData:data]; + } + + XCTAssertEqualObjects(discovery.discoveryDictionary, unarchived.discoveryDictionary); +} + +/*! @brief To ensure forward compatibility, test the ability of the old implementation to decode + the new encoding of @c OIDServiceDiscovery. + */ +- (void)testSecureCodingOldDecodeNew { + NSError *error; + NSDictionary *serviceDiscoveryDictionary = [[self class] completeServiceDiscoveryDictionary]; + OIDServiceDiscoveryOldDecoding *discovery = + [[OIDServiceDiscoveryOldDecoding alloc] initWithDictionary:serviceDiscoveryDictionary + error:&error]; + NSData *data; + if (@available(iOS 11.0, macOS 10.13, tvOS 11.0, watchOS 4.0, *)) { + data = [NSKeyedArchiver archivedDataWithRootObject:discovery + requiringSecureCoding:YES + error:&error]; + } else { + data = [NSKeyedArchiver archivedDataWithRootObject:discovery]; + } + + OIDServiceDiscovery *unarchived; + if (@available(iOS 11.0, macOS 10.13, tvOS 11.0, watchOS 4.0, *)) { + NSSet *allowedClasses = [NSSet setWithArray:@[[OIDServiceDiscoveryOldDecoding class], + [NSDictionary class], + [NSArray class], + [NSString class], + [NSNumber class], + [NSNull class]]]; + unarchived = [NSKeyedUnarchiver unarchivedObjectOfClasses:allowedClasses + fromData:data + error:&error]; + } else { + unarchived = [NSKeyedUnarchiver unarchiveObjectWithData:data]; + } + XCTAssertNil(error); + XCTAssertEqualObjects(discovery.discoveryDictionary, unarchived.discoveryDictionary); } /*! @brief Tests the NSCopying implementation by round-tripping an instance through the copying From 3d36a58a2b736f7bc499453e996a704929b25080 Mon Sep 17 00:00:00 2001 From: Peter Andrews Date: Mon, 12 Sep 2022 11:03:22 -0700 Subject: [PATCH 54/81] Prep for 1.6.0 release (#722) * Reformat changelog. * Update changelog for 1.6.0 release. * Bump the podspec version for the 1.6.0 release. --- AppAuth.podspec | 2 +- CHANGELOG.md | 70 +++++++++++++++++++++++++------------------------ 2 files changed, 37 insertions(+), 35 deletions(-) diff --git a/AppAuth.podspec b/AppAuth.podspec index c4b573b05..4aeae48b5 100644 --- a/AppAuth.podspec +++ b/AppAuth.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "AppAuth" - s.version = "1.5.0" + s.version = "1.6.0" s.summary = "AppAuth for iOS and macOS is a client SDK for communicating with OAuth 2.0 and OpenID Connect providers." s.description = <<-DESC diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ac138f0e..5c086f028 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,51 +1,53 @@ -# AppAuth for iOS and macOS Changelog +# 1.6.0 +- Added a `prefersEphemeralSession` parameter for external user-agents. ([#645](https://github.com/openid/AppAuth-iOS/pull/645)) +- Fixed errors encountered when using secure coding to decode `OIDAuthState`. ([#656](https://github.com/openid/AppAuth-iOS/pull/656), [#721](https://github.com/openid/AppAuth-iOS/pull/721)) -## 1.5.0 +# 1.5.0 - Improved tvOS support. ([#111](https://github.com/openid/AppAuth-iOS/issues/111)) - ASWebAuthenticationSession on macOS. ([#675](https://github.com/openid/AppAuth-iOS/pull/675)) -## 1.4.0 +# 1.4.0 -### Added +## Added 1. Support for Swift Package Manager -## 1.3.1 +# 1.3.1 -### Fixes +## Fixes 1. Removed `UIWebView` reference in comment -## 1.3.0 +# 1.3.0 -### Notable Changes +## Notable Changes 1. Support for Mac Catalyst -## 1.2.0 +# 1.2.0 -### Notable Changes +## Notable Changes 1. Support for iOS 13 -## 1.1.0 +# 1.1.0 -### Notable Changes +## Notable Changes 1. [OpenID Connect RP-Initiated Logout](http://openid.net/specs/openid-connect-session-1_0.html#RPLogout) implemented 2. Added logic for the `azp` claim -### Fixes +## Fixes 1. Scheme comparison for redirects is now case insensitive 2. Improved error handling during discovery when a non-JSON document is encountered. -## 1.0.0 +# 1.0.0 1.0.0! 🎉 -### Notable Changes +## Notable Changes 1. **All deprecated APIs removed.** Please ensure your code builds on version 0.95.0 with no deprecation warnings before upgrading! @@ -62,20 +64,20 @@ 4. `AppAuth/Core` subspec, and AppAuthCore Framework added to support iOS extensions. -## 1.0.0.beta2 (2018-09-27) +# 1.0.0.beta2 (2018-09-27) -### Notable Changes +## Notable Changes 1. `AppAuth/Core` subspec, and AppAuthCore Framework added to support iOS extensions. -## 1.0.0.beta1 (2018-09-27) +# 1.0.0.beta1 (2018-09-27) First 1.0.0 beta! HEAD is now tracking changes for the 1.0.0 release. The `pre-1.0` branch was cut prior to the breaking changes for 1.0.0, bug fixes for critical issues may be backported for a time. -### Notable Changes +## Notable Changes 1. **All deprecated APIs removed.** Please ensure your code builds on version 0.95.0 with no deprecation warnings before upgrading! @@ -90,13 +92,13 @@ bug fixes for critical issues may be backported for a time. 3. macOS 32-bit support removed. If you need this support, stay on the pre-1.0 releases. -### Fixes +## Fixes 1. All fixes in the 0.95.0 release are incorporated in this release. -## 0.95.0 (2018-09-27) +# 0.95.0 (2018-09-27) -### Fixes +## Fixes 1. `x-www-form-urlencoded` encoding and decoding should be 100% spec compliant now, previously the `+` character was not decoded as @@ -105,19 +107,19 @@ bug fixes for critical issues may be backported for a time. 2. `scope` no longer sent during token refresh (was redundant) https://github.com/openid/AppAuth-iOS/pull/301 -## 0.94.0 (2018-07-13) +# 0.94.0 (2018-07-13) -### Fixes +## Fixes 1. `form-urlencode` client ID and client secret in Authorization header -### Added +## Added 1. Samples have icons now! 2. Output trace logs by defining `_APPAUTHTRACE` -## 0.93.0 (2018-06-26) +# 0.93.0 (2018-06-26) -### Notable Changes +## Notable Changes 1. Implements OpenID Connect (ID Token handling) and the OpenID Connect RP Certification test suite. @@ -142,7 +144,7 @@ bug fixes for critical issues may be backported for a time. https://github.com/openid/AppAuth-iOS/issues/200 https://github.com/openid/AppAuth-iOS/pull/201 -### Upgrading to 0.93.0 +## Upgrading to 0.93.0 0.93.0 deprecates several methods. To update your code to avoid the deprecated methods (which will be required for the 1.0.0 release), @@ -156,7 +158,7 @@ for the new methods to use in those cases. Most users who are using the convenience methods of AppAuth will only need to make the following 3 minor changes to their AppDelegate: -#### Import: +### Import: Change ```objc @@ -167,7 +169,7 @@ to @protocol OIDExternalUserAgentSession; ``` -#### Property: +### Property: Change ```objc @@ -178,7 +180,7 @@ to @property(nonatomic, strong, nullable) idcurrentAuthorizationFlow; ``` -#### Implementation of `-(BOOL)application:openURL:options:` +### Implementation of `-(BOOL)application:openURL:options:` Change ```objc if ([_currentAuthorizationFlow resumeAuthorizationFlowWithURL:url]) { @@ -192,14 +194,14 @@ See also the changes made to the sample which you can copy: https://github.com/openid/AppAuth-iOS/commit/619bb7c7d5f83cc2ed19380d425ca8afa279644c?diff=unified -## 0.92.0 (2018-01-05) +# 0.92.0 (2018-01-05) -### Improvements +## Improvements 1. Added an official Swift sample, and included Swift testing in the continuous integration tests. -## Pre 0.92.0 +# Pre 0.92.0 No changelog entries exist for changes prior to 2018, please review the [git history](https://github.com/openid/AppAuth-iOS/commits/0.91.0). From 74239430b5219ba502d34349288cd27db010eca2 Mon Sep 17 00:00:00 2001 From: Peter Andrews Date: Tue, 13 Sep 2022 13:05:29 -0700 Subject: [PATCH 55/81] Update issue templates (#723) * Update feature_request.md * Update bug_report.md * Update feature_request.md * Update bug_report.md * Update feature_request.md --- .github/ISSUE_TEMPLATE/bug_report.md | 13 ++++++------- .github/ISSUE_TEMPLATE/feature_request.md | 15 +++++++-------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 107a71184..4603ea210 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,10 +1,9 @@ --- -name: Bug report -about: Create a bug report to help us improve -title: '' -labels: '' -assignees: '' - +name: Bug Report +about: Submit a bug report if something isn't working as expected. +title: "" +labels: bug, triage +assignees: "" --- **Describe the bug** @@ -13,7 +12,7 @@ A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. Go to '...' -2. Click on '....' +2. Tap on '....' 3. Scroll down to '....' 4. See error diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index bbcbbe7d6..4b77f985d 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,14 +1,13 @@ --- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - +name: Feature Request +about: Make a feature request if you have a suggestion for something new. +title: "" +labels: enhancement, triage +assignees: "" --- -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] +**Is your feature request related to a problem you're having? Please describe.** +A clear and concise description of what the problem is. Such as: "I'm always frustrated when ..." **Describe the solution you'd like** A clear and concise description of what you want to happen. From f4360e0b636f94379d9a17a004e743846f3e82e3 Mon Sep 17 00:00:00 2001 From: Peter Andrews Date: Thu, 15 Sep 2022 13:06:43 -0700 Subject: [PATCH 56/81] Update feature_request.md (#724) --- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 4b77f985d..ab9e65fef 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -7,7 +7,7 @@ assignees: "" --- **Is your feature request related to a problem you're having? Please describe.** -A clear and concise description of what the problem is. Such as: "I'm always frustrated when ..." +A clear and concise description of what the problem is. **Describe the solution you'd like** A clear and concise description of what you want to happen. From ec85862bd118c04c6b247b6987da02a6b4f5742d Mon Sep 17 00:00:00 2001 From: Peter Andrews Date: Tue, 20 Sep 2022 11:56:19 -0700 Subject: [PATCH 57/81] Create config.yml (#725) --- .github/ISSUE_TEMPLATE/config.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..3ba13e0ce --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false From b46216ab5c7a71634034cad03fc2ffe1b75005bf Mon Sep 17 00:00:00 2001 From: Peter Andrews Date: Wed, 19 Oct 2022 13:24:56 -0700 Subject: [PATCH 58/81] Update ObjC style guide link. --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d4fe7b6fc..b319f9ddf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,7 +48,7 @@ discussing your proposal, or email the ## Coding Standards The AppAuth library follows the -[Google Objective-C Style Guide](https://github.com/google/styleguide/blob/gh-pages/objcguide.md). Please review your own code for adherence to the +[Google Objective-C Style Guide](https://google.github.io/styleguide/objcguide.html). Please review your own code for adherence to the standard. ## Pull Request Reviews From caba19437351238c42c30dee00a260e9bfb865ec Mon Sep 17 00:00:00 2001 From: Peter Andrews Date: Thu, 12 Jan 2023 15:43:00 -0800 Subject: [PATCH 59/81] Use the macos-11 runner (#745) --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 166a260f7..5af5220f3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,7 +12,7 @@ on: jobs: xcode-project-test: - runs-on: macOS-latest + runs-on: macos-11 strategy: matrix: flags: [ @@ -32,7 +32,7 @@ jobs: ${{ matrix.flags }} pod-lib-lint: - runs-on: macOS-latest + runs-on: macos-11 strategy: matrix: flags: [ @@ -50,7 +50,7 @@ jobs: run: pod lib lint --verbose ${{ matrix.flags }} spm-build-test: - runs-on: macOS-latest + runs-on: macos-11 steps: - uses: actions/checkout@v2 - name: Build unit test target From ecc52c58742f0eeffa56f627378154b9b6181535 Mon Sep 17 00:00:00 2001 From: mdmathias Date: Fri, 7 Apr 2023 13:35:25 -0700 Subject: [PATCH 60/81] Bump iOS minimum version in podspec to support Xcode 14.3 (#761) --- AppAuth.podspec | 10 ++++++---- Package.swift | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/AppAuth.podspec b/AppAuth.podspec index 4aeae48b5..f023a4fa3 100644 --- a/AppAuth.podspec +++ b/AppAuth.podspec @@ -31,8 +31,10 @@ It follows the OAuth 2.0 for Native Apps best current practice # classes of AppAuth with tokens on watchOS and tvOS, but currently the # library won't help you obtain authorization grants on those platforms. - s.ios.deployment_target = "7.0" - s.osx.deployment_target = "10.9" + ios_deployment_target = "9.0" + osx_deployment_target = "10.12" + s.ios.deployment_target = ios_deployment_target + s.osx.deployment_target = osx_deployment_target s.watchos.deployment_target = "2.0" s.tvos.deployment_target = "9.0" @@ -52,13 +54,13 @@ It follows the OAuth 2.0 for Native Apps best current practice # iOS externalUserAgent.ios.source_files = "Source/AppAuth/iOS/**/*.{h,m}" - externalUserAgent.ios.deployment_target = "7.0" + externalUserAgent.ios.deployment_target = ios_deployment_target externalUserAgent.ios.frameworks = "SafariServices" externalUserAgent.ios.weak_frameworks = "AuthenticationServices" # macOS externalUserAgent.osx.source_files = "Source/AppAuth/macOS/**/*.{h,m}" - externalUserAgent.osx.deployment_target = '10.9' + externalUserAgent.osx.deployment_target = osx_deployment_target externalUserAgent.osx.weak_frameworks = "AuthenticationServices" end diff --git a/Package.swift b/Package.swift index b031680df..ae72258ac 100644 --- a/Package.swift +++ b/Package.swift @@ -23,7 +23,7 @@ import PackageDescription let package = Package( name: "AppAuth", platforms: [ - .macOS(.v10_10), + .macOS(.v10_12), .iOS(.v9), .tvOS(.v9), .watchOS(.v2) From 0eadcdec4ddb121865f3d66917549194afce1f2b Mon Sep 17 00:00:00 2001 From: mdmathias Date: Fri, 7 Apr 2023 15:13:50 -0700 Subject: [PATCH 61/81] Update podspec version and added description to changelog (#763) --- AppAuth.podspec | 2 +- CHANGELOG.md | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/AppAuth.podspec b/AppAuth.podspec index f023a4fa3..30ef456ea 100644 --- a/AppAuth.podspec +++ b/AppAuth.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "AppAuth" - s.version = "1.6.0" + s.version = "1.6.1" s.summary = "AppAuth for iOS and macOS is a client SDK for communicating with OAuth 2.0 and OpenID Connect providers." s.description = <<-DESC diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c086f028..49752c55f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 1.6.1 +- Increased minimum iOS and macOS versions to fix [build issue](https://github.com/openid/AppAuth-iOS/pull/761) + # 1.6.0 - Added a `prefersEphemeralSession` parameter for external user-agents. ([#645](https://github.com/openid/AppAuth-iOS/pull/645)) - Fixed errors encountered when using secure coding to decode `OIDAuthState`. ([#656](https://github.com/openid/AppAuth-iOS/pull/656), [#721](https://github.com/openid/AppAuth-iOS/pull/721)) From 0b62e41c224bc7ef9b074aac5970da0c16ab8798 Mon Sep 17 00:00:00 2001 From: mdmathias Date: Wed, 19 Apr 2023 13:39:34 -0700 Subject: [PATCH 62/81] Update to macos-12 runner for workflows (#767) --- .github/workflows/tests.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5af5220f3..523bed57d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,19 +12,19 @@ on: jobs: xcode-project-test: - runs-on: macos-11 + runs-on: macos-12 strategy: matrix: flags: [ - "-scheme AppAuth-iOS -destination 'platform=iOS Simulator,name=iPhone 11,OS=15.2' -sdk 'iphonesimulator15.2'", - "-scheme AppAuth-macOS -destination 'platform=macOS,arch=x86_64' -sdk 'macosx12.1'", - "-scheme AppAuth_macOS -destination 'platform=macOS,arch=x86_64' -sdk 'macosx12.1'", - "-scheme AppAuth-tvOS -destination 'platform=tvOS Simulator,name=Apple TV,OS=15.2' -sdk 'appletvsimulator15.2'", - "-scheme AppAuth_tvOS -destination 'platform=tvOS Simulator,name=Apple TV,OS=15.2' -sdk 'appletvsimulator15.2'", - "-scheme AppAuthTV -destination 'platform=tvOS Simulator,name=Apple TV,OS=15.2' -sdk 'appletvsimulator15.2'" + "-scheme AppAuth-iOS -destination 'platform=iOS Simulator,name=iPhone 11,OS=16.2' -sdk 'iphonesimulator16.2'", + "-scheme AppAuth-macOS -destination 'platform=macOS,arch=x86_64' -sdk 'macosx13.1'", + "-scheme AppAuth_macOS -destination 'platform=macOS,arch=x86_64' -sdk 'macosx13.1'", + "-scheme AppAuth-tvOS -destination 'platform=tvOS Simulator,name=Apple TV,OS=16.1' -sdk 'appletvsimulator16.1'", + "-scheme AppAuth_tvOS -destination 'platform=tvOS Simulator,name=Apple TV,OS=16.1' -sdk 'appletvsimulator16.1'", + "-scheme AppAuthTV -destination 'platform=tvOS Simulator,name=Apple TV,OS=16.1' -sdk 'appletvsimulator16.1'" ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Run unit test targets run: | xcodebuild test \ @@ -32,7 +32,7 @@ jobs: ${{ matrix.flags }} pod-lib-lint: - runs-on: macos-11 + runs-on: macos-12 strategy: matrix: flags: [ @@ -41,7 +41,7 @@ jobs: '--use-static-frameworks' ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Update Bundler run: bundle update --bundler - name: Install Ruby gems with Bundler From 5ea841fcf9a2bf2f0f0dd6d677a585ac731b2949 Mon Sep 17 00:00:00 2001 From: mdmathias Date: Wed, 19 Apr 2023 16:19:57 -0700 Subject: [PATCH 63/81] Update framework minimum OS versions (#766) --- AppAuth.xcodeproj/project.pbxproj | 44 +++++++++++++++++-------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/AppAuth.xcodeproj/project.pbxproj b/AppAuth.xcodeproj/project.pbxproj index 1a945644d..08e6f28a1 100644 --- a/AppAuth.xcodeproj/project.pbxproj +++ b/AppAuth.xcodeproj/project.pbxproj @@ -2615,7 +2615,7 @@ PRODUCT_BUNDLE_IDENTIFIER = net.openid.AppAuthTVTests; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 10.1; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; }; @@ -2630,7 +2630,7 @@ PRODUCT_BUNDLE_IDENTIFIER = net.openid.AppAuthTVTests; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 10.1; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Release; }; @@ -2778,11 +2778,13 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.12; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; + TVOS_DEPLOYMENT_TARGET = 9.0; WARNING_CFLAGS = "-Wno-gnu"; + WATCHOS_DEPLOYMENT_TARGET = 2.0; }; name = Debug; }; @@ -2834,12 +2836,14 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.12; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; WARNING_CFLAGS = "-Wno-gnu"; + WATCHOS_DEPLOYMENT_TARGET = 2.0; }; name = Release; }; @@ -2935,7 +2939,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "net.openid.AppAuth-tvOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 10.1; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; }; @@ -2950,7 +2954,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "net.openid.AppAuth-tvOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 10.1; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Release; }; @@ -2964,7 +2968,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; SKIP_INSTALL = YES; - TVOS_DEPLOYMENT_TARGET = 10.1; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; }; @@ -2978,7 +2982,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; SKIP_INSTALL = YES; - TVOS_DEPLOYMENT_TARGET = 10.1; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Release; }; @@ -2996,7 +3000,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Source/CoreFramework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = net.openid.AppAuthCore; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -3022,7 +3026,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Source/CoreFramework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = net.openid.AppAuthCore; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -3047,7 +3051,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Source/Framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "net.openid.AppAuth-iOS"; PRODUCT_NAME = AppAuth; @@ -3072,7 +3076,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Source/Framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "net.openid.AppAuth-iOS"; PRODUCT_NAME = AppAuth; @@ -3091,7 +3095,7 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; HEADER_SEARCH_PATHS = .; INFOPLIST_FILE = UnitTests/UnitTestsInfo.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "net.openid.AppAuth-iOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -3105,7 +3109,7 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; HEADER_SEARCH_PATHS = .; INFOPLIST_FILE = UnitTests/UnitTestsInfo.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "net.openid.AppAuth-iOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -3225,7 +3229,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "net.openid.AppAuth-tvOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 10.1; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; }; @@ -3240,7 +3244,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "net.openid.AppAuth-tvOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 10.1; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Release; }; @@ -3335,7 +3339,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = watchos; SKIP_INSTALL = YES; - WATCHOS_DEPLOYMENT_TARGET = 3.1; + WATCHOS_DEPLOYMENT_TARGET = 2.0; }; name = Debug; }; @@ -3348,7 +3352,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = watchos; SKIP_INSTALL = YES; - WATCHOS_DEPLOYMENT_TARGET = 3.1; + WATCHOS_DEPLOYMENT_TARGET = 2.0; }; name = Release; }; @@ -3359,7 +3363,7 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; HEADER_SEARCH_PATHS = .; INFOPLIST_FILE = UnitTests/UnitTestsInfo.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "net.openid.AppAuth-ExtensionTests"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -3373,7 +3377,7 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; HEADER_SEARCH_PATHS = .; INFOPLIST_FILE = UnitTests/UnitTestsInfo.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "net.openid.AppAuth-ExtensionTests"; PRODUCT_NAME = "$(TARGET_NAME)"; From 71cde449f13d453227e687458144bde372d30fc7 Mon Sep 17 00:00:00 2001 From: mdmathias Date: Fri, 28 Apr 2023 10:27:10 -0700 Subject: [PATCH 64/81] Bump podspec to 1.6.2 and add entry to Changelog (#769) --- AppAuth.podspec | 2 +- CHANGELOG.md | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/AppAuth.podspec b/AppAuth.podspec index 30ef456ea..b175e6282 100644 --- a/AppAuth.podspec +++ b/AppAuth.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "AppAuth" - s.version = "1.6.1" + s.version = "1.6.2" s.summary = "AppAuth for iOS and macOS is a client SDK for communicating with OAuth 2.0 and OpenID Connect providers." s.description = <<-DESC diff --git a/CHANGELOG.md b/CHANGELOG.md index 49752c55f..b682c8a8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 1.6.2 +- Increased minimum iOS and macOS versions to 9.0 and 10.12 respectively to fix [framework build issue](https://github.com/openid/AppAuth-iOS/issues/765) + # 1.6.1 - Increased minimum iOS and macOS versions to fix [build issue](https://github.com/openid/AppAuth-iOS/pull/761) From 36c1df0c70324bc3a41ef96f9bb568670cc366d0 Mon Sep 17 00:00:00 2001 From: Vitalij Dadaschjanz Date: Mon, 26 Jun 2023 19:39:09 +0200 Subject: [PATCH 65/81] introduce addtional http headers to OIDTokenRequest (#770) Co-authored-by: Vitalij Dadaschjanz --- .../Source/AppAuthExampleViewController.m | 3 +- .../Source/AppAuthExampleViewController.m | 3 +- .../Source/AppAuthExampleViewController.swift | 3 +- .../AppAuthTVExampleViewController.m | 3 +- README.md | 3 +- Source/AppAuthCore/OIDAuthState.h | 31 +++++++++++ Source/AppAuthCore/OIDAuthState.m | 51 +++++++++++++++--- Source/AppAuthCore/OIDAuthorizationResponse.h | 4 +- Source/AppAuthCore/OIDAuthorizationResponse.m | 9 ++-- Source/AppAuthCore/OIDTokenRequest.h | 12 ++++- Source/AppAuthCore/OIDTokenRequest.m | 39 +++++++++++--- Source/AppAuthTV/OIDTVAuthorizationResponse.h | 19 +++++++ Source/AppAuthTV/OIDTVAuthorizationResponse.m | 29 +++++++++- Source/AppAuthTV/OIDTVTokenRequest.h | 13 +++-- Source/AppAuthTV/OIDTVTokenRequest.m | 13 ++++- .../OIDTVAuthorizationResponseTests.h | 6 +-- .../OIDTVAuthorizationResponseTests.m | 20 +++++-- UnitTests/AppAuthTV/OIDTVTokenRequestTests.m | 13 ++++- UnitTests/OIDAuthStateTests.m | 21 ++++++++ UnitTests/OIDTokenRequestTests.m | 54 ++++++++++++++++--- 20 files changed, 303 insertions(+), 46 deletions(-) diff --git a/Examples/Example-iOS_ObjC-Carthage/Source/AppAuthExampleViewController.m b/Examples/Example-iOS_ObjC-Carthage/Source/AppAuthExampleViewController.m index dc76a8c9c..4d58cf9d2 100644 --- a/Examples/Example-iOS_ObjC-Carthage/Source/AppAuthExampleViewController.m +++ b/Examples/Example-iOS_ObjC-Carthage/Source/AppAuthExampleViewController.m @@ -177,7 +177,8 @@ - (void)doClientRegistration:(OIDServiceConfiguration *)configuration grantTypes:nil subjectType:nil tokenEndpointAuthMethod:@"client_secret_post" - additionalParameters:nil]; + additionalParameters:nil + additionalHeaders:nil]; // performs registration request [self logMessage:@"Initiating registration request"]; diff --git a/Examples/Example-iOS_ObjC/Source/AppAuthExampleViewController.m b/Examples/Example-iOS_ObjC/Source/AppAuthExampleViewController.m index 2c3ebe03e..d67c7b73d 100644 --- a/Examples/Example-iOS_ObjC/Source/AppAuthExampleViewController.m +++ b/Examples/Example-iOS_ObjC/Source/AppAuthExampleViewController.m @@ -179,7 +179,8 @@ - (void)doClientRegistration:(OIDServiceConfiguration *)configuration grantTypes:nil subjectType:nil tokenEndpointAuthMethod:@"client_secret_post" - additionalParameters:nil]; + additionalParameters:nil + additionalHeaders:nil]; // performs registration request [self logMessage:@"Initiating registration request"]; diff --git a/Examples/Example-iOS_Swift-Carthage/Source/AppAuthExampleViewController.swift b/Examples/Example-iOS_Swift-Carthage/Source/AppAuthExampleViewController.swift index f70540472..91cf79fa4 100644 --- a/Examples/Example-iOS_Swift-Carthage/Source/AppAuthExampleViewController.swift +++ b/Examples/Example-iOS_Swift-Carthage/Source/AppAuthExampleViewController.swift @@ -349,7 +349,8 @@ extension AppAuthExampleViewController { grantTypes: nil, subjectType: nil, tokenEndpointAuthMethod: "client_secret_post", - additionalParameters: nil) + additionalParameters: nil, + additionalHeaders: nil) // performs registration request self.logMessage("Initiating registration request") diff --git a/Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.m b/Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.m index 3d461619d..e97b0d204 100644 --- a/Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.m +++ b/Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.m @@ -176,7 +176,8 @@ - (void)performAuthorizationWithConfiguration:(OIDTVServiceConfiguration *)confi clientId:kClientID clientSecret:kClientSecret scopes:@[ OIDScopeOpenID, OIDScopeProfile ] - additionalParameters:nil]; + additionalParameters:nil + additionalHeaders:nil]; OIDTVAuthorizationInitialization initBlock = ^(OIDTVAuthorizationResponse *_Nullable response, NSError *_Nullable error) { diff --git a/README.md b/README.md index 78f79959f..53085b3c4 100644 --- a/README.md +++ b/README.md @@ -516,7 +516,8 @@ OIDTVAuthorizationRequest *request = clientId:kClientID clientSecret:kClientSecret scopes:@[ OIDScopeOpenID, OIDScopeProfile ] - additionalParameters:nil]; + additionalParameters:nil + additionalHeaders:nil]; // performs authentication request OIDTVAuthorizationInitialization initBlock = diff --git a/Source/AppAuthCore/OIDAuthState.h b/Source/AppAuthCore/OIDAuthState.h index 68697d2ca..46c78a831 100644 --- a/Source/AppAuthCore/OIDAuthState.h +++ b/Source/AppAuthCore/OIDAuthState.h @@ -48,6 +48,12 @@ typedef void (^OIDAuthStateAction)(NSString *_Nullable accessToken, typedef void (^OIDAuthStateAuthorizationCallback)(OIDAuthState *_Nullable authState, NSError *_Nullable error); +/*! @brief The exception thrown when a developer tries to create a refresh request from an + authorization request with no authorization code. + */ +static NSString *const kRefreshTokenRequestException = + @"Attempted to create a token refresh request from a token response with no refresh token."; + /*! @brief A convenience class that retains the auth state between @c OIDAuthorizationResponse%s and @c OIDTokenResponse%s. */ @@ -267,6 +273,31 @@ typedef void (^OIDAuthStateAuthorizationCallback)(OIDAuthState *_Nullable authSt - (nullable OIDTokenRequest *)tokenRefreshRequestWithAdditionalParameters: (nullable NSDictionary *)additionalParameters; +/*! @brief Creates a token request suitable for refreshing an access token. + @param additionalParameters Additional parameters for the token request. + @param additionalHeaders Additional headers for the token request. + @return A @c OIDTokenRequest suitable for using a refresh token to obtain a new access token. + @discussion After performing the refresh, call @c OIDAuthState.updateWithTokenResponse:error: + to update the authorization state based on the response. Rather than doing the token refresh + yourself, you should use @c OIDAuthState.performActionWithFreshTokens:. + @see https://tools.ietf.org/html/rfc6749#section-1.5 + */ +- (nullable OIDTokenRequest *)tokenRefreshRequestWithAdditionalParameters: + (nullable NSDictionary *)additionalParameters + additionalHeaders: + (nullable NSDictionary *)additionalHeaders; + +/*! @brief Creates a token request suitable for refreshing an access token. + @param additionalHeaders Additional parameters for the token request. + @return A @c OIDTokenRequest suitable for using a refresh token to obtain a new access token. + @discussion After performing the refresh, call @c OIDAuthState.updateWithTokenResponse:error: + to update the authorization state based on the response. Rather than doing the token refresh + yourself, you should use @c OIDAuthState.performActionWithFreshTokens:. + @see https://tools.ietf.org/html/rfc6749#section-1.5 + */ +- (nullable OIDTokenRequest *)tokenRefreshRequestWithAdditionalHeaders: + (nullable NSDictionary *)additionalHeaders; + @end NS_ASSUME_NONNULL_END diff --git a/Source/AppAuthCore/OIDAuthState.m b/Source/AppAuthCore/OIDAuthState.m index fe8a16221..cb5a22a1e 100644 --- a/Source/AppAuthCore/OIDAuthState.m +++ b/Source/AppAuthCore/OIDAuthState.m @@ -55,12 +55,6 @@ */ static NSString *const kAuthorizationErrorKey = @"authorizationError"; -/*! @brief The exception thrown when a developer tries to create a refresh request from an - authorization request with no authorization code. - */ -static NSString *const kRefreshTokenRequestException = - @"Attempted to create a token refresh request from a token response with no refresh token."; - /*! @brief Number of seconds the access token is refreshed before it actually expires. */ static const NSUInteger kExpiryTimeTolerance = 60; @@ -427,7 +421,47 @@ - (OIDTokenRequest *)tokenRefreshRequest { - (OIDTokenRequest *)tokenRefreshRequestWithAdditionalParameters: (NSDictionary *)additionalParameters { - // TODO: Add unit test to confirm exception is thrown when expected + if (!_refreshToken) { + [OIDErrorUtilities raiseException:kRefreshTokenRequestException]; + } + return [[OIDTokenRequest alloc] + initWithConfiguration:_lastAuthorizationResponse.request.configuration + grantType:OIDGrantTypeRefreshToken + authorizationCode:nil + redirectURL:nil + clientID:_lastAuthorizationResponse.request.clientID + clientSecret:_lastAuthorizationResponse.request.clientSecret + scope:nil + refreshToken:_refreshToken + codeVerifier:nil + additionalParameters:additionalParameters + additionalHeaders:nil]; +} + +- (OIDTokenRequest *)tokenRefreshRequestWithAdditionalParameters: + (NSDictionary *)additionalParameters + additionalHeaders: + (NSDictionary *)additionalHeaders { + + if (!_refreshToken) { + [OIDErrorUtilities raiseException:kRefreshTokenRequestException]; + } + return [[OIDTokenRequest alloc] + initWithConfiguration:_lastAuthorizationResponse.request.configuration + grantType:OIDGrantTypeRefreshToken + authorizationCode:nil + redirectURL:nil + clientID:_lastAuthorizationResponse.request.clientID + clientSecret:_lastAuthorizationResponse.request.clientSecret + scope:nil + refreshToken:_refreshToken + codeVerifier:nil + additionalParameters:additionalParameters + additionalHeaders:additionalHeaders]; +} + +- (OIDTokenRequest *)tokenRefreshRequestWithAdditionalHeaders: + (NSDictionary *)additionalHeaders { if (!_refreshToken) { [OIDErrorUtilities raiseException:kRefreshTokenRequestException]; @@ -442,7 +476,8 @@ - (OIDTokenRequest *)tokenRefreshRequestWithAdditionalParameters: scope:nil refreshToken:_refreshToken codeVerifier:nil - additionalParameters:additionalParameters]; + additionalParameters:nil + additionalHeaders:additionalHeaders]; } #pragma mark - Stateful Actions diff --git a/Source/AppAuthCore/OIDAuthorizationResponse.h b/Source/AppAuthCore/OIDAuthorizationResponse.h index e7552fe59..2a10c81f2 100644 --- a/Source/AppAuthCore/OIDAuthorizationResponse.h +++ b/Source/AppAuthCore/OIDAuthorizationResponse.h @@ -121,7 +121,9 @@ NS_ASSUME_NONNULL_BEGIN @see https://tools.ietf.org/html/rfc6749#section-4.1.3 */ - (nullable OIDTokenRequest *)tokenExchangeRequestWithAdditionalParameters: - (nullable NSDictionary *)additionalParameters; + (nullable NSDictionary *)additionalParameters + additionalHeaders: + (nullable NSDictionary *)additionalHeaders; @end diff --git a/Source/AppAuthCore/OIDAuthorizationResponse.m b/Source/AppAuthCore/OIDAuthorizationResponse.m index a8f92c75e..5c998a966 100644 --- a/Source/AppAuthCore/OIDAuthorizationResponse.m +++ b/Source/AppAuthCore/OIDAuthorizationResponse.m @@ -184,11 +184,13 @@ - (NSString *)description { #pragma mark - - (OIDTokenRequest *)tokenExchangeRequest { - return [self tokenExchangeRequestWithAdditionalParameters:nil]; + return [self tokenExchangeRequestWithAdditionalParameters:nil additionalHeaders:nil]; } - (OIDTokenRequest *)tokenExchangeRequestWithAdditionalParameters: - (NSDictionary *)additionalParameters { + (NSDictionary *)additionalParameters + additionalHeaders: + (NSDictionary *)additionalHeaders { // TODO: add a unit test to confirm exception is thrown when expected and the request is created // with the correct parameters. if (!_authorizationCode) { @@ -204,7 +206,8 @@ - (OIDTokenRequest *)tokenExchangeRequestWithAdditionalParameters: scope:nil refreshToken:nil codeVerifier:_request.codeVerifier - additionalParameters:additionalParameters]; + additionalParameters:additionalParameters + additionalHeaders:additionalHeaders]; } @end diff --git a/Source/AppAuthCore/OIDTokenRequest.h b/Source/AppAuthCore/OIDTokenRequest.h index 399294e8c..1d161cd08 100644 --- a/Source/AppAuthCore/OIDTokenRequest.h +++ b/Source/AppAuthCore/OIDTokenRequest.h @@ -95,9 +95,13 @@ NS_ASSUME_NONNULL_BEGIN */ @property(nonatomic, readonly, nullable) NSDictionary *additionalParameters; +/*! @brief The client's additional token request headers. + */ +@property(nonatomic, readonly, nullable) NSDictionary *additionalHeaders; + /*! @internal @brief Unavailable. Please use - initWithConfiguration:grantType:code:redirectURL:clientID:additionalParameters:. + initWithConfiguration:grantType:code:redirectURL:clientID:additionalParameters:additionalHeaders:. */ - (instancetype)init NS_UNAVAILABLE; @@ -113,6 +117,7 @@ NS_ASSUME_NONNULL_BEGIN @param refreshToken The refresh token. @param codeVerifier The PKCE code verifier. @param additionalParameters The client's additional token request parameters. + @param additionalHeaders The client's additional token request headers. */ - (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration grantType:(NSString *)grantType @@ -123,7 +128,8 @@ NS_ASSUME_NONNULL_BEGIN scopes:(nullable NSArray *)scopes refreshToken:(nullable NSString *)refreshToken codeVerifier:(nullable NSString *)codeVerifier - additionalParameters:(nullable NSDictionary *)additionalParameters; + additionalParameters:(nullable NSDictionary *)additionalParameters + additionalHeaders:(nullable NSDictionary *)additionalHeaders; /*! @brief Designated initializer. @param configuration The service's configuration. @@ -139,6 +145,7 @@ NS_ASSUME_NONNULL_BEGIN @param refreshToken The refresh token. @param codeVerifier The PKCE code verifier. @param additionalParameters The client's additional token request parameters. + @param additionalHeaders The client's additional token request headers. */ - (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration grantType:(NSString *)grantType @@ -150,6 +157,7 @@ NS_ASSUME_NONNULL_BEGIN refreshToken:(nullable NSString *)refreshToken codeVerifier:(nullable NSString *)codeVerifier additionalParameters:(nullable NSDictionary *)additionalParameters + additionalHeaders:(nullable NSDictionary *)additionalHeaders NS_DESIGNATED_INITIALIZER; /*! @brief Designated initializer for NSSecureCoding. diff --git a/Source/AppAuthCore/OIDTokenRequest.m b/Source/AppAuthCore/OIDTokenRequest.m index 5ed8a17ef..08b0dafec 100644 --- a/Source/AppAuthCore/OIDTokenRequest.m +++ b/Source/AppAuthCore/OIDTokenRequest.m @@ -67,6 +67,11 @@ */ static NSString *const kAdditionalParametersKey = @"additionalParameters"; +/*! @brief Key used to encode the @c additionalHeaders property for + @c NSSecureCoding + */ +static NSString *const kAdditionalHeadersKey = @"additionalHeaders"; + @implementation OIDTokenRequest - (instancetype)init @@ -80,7 +85,8 @@ - (instancetype)init scope: refreshToken: codeVerifier: - additionalParameters:) + additionalParameters: + additionalHeaders:) ) - (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration @@ -92,7 +98,8 @@ - (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration scopes:(nullable NSArray *)scopes refreshToken:(nullable NSString *)refreshToken codeVerifier:(nullable NSString *)codeVerifier - additionalParameters:(nullable NSDictionary *)additionalParameters { + additionalParameters:(nullable NSDictionary *)additionalParameters + additionalHeaders:(nullable NSDictionary *)additionalHeaders { return [self initWithConfiguration:configuration grantType:grantType authorizationCode:code @@ -102,7 +109,8 @@ - (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration scope:[OIDScopeUtilities scopesWithArray:scopes] refreshToken:refreshToken codeVerifier:(NSString *)codeVerifier - additionalParameters:additionalParameters]; + additionalParameters:additionalParameters + additionalHeaders:additionalHeaders]; } - (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration @@ -114,7 +122,8 @@ - (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration scope:(nullable NSString *)scope refreshToken:(nullable NSString *)refreshToken codeVerifier:(nullable NSString *)codeVerifier - additionalParameters:(nullable NSDictionary *)additionalParameters { + additionalParameters:(nullable NSDictionary *)additionalParameters + additionalHeaders:(nullable NSDictionary *)additionalHeaders { self = [super init]; if (self) { _configuration = [configuration copy]; @@ -128,6 +137,8 @@ - (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration _codeVerifier = [codeVerifier copy]; _additionalParameters = [[NSDictionary alloc] initWithDictionary:additionalParameters copyItems:YES]; + _additionalHeaders = + [[NSDictionary alloc] initWithDictionary:additionalHeaders copyItems:YES]; // Additional validation for the authorization_code grant type if ([_grantType isEqual:OIDGrantTypeAuthorizationCode]) { @@ -174,9 +185,18 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder { [NSDictionary class], [NSString class] ]]; + NSDictionary *additionalParameters = - [aDecoder decodeObjectOfClasses:additionalParameterCodingClasses - forKey:kAdditionalParametersKey]; + [aDecoder decodeObjectOfClasses:additionalParameterCodingClasses forKey:kAdditionalParametersKey]; + + + NSSet *additionalHeaderCodingClasses = [NSSet setWithArray:@[ + [NSDictionary class], + [NSString class] + ]]; + + NSDictionary *additionalHeaders = + [aDecoder decodeObjectOfClasses:additionalHeaderCodingClasses forKey:kAdditionalHeadersKey]; self = [super init]; if (self) { @@ -191,6 +211,8 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder { _codeVerifier = [codeVerifier copy]; _additionalParameters = [[NSDictionary alloc] initWithDictionary:additionalParameters copyItems:YES]; + _additionalHeaders = + [[NSDictionary alloc] initWithDictionary:additionalHeaders copyItems:YES]; } return self; } @@ -206,6 +228,7 @@ - (void)encodeWithCoder:(NSCoder *)aCoder { [aCoder encodeObject:_refreshToken forKey:kRefreshTokenKey]; [aCoder encodeObject:_codeVerifier forKey:kCodeVerifierKey]; [aCoder encodeObject:_additionalParameters forKey:kAdditionalParametersKey]; + [aCoder encodeObject:_additionalHeaders forKey:kAdditionalHeadersKey]; } #pragma mark - NSObject overrides @@ -305,6 +328,10 @@ - (NSURLRequest *)URLRequest { for (id header in httpHeaders) { [URLRequest setValue:httpHeaders[header] forHTTPHeaderField:header]; } + + for (id header in _additionalHeaders) { + [URLRequest setValue:httpHeaders[header] forHTTPHeaderField:header]; + } return URLRequest; } diff --git a/Source/AppAuthTV/OIDTVAuthorizationResponse.h b/Source/AppAuthTV/OIDTVAuthorizationResponse.h index d3bed1e97..c57847c6e 100644 --- a/Source/AppAuthTV/OIDTVAuthorizationResponse.h +++ b/Source/AppAuthTV/OIDTVAuthorizationResponse.h @@ -87,6 +87,25 @@ NS_ASSUME_NONNULL_BEGIN - (nullable OIDTVTokenRequest *)tokenPollRequestWithAdditionalParameters: (nullable NSDictionary *)additionalParameters; +/*! @brief Creates a token request suitable for polling the token endpoint with the @c deviceCode. + @param additionalHeaders Additional headers for the token request. + @return A @c OIDTVTokenRequest suitable for polling the token endpoint. + @see https://tools.ietf.org/html/rfc8628#section-3.4 + */ +- (nullable OIDTVTokenRequest *)tokenPollRequestWithAdditionalHeaders: + (nullable NSDictionary *)additionalHeaders; + +/*! @brief Creates a token request suitable for polling the token endpoint with the @c deviceCode. + @param additionalParameters Additional parameters for the token request. + @param additionalHeaders Additional headers for the token request. + @return A @c OIDTVTokenRequest suitable for polling the token endpoint. + @see https://tools.ietf.org/html/rfc8628#section-3.4 + */ +- (nullable OIDTVTokenRequest *)tokenPollRequestWithAdditionalParameters: + (nullable NSDictionary *)additionalParameters + additionalHeaders: + (nullable NSDictionary *)additionalHeaders; + @end NS_ASSUME_NONNULL_END diff --git a/Source/AppAuthTV/OIDTVAuthorizationResponse.m b/Source/AppAuthTV/OIDTVAuthorizationResponse.m index 71b9e8f04..b45fc85f3 100644 --- a/Source/AppAuthTV/OIDTVAuthorizationResponse.m +++ b/Source/AppAuthTV/OIDTVAuthorizationResponse.m @@ -149,7 +149,7 @@ - (NSString *)description { #pragma mark - - (OIDTVTokenRequest *)tokenPollRequest { - return [self tokenPollRequestWithAdditionalParameters:nil]; + return [self tokenPollRequestWithAdditionalParameters:nil additionalHeaders:nil]; } - (OIDTVTokenRequest *)tokenPollRequestWithAdditionalParameters: @@ -159,7 +159,32 @@ - (OIDTVTokenRequest *)tokenPollRequestWithAdditionalParameters: deviceCode:_deviceCode clientID:self.request.clientID clientSecret:self.request.clientSecret - additionalParameters:additionalParameters]; + additionalParameters:additionalParameters + additionalHeaders:nil]; +} + +- (OIDTVTokenRequest *)tokenPollRequestWithAdditionalHeaders: + (NSDictionary *)additionalHeaders { + return [[OIDTVTokenRequest alloc] + initWithConfiguration:(OIDTVServiceConfiguration *)self.request.configuration + deviceCode:_deviceCode + clientID:self.request.clientID + clientSecret:self.request.clientSecret + additionalParameters:nil + additionalHeaders:additionalHeaders]; +} + +- (OIDTVTokenRequest *)tokenPollRequestWithAdditionalParameters: + (NSDictionary *)additionalParameters + additionalHeaders: + (NSDictionary *)additionalHeaders { + return [[OIDTVTokenRequest alloc] + initWithConfiguration:(OIDTVServiceConfiguration *)self.request.configuration + deviceCode:_deviceCode + clientID:self.request.clientID + clientSecret:self.request.clientSecret + additionalParameters:additionalParameters + additionalHeaders:additionalHeaders]; } @end diff --git a/Source/AppAuthTV/OIDTVTokenRequest.h b/Source/AppAuthTV/OIDTVTokenRequest.h index 5a81c7434..021dc9b9d 100644 --- a/Source/AppAuthTV/OIDTVTokenRequest.h +++ b/Source/AppAuthTV/OIDTVTokenRequest.h @@ -35,14 +35,14 @@ NS_ASSUME_NONNULL_BEGIN /*! @internal @brief Unavailable. Please use - @c initWithConfiguration:deviceCode:clientID:clientSecret:additionalParameters: + @c initWithConfiguration:deviceCode:clientID:clientSecret:additionalParameters:additionalHeaders: or @c initWithCoder:. */ - (instancetype)init NS_UNAVAILABLE; /*! @internal @brief Unavailable. Please use - @c initWithConfiguration:deviceCode:clientID:clientSecret:additionalParameters: + @c initWithConfiguration:deviceCode:clientID:clientSecret:additionalParameters:additionalHeaders: or @c initWithCoder:. */ - (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration @@ -56,11 +56,13 @@ NS_ASSUME_NONNULL_BEGIN codeVerifier:(nullable NSString *)codeVerifier additionalParameters: (nullable NSDictionary *)additionalParameters + additionalHeaders: + (nullable NSDictionary *)additionalHeaders NS_UNAVAILABLE; /*! @internal @brief Unavailable. Please use - @c initWithConfiguration:deviceCode:clientID:clientSecret:additionalParameters: + @c initWithConfiguration:deviceCode:clientID:clientSecret:additionalParameters:additionalHeaders: or @c initWithCoder:. */ - (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration @@ -74,6 +76,8 @@ NS_ASSUME_NONNULL_BEGIN codeVerifier:(nullable NSString *)codeVerifier additionalParameters: (nullable NSDictionary *)additionalParameters + additionalHeaders: + (nullable NSDictionary *)additionalHeaders NS_UNAVAILABLE; /*! @brief Designated initializer. @@ -82,6 +86,7 @@ NS_ASSUME_NONNULL_BEGIN @param clientID The client identifier. @param clientSecret The client secret (nullable). @param additionalParameters The client's additional token request parameters. + @param additionalHeaders The client's additional token request headers. */ - (instancetype)initWithConfiguration:(OIDTVServiceConfiguration *)configuration deviceCode:(NSString *)deviceCode @@ -89,6 +94,8 @@ NS_ASSUME_NONNULL_BEGIN clientSecret:(nullable NSString *)clientSecret additionalParameters: (nullable NSDictionary *)additionalParameters + additionalHeaders: + (nullable NSDictionary *)additionalHeaders NS_DESIGNATED_INITIALIZER; /*! @brief Designated initializer for NSSecureCoding. diff --git a/Source/AppAuthTV/OIDTVTokenRequest.m b/Source/AppAuthTV/OIDTVTokenRequest.m index 88874a817..ed5e4d3f2 100644 --- a/Source/AppAuthTV/OIDTVTokenRequest.m +++ b/Source/AppAuthTV/OIDTVTokenRequest.m @@ -43,6 +43,7 @@ - (instancetype)init OID_UNAVAILABLE_USE_INITIALIZER(@selector clientID: clientSecret: additionalParameters: + additionalHeaders: )) - (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration @@ -56,12 +57,15 @@ - (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration codeVerifier:(nullable NSString *)codeVerifier additionalParameters: (nullable NSDictionary *)additionalParameters + additionalHeaders: + (nullable NSDictionary *)additionalHeaders OID_UNAVAILABLE_USE_INITIALIZER(@selector (initWithConfiguration: deviceCode: clientID: clientSecret: additionalParameters: + additionalHeaders: )) - (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration @@ -75,19 +79,23 @@ - (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration codeVerifier:(nullable NSString *)codeVerifier additionalParameters: (nullable NSDictionary *)additionalParameters + additionalHeaders: + (nullable NSDictionary *)additionalHeaders OID_UNAVAILABLE_USE_INITIALIZER(@selector (initWithConfiguration: deviceCode: clientID: clientSecret: additionalParameters: + additionalHeaders: )) - (instancetype)initWithConfiguration:(OIDTVServiceConfiguration *)configuration deviceCode:(NSString *)deviceCode clientID:(NSString *)clientID clientSecret:(NSString *)clientSecret - additionalParameters:(NSDictionary *)additionalParameters { + additionalParameters:(NSDictionary *)additionalParameters + additionalHeaders:(NSDictionary *)additionalHeaders { self = [super initWithConfiguration:configuration grantType:kOIDTVDeviceTokenGrantType authorizationCode:nil @@ -97,7 +105,8 @@ - (instancetype)initWithConfiguration:(OIDTVServiceConfiguration *)configuration scope:nil refreshToken:nil codeVerifier:nil - additionalParameters:additionalParameters]; + additionalParameters:additionalParameters + additionalHeaders:additionalHeaders]; if (self) { _deviceCode = [deviceCode copy]; diff --git a/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.h b/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.h index 32497c854..2ffbc5775 100644 --- a/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.h +++ b/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.h @@ -48,10 +48,10 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)testTokenPollRequest; -/*! @brief Tests the @c tokenPollRequestWithAdditionalParameters method with one additional - parameter. +/*! @brief Tests the @c testTokenPollRequestWithAdditionalParametersAdditionalHeaders method with one additional + parameter and one additional header. */ -- (void)testTokenPollRequestWithAdditionalParameters; +- (void)testTokenPollRequestWithAdditionalParametersAdditionalHeaders; @end diff --git a/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.m b/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.m index a6d1bb2f5..288228e88 100644 --- a/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.m +++ b/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.m @@ -45,6 +45,14 @@ */ static NSString *const kTestAdditionalParameterValue = @"1"; +/*! @brief Test key for the @c additionalHeaders property. + */ +static NSString *const kTestAdditionalHeaderKey = @"B"; + +/*! @brief Test value for the @c additionalHeaders property. + */ +static NSString *const kTestAdditionalHeaderValue = @"2"; + /*! @brief Test value for the @c clientID property. */ static NSString *const kTestClientID = @"ClientID"; @@ -262,22 +270,26 @@ - (void)testTokenPollRequest { XCTAssertEqualObjects(pollRequest.additionalParameters, @{}); } -/*! @brief Tests the @c tokenPollRequestWithAdditionalParameters method with one additional - parameter. +/*! @brief Tests the @c testTokenPollRequestWithAdditionalParametersAdditionalHeaders method with one additional + parameter and one additional header. */ -- (void)testTokenPollRequestWithAdditionalParameters { +- (void)testTokenPollRequestWithAdditionalParametersAdditionalHeaders { OIDTVAuthorizationResponse *testResponse = [self testAuthorizationResponse]; NSDictionary *testAdditionalParameters = @{kTestAdditionalParameterKey : kTestAdditionalParameterValue}; + + NSDictionary *testAdditionalHeaders = + @{kTestAdditionalHeaderKey : kTestAdditionalHeaderValue}; OIDTVTokenRequest *pollRequest = - [testResponse tokenPollRequestWithAdditionalParameters:testAdditionalParameters]; + [testResponse tokenPollRequestWithAdditionalParameters:testAdditionalParameters additionalHeaders:testAdditionalHeaders]; XCTAssertEqualObjects(pollRequest.deviceCode, kTestDeviceCode); XCTAssertEqualObjects(pollRequest.clientID, kTestClientID); XCTAssertEqualObjects(pollRequest.clientSecret, kTestClientSecret); XCTAssertEqualObjects(pollRequest.additionalParameters, testAdditionalParameters); + XCTAssertEqualObjects(pollRequest.additionalHeaders, testAdditionalHeaders); } @end diff --git a/UnitTests/AppAuthTV/OIDTVTokenRequestTests.m b/UnitTests/AppAuthTV/OIDTVTokenRequestTests.m index cf0bf4963..4778a227b 100644 --- a/UnitTests/AppAuthTV/OIDTVTokenRequestTests.m +++ b/UnitTests/AppAuthTV/OIDTVTokenRequestTests.m @@ -50,6 +50,14 @@ */ static NSString *const kTestAdditionalParameterValue = @"1"; +/*! @brief Test key for the @c additionalHeaders property. + */ +static NSString *const kTestAdditionalHeaderKey = @"B"; + +/*! @brief Test value for the @c additionalHeaders property. + */ +static NSString *const kTestAdditionalHeaderValue = @"2"; + /*! @brief Test key for the @c clientID parameter in the HTTP request. */ static NSString *const kTestClientIDKey = @"client_id"; @@ -121,7 +129,8 @@ - (OIDTVTokenRequest *)testTokenRequest { deviceCode:kDeviceCodeValue clientID:kTestClientID clientSecret:kTestClientSecret - additionalParameters:@{kTestAdditionalParameterKey : kTestAdditionalParameterValue}]; + additionalParameters:@{kTestAdditionalParameterKey : kTestAdditionalParameterValue} + additionalHeaders:@{kTestAdditionalHeaderKey : kTestAdditionalHeaderValue}]; } /*! @brief Tests the initializer @@ -139,6 +148,8 @@ - (void)testInitializer { XCTAssertEqualObjects(request.clientSecret, kTestClientSecret); XCTAssertEqualObjects(request.additionalParameters, @{kTestAdditionalParameterKey:kTestAdditionalParameterValue}); + XCTAssertEqualObjects(request.additionalHeaders, + @{kTestAdditionalHeaderKey:kTestAdditionalHeaderValue}); } /*! @brief Tests the @c NSCopying implementation by round-tripping an instance through the copying diff --git a/UnitTests/OIDAuthStateTests.m b/UnitTests/OIDAuthStateTests.m index 4d7c3a8b7..d12f2a831 100644 --- a/UnitTests/OIDAuthStateTests.m +++ b/UnitTests/OIDAuthStateTests.m @@ -435,6 +435,27 @@ - (void)testIsTokenFreshHandlesTokenWithoutExpirationTime { XCTAssertEqual([authState isTokenFresh], YES, @""); } +- (void)testThatRefreshTokenExceptionWillBeRaisedForTokenRequestWithAdditionalParameters { + OIDAuthState *authState = [[OIDAuthState alloc] initWithAuthorizationResponse:nil tokenResponse:nil registrationResponse:nil]; + XCTAssertThrowsSpecificNamed([authState tokenRefreshRequestWithAdditionalParameters:nil], + NSException, + kRefreshTokenRequestException); +} + +- (void)testThatRefreshTokenExceptionWillBeRaisedForTokenRequestWithAdditionalHeaders { + OIDAuthState *authState = [[OIDAuthState alloc] initWithAuthorizationResponse:nil tokenResponse:nil registrationResponse:nil]; + XCTAssertThrowsSpecificNamed([authState tokenRefreshRequestWithAdditionalHeaders:nil], + NSException, + kRefreshTokenRequestException); +} + +- (void)testThatRefreshTokenExceptionWillBeRaisedForTokenRequestWithAdditionalParametersAndHeaders { + OIDAuthState *authState = [[OIDAuthState alloc] initWithAuthorizationResponse:nil tokenResponse:nil registrationResponse:nil]; + XCTAssertThrowsSpecificNamed([authState tokenRefreshRequestWithAdditionalHeaders:nil], + NSException, + kRefreshTokenRequestException); +} + @end #pragma GCC diagnostic pop diff --git a/UnitTests/OIDTokenRequestTests.m b/UnitTests/OIDTokenRequestTests.m index 4211ef70a..2aa865238 100644 --- a/UnitTests/OIDTokenRequestTests.m +++ b/UnitTests/OIDTokenRequestTests.m @@ -48,6 +48,14 @@ */ static NSString *const kTestAdditionalParameterValue = @"1"; +/*! @brief Test key for the @c additionalHeaders property. + */ +static NSString *const kTestAdditionalHeaderKey = @"B"; + +/*! @brief Test value for the @c additionalHeaders property. + */ +static NSString *const kTestAdditionalHeaderValue = @"2"; + @implementation OIDTokenRequestTests + (OIDTokenRequest *)testInstance { @@ -56,6 +64,9 @@ + (OIDTokenRequest *)testInstance { [OIDScopeUtilities scopesArrayWithString:authResponse.request.scope]; NSDictionary *additionalParameters = @{ kTestAdditionalParameterKey : kTestAdditionalParameterValue }; + NSDictionary *additionalHeaders = + @{ kTestAdditionalHeaderKey : kTestAdditionalHeaderValue }; + OIDTokenRequest *request = [[OIDTokenRequest alloc] initWithConfiguration:authResponse.request.configuration grantType:OIDGrantTypeAuthorizationCode @@ -66,7 +77,8 @@ + (OIDTokenRequest *)testInstance { scopes:scopesArray refreshToken:kRefreshTokenTestValue codeVerifier:authResponse.request.codeVerifier - additionalParameters:additionalParameters]; + additionalParameters:additionalParameters + additionalHeaders:additionalHeaders]; return request; } @@ -76,6 +88,9 @@ + (OIDTokenRequest *)testInstanceCodeExchange { [OIDScopeUtilities scopesArrayWithString:authResponse.request.scope]; NSDictionary *additionalParameters = @{ kTestAdditionalParameterKey : kTestAdditionalParameterValue }; + NSDictionary *additionalHeaders = + @{ kTestAdditionalHeaderKey : kTestAdditionalHeaderValue }; + OIDTokenRequest *request = [[OIDTokenRequest alloc] initWithConfiguration:authResponse.request.configuration grantType:OIDGrantTypeAuthorizationCode @@ -86,7 +101,8 @@ + (OIDTokenRequest *)testInstanceCodeExchange { scopes:scopesArray refreshToken:kRefreshTokenTestValue codeVerifier:authResponse.request.codeVerifier - additionalParameters:additionalParameters]; + additionalParameters:additionalParameters + additionalHeaders:additionalHeaders]; return request; } @@ -96,6 +112,9 @@ + (OIDTokenRequest *)testInstanceCodeExchangeClientAuth { [OIDScopeUtilities scopesArrayWithString:authResponse.request.scope]; NSDictionary *additionalParameters = @{ kTestAdditionalParameterKey : kTestAdditionalParameterValue }; + NSDictionary *additionalHeaders = + @{ kTestAdditionalHeaderKey : kTestAdditionalHeaderValue }; + OIDTokenRequest *request = [[OIDTokenRequest alloc] initWithConfiguration:authResponse.request.configuration grantType:OIDGrantTypeAuthorizationCode @@ -106,7 +125,8 @@ + (OIDTokenRequest *)testInstanceCodeExchangeClientAuth { scopes:scopesArray refreshToken:kRefreshTokenTestValue codeVerifier:authResponse.request.codeVerifier - additionalParameters:additionalParameters]; + additionalParameters:additionalParameters + additionalHeaders:additionalHeaders]; return request; } @@ -116,6 +136,9 @@ + (OIDTokenRequest *)testInstanceRefresh { [OIDScopeUtilities scopesArrayWithString:authResponse.request.scope]; NSDictionary *additionalParameters = @{ kTestAdditionalParameterKey : kTestAdditionalParameterValue }; + NSDictionary *additionalHeaders = + @{ kTestAdditionalHeaderKey : kTestAdditionalHeaderValue }; + OIDTokenRequest *request = [[OIDTokenRequest alloc] initWithConfiguration:authResponse.request.configuration grantType:OIDGrantTypeAuthorizationCode @@ -126,7 +149,8 @@ + (OIDTokenRequest *)testInstanceRefresh { scopes:scopesArray refreshToken:kRefreshTokenTestValue codeVerifier:authResponse.request.codeVerifier - additionalParameters:additionalParameters]; + additionalParameters:additionalParameters + additionalHeaders:additionalHeaders]; return request; } @@ -157,11 +181,17 @@ - (void)testCopying { XCTAssertEqualObjects(request.codeVerifier, authResponse.request.codeVerifier, @"Request and response codeVerifiers should be equal."); XCTAssertNotNil(request.additionalParameters, - @"Request's additionalParameters field should not be nil."); + @"Request's additionalParameters field should not be nil."); XCTAssertEqualObjects(request.additionalParameters[kTestAdditionalParameterKey], kTestAdditionalParameterValue, @"The request's kTestAdditionalParameterKey additional parameter should " "be equal to kTestAdditionalParameterValue."); + XCTAssertNotNil(request.additionalHeaders, + @"Request's additionalHeaders field should not be nil."); + XCTAssertEqualObjects(request.additionalHeaders[kTestAdditionalHeaderKey], + kTestAdditionalHeaderValue, + @"The request's kTestAdditionalHeaderKey additional parameter should " + "be equal to kTestAdditionalHeaderValue."); OIDTokenRequest *requestCopy = [request copy]; @@ -181,6 +211,9 @@ - (void)testCopying { XCTAssertNotNil(requestCopy.additionalParameters, @""); XCTAssertEqualObjects(requestCopy.additionalParameters[kTestAdditionalParameterKey], kTestAdditionalParameterValue, @""); + XCTAssertNotNil(requestCopy.additionalHeaders, @""); + XCTAssertEqualObjects(requestCopy.additionalHeaders[kTestAdditionalHeaderKey], + kTestAdditionalHeaderValue, @""); } /*! @brief Tests the @c NSSecureCoding by round-tripping an instance through the coding process and @@ -203,6 +236,9 @@ - (void)testSecureCoding { XCTAssertNotNil(request.additionalParameters, @""); XCTAssertEqualObjects(request.additionalParameters[kTestAdditionalParameterKey], kTestAdditionalParameterValue, @""); + XCTAssertNotNil(request.additionalHeaders, @""); + XCTAssertEqualObjects(request.additionalHeaders[kTestAdditionalHeaderKey], + kTestAdditionalHeaderValue, @""); NSData *data = [NSKeyedArchiver archivedDataWithRootObject:request]; OIDTokenRequest *requestCopy = [NSKeyedUnarchiver unarchiveObjectWithData:data]; @@ -224,6 +260,9 @@ - (void)testSecureCoding { XCTAssertNotNil(requestCopy.additionalParameters, @""); XCTAssertEqualObjects(requestCopy.additionalParameters[kTestAdditionalParameterKey], kTestAdditionalParameterValue, @""); + XCTAssertNotNil(requestCopy.additionalHeaders, @""); + XCTAssertEqualObjects(requestCopy.additionalHeaders[kTestAdditionalHeaderKey], + kTestAdditionalHeaderValue, @""); } - (void)testURLRequestNoClientAuth { @@ -248,6 +287,8 @@ - (void)testAuthorizationCodeNullRedirectURL { [OIDScopeUtilities scopesArrayWithString:authResponse.request.scope]; NSDictionary *additionalParameters = @{ kTestAdditionalParameterKey : kTestAdditionalParameterValue }; + NSDictionary *additionalHeaders = + @{ kTestAdditionalHeaderKey : kTestAdditionalHeaderValue }; XCTAssertThrows([[OIDTokenRequest alloc] initWithConfiguration:authResponse.request.configuration grantType:OIDGrantTypeAuthorizationCode authorizationCode:authResponse.authorizationCode @@ -257,7 +298,8 @@ - (void)testAuthorizationCodeNullRedirectURL { scopes:scopesArray refreshToken:kRefreshTokenTestValue codeVerifier:authResponse.request.codeVerifier - additionalParameters:additionalParameters], @""); + additionalParameters:additionalParameters + additionalHeaders:additionalHeaders], @""); } @end From b376a8719dd9e3067439580d3b2c8aded748827f Mon Sep 17 00:00:00 2001 From: Daniel Seither Date: Wed, 4 Oct 2023 17:46:23 +0200 Subject: [PATCH 66/81] Fix nullability annotation for -[OIDExternalUserAgentIOS init] (#727) --- Source/AppAuth/iOS/OIDExternalUserAgentIOS.h | 2 +- Source/AppAuth/iOS/OIDExternalUserAgentIOS.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/AppAuth/iOS/OIDExternalUserAgentIOS.h b/Source/AppAuth/iOS/OIDExternalUserAgentIOS.h index ae0773c69..12abc203c 100644 --- a/Source/AppAuth/iOS/OIDExternalUserAgentIOS.h +++ b/Source/AppAuth/iOS/OIDExternalUserAgentIOS.h @@ -34,7 +34,7 @@ NS_ASSUME_NONNULL_BEGIN API_UNAVAILABLE(macCatalyst) @interface OIDExternalUserAgentIOS : NSObject -- (nullable instancetype)init API_AVAILABLE(ios(11)) +- (null_unspecified instancetype)init API_AVAILABLE(ios(11)) __deprecated_msg("This method will not work on iOS 13, use " "initWithPresentingViewController:presentingViewController"); diff --git a/Source/AppAuth/iOS/OIDExternalUserAgentIOS.m b/Source/AppAuth/iOS/OIDExternalUserAgentIOS.m index eab7aa3cb..4a8cda0a3 100644 --- a/Source/AppAuth/iOS/OIDExternalUserAgentIOS.m +++ b/Source/AppAuth/iOS/OIDExternalUserAgentIOS.m @@ -55,7 +55,7 @@ @implementation OIDExternalUserAgentIOS { #pragma clang diagnostic pop } -- (nullable instancetype)init { +- (null_unspecified instancetype)init { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wnonnull" return [self initWithPresentingViewController:nil]; From 8b437c47f46d505b7bf9a580626472b2568f38ce Mon Sep 17 00:00:00 2001 From: Vojtech Novak Date: Wed, 18 Oct 2023 20:11:59 +0200 Subject: [PATCH 67/81] feat: allow custom nonce in OIDAuthorizationRequest (#788) --- Source/AppAuthCore/OIDAuthorizationRequest.h | 23 +++++++++++++++++ Source/AppAuthCore/OIDAuthorizationRequest.m | 26 ++++++++++++++++++++ UnitTests/OIDAuthorizationRequestTests.m | 23 +++++++++++++++++ 3 files changed, 72 insertions(+) diff --git a/Source/AppAuthCore/OIDAuthorizationRequest.h b/Source/AppAuthCore/OIDAuthorizationRequest.h index 594f01d87..c3a0cc0d8 100644 --- a/Source/AppAuthCore/OIDAuthorizationRequest.h +++ b/Source/AppAuthCore/OIDAuthorizationRequest.h @@ -159,6 +159,29 @@ extern NSString *const OIDOAuthorizationRequestCodeChallengeMethodS256; responseType:(NSString *)responseType additionalParameters:(nullable NSDictionary *)additionalParameters; +/*! @brief Creates an authorization request with custom nonce, a secure @c state, + and PKCE with S256 as the @c code_challenge_method. + @param configuration The service's configuration. + @param clientID The client identifier. + @param scopes An array of scopes to combine into a single scope string per the OAuth2 spec. + @param redirectURL The client's redirect URI. + @param responseType The expected response type. + @param nonce String value used to associate a Client session with an ID Token. Can be set to nil + if not using OpenID Connect, although pure OAuth servers should ignore params they don't + understand anyway. + @param additionalParameters The client's additional authorization parameters. + @remarks This convenience initializer generates a state parameter and PKCE challenges + automatically. + */ +- (instancetype) + initWithConfiguration:(OIDServiceConfiguration *)configuration + clientId:(NSString *)clientID + scopes:(nullable NSArray *)scopes + redirectURL:(NSURL *)redirectURL + responseType:(NSString *)responseType + nonce:(nullable NSString *)nonce + additionalParameters:(nullable NSDictionary *)additionalParameters; + /*! @brief Creates an authorization request with opinionated defaults (a secure @c state, @c nonce, and PKCE with S256 as the @c code_challenge_method). @param configuration The service's configuration. diff --git a/Source/AppAuthCore/OIDAuthorizationRequest.m b/Source/AppAuthCore/OIDAuthorizationRequest.m index ccfacda0f..1be1fdfde 100644 --- a/Source/AppAuthCore/OIDAuthorizationRequest.m +++ b/Source/AppAuthCore/OIDAuthorizationRequest.m @@ -202,6 +202,32 @@ - (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration additionalParameters:additionalParameters]; } +- (instancetype) + initWithConfiguration:(OIDServiceConfiguration *)configuration + clientId:(NSString *)clientID + scopes:(nullable NSArray *)scopes + redirectURL:(NSURL *)redirectURL + responseType:(NSString *)responseType + nonce:(nullable NSString *)nonce + additionalParameters:(nullable NSDictionary *)additionalParameters { + // generates PKCE code verifier and challenge + NSString *codeVerifier = [[self class] generateCodeVerifier]; + NSString *codeChallenge = [[self class] codeChallengeS256ForVerifier:codeVerifier]; + + return [self initWithConfiguration:configuration + clientId:clientID + clientSecret:nil + scope:[OIDScopeUtilities scopesWithArray:scopes] + redirectURL:redirectURL + responseType:responseType + state:[[self class] generateState] + nonce:nonce + codeVerifier:codeVerifier + codeChallenge:codeChallenge + codeChallengeMethod:OIDOAuthorizationRequestCodeChallengeMethodS256 + additionalParameters:additionalParameters]; +} + #pragma mark - NSCopying - (instancetype)copyWithZone:(nullable NSZone *)zone { diff --git a/UnitTests/OIDAuthorizationRequestTests.m b/UnitTests/OIDAuthorizationRequestTests.m index 06bfc6c13..92ed8ee05 100644 --- a/UnitTests/OIDAuthorizationRequestTests.m +++ b/UnitTests/OIDAuthorizationRequestTests.m @@ -223,6 +223,29 @@ - (void)testScopeInitializerWithManyScopesAndNoClientSecret { kTestAdditionalParameterValue, @""); } + +/*! @brief Tests the initializer which takes a nonce + */ +- (void)testNonceInitializer { + OIDServiceConfiguration *configuration = [OIDServiceConfigurationTests testInstance]; + OIDAuthorizationRequest *request = + [[OIDAuthorizationRequest alloc] initWithConfiguration:configuration + clientId:kTestClientID + scopes:@[] + redirectURL:[NSURL URLWithString:kTestRedirectURL] + responseType:OIDResponseTypeCode + nonce:kTestNonce + additionalParameters:nil]; + + XCTAssertEqualObjects(request.nonce, kTestNonce); + XCTAssertEqualObjects(request.responseType, @"code"); + XCTAssertEqualObjects(request.scope, @""); + XCTAssertEqualObjects(request.clientID, kTestClientID); + XCTAssertNil(request.clientSecret); + XCTAssertEqualObjects(request.redirectURL, [NSURL URLWithString:kTestRedirectURL]); + XCTAssertEqualObjects(@(request.additionalParameters.count), @0); +} + - (void)testScopeInitializerWithManyScopesAndClientSecret { NSDictionary *additionalParameters = @{ kTestAdditionalParameterKey : kTestAdditionalParameterValue }; From aea7b8acd8b3fc261b8a42c998de33d76851f30b Mon Sep 17 00:00:00 2001 From: GravityByte Date: Wed, 25 Oct 2023 19:45:50 +0200 Subject: [PATCH 68/81] fixed wrong variable for additional http headers in OIDTokenRequest (#770) (#798) --- Source/AppAuthCore/OIDTokenRequest.m | 2 +- UnitTests/OIDTokenRequestTests.m | 53 ++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/Source/AppAuthCore/OIDTokenRequest.m b/Source/AppAuthCore/OIDTokenRequest.m index 08b0dafec..e09e5577d 100644 --- a/Source/AppAuthCore/OIDTokenRequest.m +++ b/Source/AppAuthCore/OIDTokenRequest.m @@ -330,7 +330,7 @@ - (NSURLRequest *)URLRequest { } for (id header in _additionalHeaders) { - [URLRequest setValue:httpHeaders[header] forHTTPHeaderField:header]; + [URLRequest setValue:_additionalHeaders[header] forHTTPHeaderField:header]; } return URLRequest; diff --git a/UnitTests/OIDTokenRequestTests.m b/UnitTests/OIDTokenRequestTests.m index 2aa865238..20ba691ca 100644 --- a/UnitTests/OIDTokenRequestTests.m +++ b/UnitTests/OIDTokenRequestTests.m @@ -56,6 +56,14 @@ */ static NSString *const kTestAdditionalHeaderValue = @"2"; +/*! @brief Test key for the @c additionalHeaders property. + */ +static NSString *const kTestAdditionalHeaderKey2 = @"C"; + +/*! @brief Test value for the @c additionalHeaders property. + */ +static NSString *const kTestAdditionalHeaderValue2 = @"3"; + @implementation OIDTokenRequestTests + (OIDTokenRequest *)testInstance { @@ -154,6 +162,32 @@ + (OIDTokenRequest *)testInstanceRefresh { return request; } ++ (OIDTokenRequest *)testInstanceAdditionalHeaders { + OIDAuthorizationResponse *authResponse = [OIDAuthorizationResponseTests testInstance]; + NSArray *scopesArray = + [OIDScopeUtilities scopesArrayWithString:authResponse.request.scope]; + NSDictionary *additionalParameters = + @{ kTestAdditionalParameterKey : kTestAdditionalParameterValue }; + NSDictionary *additionalHeaders = @{ + kTestAdditionalHeaderKey : kTestAdditionalHeaderValue, + kTestAdditionalHeaderKey2 : kTestAdditionalHeaderValue2 + }; + + OIDTokenRequest *request = + [[OIDTokenRequest alloc] initWithConfiguration:authResponse.request.configuration + grantType:OIDGrantTypeAuthorizationCode + authorizationCode:authResponse.authorizationCode + redirectURL:authResponse.request.redirectURL + clientID:authResponse.request.clientID + clientSecret:authResponse.request.clientSecret + scopes:scopesArray + refreshToken:kRefreshTokenTestValue + codeVerifier:authResponse.request.codeVerifier + additionalParameters:additionalParameters + additionalHeaders:additionalHeaders]; + return request; +} + /*! @brief Tests the @c NSCopying implementation by round-tripping an instance through the copying process and checking to make sure the source and destination instances are equivalent. */ @@ -239,6 +273,10 @@ - (void)testSecureCoding { XCTAssertNotNil(request.additionalHeaders, @""); XCTAssertEqualObjects(request.additionalHeaders[kTestAdditionalHeaderKey], kTestAdditionalHeaderValue, @""); + + NSURLRequest *urlRequest = [request URLRequest]; + XCTAssertEqualObjects([urlRequest.allHTTPHeaderFields objectForKey:kTestAdditionalHeaderKey], + kTestAdditionalHeaderValue); NSData *data = [NSKeyedArchiver archivedDataWithRootObject:request]; OIDTokenRequest *requestCopy = [NSKeyedUnarchiver unarchiveObjectWithData:data]; @@ -263,6 +301,10 @@ - (void)testSecureCoding { XCTAssertNotNil(requestCopy.additionalHeaders, @""); XCTAssertEqualObjects(requestCopy.additionalHeaders[kTestAdditionalHeaderKey], kTestAdditionalHeaderValue, @""); + + NSURLRequest *urlrequestCopy = [requestCopy URLRequest]; + XCTAssertEqualObjects([urlrequestCopy.allHTTPHeaderFields objectForKey:kTestAdditionalHeaderKey], + kTestAdditionalHeaderValue); } - (void)testURLRequestNoClientAuth { @@ -302,6 +344,17 @@ - (void)testAuthorizationCodeNullRedirectURL { additionalHeaders:additionalHeaders], @""); } +- (void)testThatAdditionalHeadersAreInTokenRequest { + OIDTokenRequest *request = [[self class] testInstanceAdditionalHeaders]; + NSURLRequest* urlRequest = [request URLRequest]; + + XCTAssertEqualObjects([urlRequest.allHTTPHeaderFields objectForKey:kTestAdditionalHeaderKey], + kTestAdditionalHeaderValue); + + XCTAssertEqualObjects([urlRequest.allHTTPHeaderFields objectForKey:kTestAdditionalHeaderKey2], + kTestAdditionalHeaderValue2); +} + @end #pragma GCC diagnostic pop From 3dc3e93eb165d2a1e18c4bc7e43864f5c9f96f14 Mon Sep 17 00:00:00 2001 From: mdmathias Date: Wed, 6 Mar 2024 12:47:12 -0800 Subject: [PATCH 69/81] Add privacy manifest (#822) --- AppAuth.podspec | 13 ++++- AppAuth.xcodeproj/project.pbxproj | 14 ++++++ .../project.pbxproj | 48 +++++++++++++------ Examples/Example-iOS_ObjC/Podfile | 4 +- .../Source/AppAuthExampleViewController.m | 7 +-- .../Example-macOS.xcodeproj/project.pbxproj | 32 ++++++------- Examples/Example-macOS/Podfile | 2 +- .../Example-tvOS.xcodeproj/project.pbxproj | 26 ++++++++-- .../AppAuthTVExampleViewController.m | 5 +- Examples/Example-tvOS/Podfile | 2 + Package.swift | 5 +- PrivacyInfo.xcprivacy | 18 +++++++ 12 files changed, 129 insertions(+), 47 deletions(-) create mode 100644 PrivacyInfo.xcprivacy diff --git a/AppAuth.podspec b/AppAuth.podspec index b175e6282..325690783 100644 --- a/AppAuth.podspec +++ b/AppAuth.podspec @@ -44,13 +44,19 @@ It follows the OAuth 2.0 for Native Apps best current practice # Subspec for the core AppAuth library classes only, suitable for extensions. s.subspec 'Core' do |core| core.source_files = "Source/AppAuthCore.h", "Source/AppAuthCore/*.{h,m}" + core.resource_bundles = { + "AppAuthCore_Privacy" => ["PrivacyInfo.xcprivacy"] + } end - # Subspec for the full AppAuth library, including platform-dependant external user agents. + # Subspec for the full AppAuth library, including platform-dependent external user agents. s.subspec 'ExternalUserAgent' do |externalUserAgent| externalUserAgent.dependency 'AppAuth/Core' externalUserAgent.source_files = "Source/AppAuth.h", "Source/AppAuth/*.{h,m}" + externalUserAgent.resource_bundles = { + "AppAuthExternalUserAgent_Privacy" => ["PrivacyInfo.xcprivacy"] + } # iOS externalUserAgent.ios.source_files = "Source/AppAuth/iOS/**/*.{h,m}" @@ -64,10 +70,13 @@ It follows the OAuth 2.0 for Native Apps best current practice externalUserAgent.osx.weak_frameworks = "AuthenticationServices" end - # Subspec for the full AppAuth library, including platform-dependant external user agents. + # Subspec for the full AppAuth library, including platform-dependent external user agents. s.subspec 'TV' do |tv| tv.source_files = "Source/AppAuthTV.h", "Source/AppAuthTV/*.{h,m}" tv.dependency 'AppAuth/Core' + tv.resource_bundles = { + "AppAuthTV" => ["PrivacyInfo.xcprivacy"] + } end s.default_subspecs = 'Core', 'ExternalUserAgent' diff --git a/AppAuth.xcodeproj/project.pbxproj b/AppAuth.xcodeproj/project.pbxproj index 08e6f28a1..1f4a2a876 100644 --- a/AppAuth.xcodeproj/project.pbxproj +++ b/AppAuth.xcodeproj/project.pbxproj @@ -546,6 +546,12 @@ 60140F801DE4344200DA0DC3 /* OIDRegistrationResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 60140F7F1DE4344200DA0DC3 /* OIDRegistrationResponse.m */; }; 60140F831DE43BAF00DA0DC3 /* OIDRegistrationRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 60140F821DE43BAF00DA0DC3 /* OIDRegistrationRequestTests.m */; }; 60140F861DE43CC700DA0DC3 /* OIDRegistrationResponseTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 60140F851DE43CC700DA0DC3 /* OIDRegistrationResponseTests.m */; }; + 73F574342B7C42690023FFF0 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 73F574332B7C42690023FFF0 /* PrivacyInfo.xcprivacy */; }; + 73F574352B7C42690023FFF0 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 73F574332B7C42690023FFF0 /* PrivacyInfo.xcprivacy */; }; + 73F574362B7C42690023FFF0 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 73F574332B7C42690023FFF0 /* PrivacyInfo.xcprivacy */; }; + 73F574372B7C42690023FFF0 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 73F574332B7C42690023FFF0 /* PrivacyInfo.xcprivacy */; }; + 73F574382B7C42690023FFF0 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 73F574332B7C42690023FFF0 /* PrivacyInfo.xcprivacy */; }; + 73F574392B7C42690023FFF0 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 73F574332B7C42690023FFF0 /* PrivacyInfo.xcprivacy */; }; A5EEF29720D821120044F470 /* OIDTokenUtilitiesTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A5EEF1FD20CF07760044F470 /* OIDTokenUtilitiesTests.m */; }; A5EEF29820D8211A0044F470 /* OIDTokenUtilitiesTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A5EEF1FD20CF07760044F470 /* OIDTokenUtilitiesTests.m */; }; A5EEF29920D8211B0044F470 /* OIDTokenUtilitiesTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A5EEF1FD20CF07760044F470 /* OIDTokenUtilitiesTests.m */; }; @@ -827,6 +833,7 @@ 60140F821DE43BAF00DA0DC3 /* OIDRegistrationRequestTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OIDRegistrationRequestTests.m; sourceTree = ""; }; 60140F841DE43C8C00DA0DC3 /* OIDRegistrationResponseTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OIDRegistrationResponseTests.h; sourceTree = ""; }; 60140F851DE43CC700DA0DC3 /* OIDRegistrationResponseTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OIDRegistrationResponseTests.m; sourceTree = ""; }; + 73F574332B7C42690023FFF0 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; A5EEF1FD20CF07760044F470 /* OIDTokenUtilitiesTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OIDTokenUtilitiesTests.m; sourceTree = ""; }; A6CEB1172007E384009D492A /* OIDEndSessionRequestTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDEndSessionRequestTests.h; sourceTree = ""; }; A6CEB1182007E384009D492A /* OIDEndSessionRequestTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OIDEndSessionRequestTests.m; sourceTree = ""; }; @@ -1048,6 +1055,7 @@ 340E73731C5D819B0076B1F6 = { isa = PBXGroup; children = ( + 73F574332B7C42690023FFF0 /* PrivacyInfo.xcprivacy */, 341742291C5D84D0000EF209 /* Frameworks */, 341741FB1C5D82D3000EF209 /* UnitTests */, 341741AE1C5D8243000EF209 /* Source */, @@ -1937,6 +1945,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 73F574392B7C42690023FFF0 /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1965,6 +1974,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 73F574382B7C42690023FFF0 /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1972,6 +1982,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 73F574342B7C42690023FFF0 /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1986,6 +1997,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 73F574352B7C42690023FFF0 /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1993,6 +2005,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 73F574362B7C42690023FFF0 /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2007,6 +2020,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 73F574372B7C42690023FFF0 /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Examples/Example-iOS_ObjC/Example-iOS_ObjC.xcodeproj/project.pbxproj b/Examples/Example-iOS_ObjC/Example-iOS_ObjC.xcodeproj/project.pbxproj index eb38b576d..7f3f2de68 100644 --- a/Examples/Example-iOS_ObjC/Example-iOS_ObjC.xcodeproj/project.pbxproj +++ b/Examples/Example-iOS_ObjC/Example-iOS_ObjC.xcodeproj/project.pbxproj @@ -19,8 +19,8 @@ 346E91991C2A245000D3620B /* SafariServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 346E91981C2A245000D3620B /* SafariServices.framework */; }; 34CB09BD1C42007600A54261 /* AppAuthExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34CB09BB1C42007600A54261 /* AppAuthExampleViewController.m */; }; 34CB09BE1C42007600A54261 /* AppAuthExampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 34CB09BC1C42007600A54261 /* AppAuthExampleViewController.xib */; }; - D0B5FA33D74A6F7924A47471 /* libPods-Example-iOS_ObjC_Extension.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 715EDB7EC4271193E47615ED /* libPods-Example-iOS_ObjC_Extension.a */; }; - E46F8589CE9E5DDFA69D835B /* libPods-Example-iOS_ObjC.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B61A918CBE7B8142CD7D8B3 /* libPods-Example-iOS_ObjC.a */; }; + BE28448F8FD76A9C12A30150 /* Pods_Example_iOS_ObjC_Extension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3CC004951DF03519C52500EC /* Pods_Example_iOS_ObjC_Extension.framework */; }; + C46B36D00F282572B5747D71 /* Pods_Example_iOS_ObjC.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 43D84745AE558B974A2E64F7 /* Pods_Example_iOS_ObjC.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -81,9 +81,9 @@ 34CB09BB1C42007600A54261 /* AppAuthExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppAuthExampleViewController.m; sourceTree = ""; }; 34CB09BC1C42007600A54261 /* AppAuthExampleViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AppAuthExampleViewController.xib; sourceTree = ""; }; 3A18DF082AC2FA0980C9DE57 /* Pods-Example-iOS_ObjC_Extension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-iOS_ObjC_Extension.release.xcconfig"; path = "Pods/Target Support Files/Pods-Example-iOS_ObjC_Extension/Pods-Example-iOS_ObjC_Extension.release.xcconfig"; sourceTree = ""; }; - 715EDB7EC4271193E47615ED /* libPods-Example-iOS_ObjC_Extension.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Example-iOS_ObjC_Extension.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 3CC004951DF03519C52500EC /* Pods_Example_iOS_ObjC_Extension.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example_iOS_ObjC_Extension.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 43D84745AE558B974A2E64F7 /* Pods_Example_iOS_ObjC.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example_iOS_ObjC.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 86C7660572AE6FF7A4D1592A /* Pods-Example-iOS_ObjC_Extension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-iOS_ObjC_Extension.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Example-iOS_ObjC_Extension/Pods-Example-iOS_ObjC_Extension.debug.xcconfig"; sourceTree = ""; }; - 8B61A918CBE7B8142CD7D8B3 /* libPods-Example-iOS_ObjC.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Example-iOS_ObjC.a"; sourceTree = BUILT_PRODUCTS_DIR; }; C4C31DB4A4928F246AA03805 /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig"; sourceTree = ""; }; D9867DC6FA9089CD613D4728 /* Pods-Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Example/Pods-Example.debug.xcconfig"; sourceTree = ""; }; ECBCCC4A1A779C83C72044F2 /* Pods-Example-iOS_ObjC.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-iOS_ObjC.release.xcconfig"; path = "Pods/Target Support Files/Pods-Example-iOS_ObjC/Pods-Example-iOS_ObjC.release.xcconfig"; sourceTree = ""; }; @@ -95,7 +95,7 @@ buildActionMask = 2147483647; files = ( 06D4812F2055C3D400D9DC32 /* NotificationCenter.framework in Frameworks */, - D0B5FA33D74A6F7924A47471 /* libPods-Example-iOS_ObjC_Extension.a in Frameworks */, + BE28448F8FD76A9C12A30150 /* Pods_Example_iOS_ObjC_Extension.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -111,7 +111,7 @@ buildActionMask = 2147483647; files = ( 346E91991C2A245000D3620B /* SafariServices.framework in Frameworks */, - E46F8589CE9E5DDFA69D835B /* libPods-Example-iOS_ObjC.a in Frameworks */, + C46B36D00F282572B5747D71 /* Pods_Example_iOS_ObjC.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -145,9 +145,9 @@ 3474C8DD1DFCB08E00F22B34 /* libAppAuth-iOS.a */, 346E91981C2A245000D3620B /* SafariServices.framework */, 09795EAF079B07A1781675D9 /* libPods-Example.a */, - 8B61A918CBE7B8142CD7D8B3 /* libPods-Example-iOS_ObjC.a */, 06D4812E2055C3D400D9DC32 /* NotificationCenter.framework */, - 715EDB7EC4271193E47615ED /* libPods-Example-iOS_ObjC_Extension.a */, + 43D84745AE558B974A2E64F7 /* Pods_Example_iOS_ObjC.framework */, + 3CC004951DF03519C52500EC /* Pods_Example_iOS_ObjC_Extension.framework */, ); name = Frameworks; sourceTree = ""; @@ -252,6 +252,7 @@ 346E91661C29D42800D3620B /* Frameworks */, 346E91671C29D42800D3620B /* Resources */, 06D4813E2055C3D400D9DC32 /* Embed App Extensions */, + 0B7CB92A32140E833CA8FF89 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -301,6 +302,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -345,6 +347,24 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 0B7CB92A32140E833CA8FF89 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Example-iOS_ObjC/Pods-Example-iOS_ObjC-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/AppAuth/AppAuth.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AppAuth.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Example-iOS_ObjC/Pods-Example-iOS_ObjC-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; 836219F293F319703A16E68D /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -468,7 +488,7 @@ DEVELOPMENT_TEAM = ""; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "Example-iOS_ObjC_Extension/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "net.openid.appauth.Example.Example-iOS-ObjC-Extension"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -500,7 +520,7 @@ DEVELOPMENT_TEAM = ""; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "Example-iOS_ObjC_Extension/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "net.openid.appauth.Example.Example-iOS-ObjC-Extension"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -520,7 +540,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Tests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = net.openid.AppAuthExampleTests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -539,7 +559,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Tests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = net.openid.AppAuthExampleTests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -642,7 +662,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Source/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = net.openid.appauth.Example; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -658,7 +678,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Source/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = net.openid.appauth.Example; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/Examples/Example-iOS_ObjC/Podfile b/Examples/Example-iOS_ObjC/Podfile index a4354d010..600de7d10 100644 --- a/Examples/Example-iOS_ObjC/Podfile +++ b/Examples/Example-iOS_ObjC/Podfile @@ -1,4 +1,6 @@ -platform :ios, '9.0' +platform :ios, '11.0' + +use_frameworks! target 'Example-iOS_ObjC' do # AppAuth Pod diff --git a/Examples/Example-iOS_ObjC/Source/AppAuthExampleViewController.m b/Examples/Example-iOS_ObjC/Source/AppAuthExampleViewController.m index d67c7b73d..a4accb51b 100644 --- a/Examples/Example-iOS_ObjC/Source/AppAuthExampleViewController.m +++ b/Examples/Example-iOS_ObjC/Source/AppAuthExampleViewController.m @@ -179,9 +179,10 @@ - (void)doClientRegistration:(OIDServiceConfiguration *)configuration grantTypes:nil subjectType:nil tokenEndpointAuthMethod:@"client_secret_post" - additionalParameters:nil - additionalHeaders:nil]; - // performs registration request + initialAccessToken:nil + additionalParameters:nil]; + + // performs registration request [self logMessage:@"Initiating registration request"]; [OIDAuthorizationService performRegistrationRequest:request diff --git a/Examples/Example-macOS/Example-macOS.xcodeproj/project.pbxproj b/Examples/Example-macOS/Example-macOS.xcodeproj/project.pbxproj index 8990ba02e..13bb1c957 100644 --- a/Examples/Example-macOS/Example-macOS.xcodeproj/project.pbxproj +++ b/Examples/Example-macOS/Example-macOS.xcodeproj/project.pbxproj @@ -156,7 +156,6 @@ F6016E6C1D2AC11F003497D7 /* Sources */, F6016E6D1D2AC11F003497D7 /* Frameworks */, F6016E6E1D2AC11F003497D7 /* Resources */, - 52872C7E76CB3EA69F4392F7 /* [CP] Embed Pods Frameworks */, 1C5B2EF60536044DE119E500 /* [CP] Copy Pods Resources */, ); buildRules = ( @@ -192,6 +191,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -233,28 +233,18 @@ files = ( ); inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Example-macOS/Pods-Example-macOS-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/AppAuth/AppAuthCore_Privacy.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/AppAuth/AppAuthExternalUserAgent_Privacy.bundle", ); name = "[CP] Copy Pods Resources"; outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AppAuthCore_Privacy.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AppAuthExternalUserAgent_Privacy.bundle", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example-macOS/Pods-Example-macOS-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 52872C7E76CB3EA69F4392F7 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example-macOS/Pods-Example-macOS-frameworks.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Example-macOS/Pods-Example-macOS-resources.sh\"\n"; showEnvVarsInLog = 0; }; C9395BB900D0A44A3F7EB0BE /* [CP] Check Pods Manifest.lock */ = { @@ -263,13 +253,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Example-macOS-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -446,6 +439,7 @@ COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = "$(SRCROOT)/Source/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.12; PRODUCT_BUNDLE_IDENTIFIER = "net.openid.appauth.Example-macOS"; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -459,6 +453,7 @@ COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = "$(SRCROOT)/Source/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.12; PRODUCT_BUNDLE_IDENTIFIER = "net.openid.appauth.Example-macOS"; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -474,6 +469,7 @@ 341AA4C81E7F2E5000FCA5C6 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; F6016E6B1D2AC11E003497D7 /* Build configuration list for PBXProject "Example-macOS" */ = { isa = XCConfigurationList; diff --git a/Examples/Example-macOS/Podfile b/Examples/Example-macOS/Podfile index 5b8ce01ab..e0c0aced9 100644 --- a/Examples/Example-macOS/Podfile +++ b/Examples/Example-macOS/Podfile @@ -1,5 +1,5 @@ target 'Example-macOS' do - platform :osx, '10.10' + platform :osx, '10.12' # AppAuth Pod # In production, just use `pod 'AppAuth'` without the path reference. diff --git a/Examples/Example-tvOS/Example-tvOS.xcodeproj/project.pbxproj b/Examples/Example-tvOS/Example-tvOS.xcodeproj/project.pbxproj index c70129f75..b2e8a7d1a 100644 --- a/Examples/Example-tvOS/Example-tvOS.xcodeproj/project.pbxproj +++ b/Examples/Example-tvOS/Example-tvOS.xcodeproj/project.pbxproj @@ -13,7 +13,7 @@ 2D91B7B0248EA17D0005B197 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2D91B7AF248EA17D0005B197 /* Assets.xcassets */; }; 2D91B7B3248EA17D0005B197 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2D91B7B1248EA17D0005B197 /* LaunchScreen.storyboard */; }; 2D91B7B6248EA17E0005B197 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D91B7B5248EA17E0005B197 /* main.m */; }; - 424A8D8BA4EB0A6C9FF4326A /* libPods-Example-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EEBF9489D390F9D0913AE178 /* libPods-Example-tvOS.a */; }; + FEFBCAF105C70E934E5A4975 /* Pods_Example_tvOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F58A1FCA981D60A0EA8A3E5A /* Pods_Example_tvOS.framework */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -29,7 +29,7 @@ 2D91B7B4248EA17D0005B197 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 2D91B7B5248EA17E0005B197 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; D33A601E3AA7C8647C857C08 /* Pods-Example-tvOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-tvOS.debug.xcconfig"; path = "Target Support Files/Pods-Example-tvOS/Pods-Example-tvOS.debug.xcconfig"; sourceTree = ""; }; - EEBF9489D390F9D0913AE178 /* libPods-Example-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Example-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + F58A1FCA981D60A0EA8A3E5A /* Pods_Example_tvOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example_tvOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -37,7 +37,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 424A8D8BA4EB0A6C9FF4326A /* libPods-Example-tvOS.a in Frameworks */, + FEFBCAF105C70E934E5A4975 /* Pods_Example_tvOS.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -81,7 +81,7 @@ 9CCA3BB0D6EA112455518E2C /* Frameworks */ = { isa = PBXGroup; children = ( - EEBF9489D390F9D0913AE178 /* libPods-Example-tvOS.a */, + F58A1FCA981D60A0EA8A3E5A /* Pods_Example_tvOS.framework */, ); name = Frameworks; sourceTree = ""; @@ -106,6 +106,7 @@ 2D91B79F248EA17C0005B197 /* Sources */, 2D91B7A0248EA17C0005B197 /* Frameworks */, 2D91B7A1248EA17C0005B197 /* Resources */, + C86108A8D245915451E09E53 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -184,6 +185,23 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; + C86108A8D245915451E09E53 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Example-tvOS/Pods-Example-tvOS-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Example-tvOS/Pods-Example-tvOS-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Example-tvOS/Pods-Example-tvOS-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.m b/Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.m index e97b0d204..1cdfb5ccf 100644 --- a/Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.m +++ b/Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.m @@ -175,9 +175,8 @@ - (void)performAuthorizationWithConfiguration:(OIDTVServiceConfiguration *)confi [[OIDTVAuthorizationRequest alloc] initWithConfiguration:configuration clientId:kClientID clientSecret:kClientSecret - scopes:@[ OIDScopeOpenID, OIDScopeProfile ] - additionalParameters:nil - additionalHeaders:nil]; + scopes:@[ OIDScopeOpenID, OIDScopeProfile ] + additionalParameters:nil]; OIDTVAuthorizationInitialization initBlock = ^(OIDTVAuthorizationResponse *_Nullable response, NSError *_Nullable error) { diff --git a/Examples/Example-tvOS/Podfile b/Examples/Example-tvOS/Podfile index 979341635..3e7ac1135 100644 --- a/Examples/Example-tvOS/Podfile +++ b/Examples/Example-tvOS/Podfile @@ -1,5 +1,7 @@ platform :tvos, '9.0' +use_frameworks! + target 'Example-tvOS' do # AppAuth Pod, TV subspec # In production, just use `pod 'AppAuth/TV'` without the path reference. diff --git a/Package.swift b/Package.swift index ae72258ac..820e74a6e 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.1 +// swift-tools-version:5.3 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -44,6 +44,7 @@ let package = Package( .target( name: "AppAuthCore", path: "Source/AppAuthCore", + resources: [.copy("../../PrivacyInfo.xcprivacy")], publicHeadersPath: "" ), .target( @@ -51,6 +52,7 @@ let package = Package( dependencies: ["AppAuthCore"], path: "Source/AppAuth", sources: ["iOS", "macOS"], + resources: [.copy("../../PrivacyInfo.xcprivacy")], publicHeadersPath: "", cSettings: [ .headerSearchPath("iOS"), @@ -62,6 +64,7 @@ let package = Package( name: "AppAuthTV", dependencies: ["AppAuthCore"], path: "Source/AppAuthTV", + resources: [.copy("../../PrivacyInfo.xcprivacy")], publicHeadersPath: "" ), .testTarget( diff --git a/PrivacyInfo.xcprivacy b/PrivacyInfo.xcprivacy new file mode 100644 index 000000000..33b390120 --- /dev/null +++ b/PrivacyInfo.xcprivacy @@ -0,0 +1,18 @@ + + + + + NSPrivacyAccessedAPITypes + + + + NSPrivacyCollectedDataTypes + + + + NSPrivacyTrackingDomains + + NSPrivacyTracking + + + From 4625d9d5e084958d2af9bebf7387da72dbf3385f Mon Sep 17 00:00:00 2001 From: mdmathias Date: Fri, 8 Mar 2024 13:02:13 -0800 Subject: [PATCH 70/81] Prepare for 1.7.0 release (#823) --- AppAuth.podspec | 2 +- CHANGELOG.md | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/AppAuth.podspec b/AppAuth.podspec index 325690783..c9efaffff 100644 --- a/AppAuth.podspec +++ b/AppAuth.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "AppAuth" - s.version = "1.6.2" + s.version = "1.7.0" s.summary = "AppAuth for iOS and macOS is a client SDK for communicating with OAuth 2.0 and OpenID Connect providers." s.description = <<-DESC diff --git a/CHANGELOG.md b/CHANGELOG.md index b682c8a8b..71c7e3bbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# 1.7.0 +- Introduce addtional http headers to OIDTokenRequest ([#770](https://github.com/openid/AppAuth-iOS/pull/770)) +- Fix nullability annotation for -[OIDExternalUserAgentIOS init] ([#727](https://github.com/openid/AppAuth-iOS/pull/727)) +- Feat: allow custom nonce in OIDAuthorizationRequest ([#788](https://github.com/openid/AppAuth-iOS/pull/788)) +- Introduce addtional http headers to OIDTokenRequest ([#770](https://github.com/openid/AppAuth-iOS/pull/770)) +- Add privacy manifest ([#822](https://github.com/openid/AppAuth-iOS/pull/822)) + # 1.6.2 - Increased minimum iOS and macOS versions to 9.0 and 10.12 respectively to fix [framework build issue](https://github.com/openid/AppAuth-iOS/issues/765) From 4b6948f8a60b1ea72a179632cfef7ab99dc527db Mon Sep 17 00:00:00 2001 From: mdmathias Date: Fri, 8 Mar 2024 16:08:05 -0800 Subject: [PATCH 71/81] Add back missing method to OIDAuthorizationResponse (#825) --- .../xcschemes/AppAuth-iOS.xcscheme | 22 ++++++++----------- .../xcschemes/AppAuth-tvOS.xcscheme | 22 ++++++++----------- Source/AppAuthCore/OIDAuthorizationResponse.h | 11 ++++++++++ Source/AppAuthCore/OIDAuthorizationResponse.m | 6 +++++ 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuth-iOS.xcscheme b/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuth-iOS.xcscheme index 5c03fe8e1..d2886e5ea 100644 --- a/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuth-iOS.xcscheme +++ b/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuth-iOS.xcscheme @@ -27,6 +27,15 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> + + + + @@ -39,17 +48,6 @@ - - - - - - - - + + + + @@ -39,17 +48,6 @@ - - - - - - - - *)additionalParameters; + +/*! @brief Creates a token request suitable for exchanging an authorization code for an access + token. + @param additionalParameters Additional parameters for the token request. + @param additionalHeaders Additional headers for the token request. + @return A @c OIDTokenRequest suitable for exchanging an authorization code for an access + token. + @see https://tools.ietf.org/html/rfc6749#section-4.1.3 + */ - (nullable OIDTokenRequest *)tokenExchangeRequestWithAdditionalParameters: (nullable NSDictionary *)additionalParameters additionalHeaders: diff --git a/Source/AppAuthCore/OIDAuthorizationResponse.m b/Source/AppAuthCore/OIDAuthorizationResponse.m index 5c998a966..957f81d3a 100644 --- a/Source/AppAuthCore/OIDAuthorizationResponse.m +++ b/Source/AppAuthCore/OIDAuthorizationResponse.m @@ -187,6 +187,12 @@ - (OIDTokenRequest *)tokenExchangeRequest { return [self tokenExchangeRequestWithAdditionalParameters:nil additionalHeaders:nil]; } +- (OIDTokenRequest *)tokenExchangeRequestWithAdditionalParameters: + (NSDictionary *)additionalParameters { + return [self tokenExchangeRequestWithAdditionalParameters:additionalParameters + additionalHeaders:nil]; +} + - (OIDTokenRequest *)tokenExchangeRequestWithAdditionalParameters: (NSDictionary *)additionalParameters additionalHeaders: From 2bd00a29745d3baaef75d918b48db045bcdc94d1 Mon Sep 17 00:00:00 2001 From: mdmathias Date: Fri, 8 Mar 2024 17:08:03 -0800 Subject: [PATCH 72/81] Fix OIDTokenRequest for AppAuthCore and AppAuthTV (#826) --- .../xcschemes/AppAuth-macOS.xcscheme | 22 ++++----- Source/AppAuthCore/OIDTokenRequest.h | 49 +++++++++++++++++++ Source/AppAuthCore/OIDTokenRequest.m | 46 +++++++++++++++++ Source/AppAuthTV/OIDTVTokenRequest.h | 14 ++++++ Source/AppAuthTV/OIDTVTokenRequest.m | 13 +++++ 5 files changed, 131 insertions(+), 13 deletions(-) diff --git a/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuth-macOS.xcscheme b/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuth-macOS.xcscheme index aa261aca6..74b33a822 100644 --- a/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuth-macOS.xcscheme +++ b/AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuth-macOS.xcscheme @@ -27,6 +27,15 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> + + + + @@ -39,17 +48,6 @@ - - - - - - - - *)scopes + refreshToken:(nullable NSString *)refreshToken + codeVerifier:(nullable NSString *)codeVerifier + additionalParameters:(nullable NSDictionary *)additionalParameters; + +/*! @param configuration The service's configuration. + @param grantType the type of token being sent to the token endpoint, i.e. "authorization_code" + for the authorization code exchange, or "refresh_token" for an access token refresh request. + @see OIDGrantTypes.h + @param code The authorization code received from the authorization server. + @param redirectURL The client's redirect URI. + @param clientID The client identifier. + @param clientSecret The client secret. + @param scope The value of the scope parameter is expressed as a list of space-delimited, + case-sensitive strings. + @param refreshToken The refresh token. + @param codeVerifier The PKCE code verifier. + @param additionalParameters The client's additional token request parameters. + */ +- (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration + grantType:(NSString *)grantType + authorizationCode:(nullable NSString *)code + redirectURL:(nullable NSURL *)redirectURL + clientID:(NSString *)clientID + clientSecret:(nullable NSString *)clientSecret + scope:(nullable NSString *)scope + refreshToken:(nullable NSString *)refreshToken + codeVerifier:(nullable NSString *)codeVerifier + additionalParameters:(nullable NSDictionary *)additionalParameters; + /*! @param configuration The service's configuration. @param grantType the type of token being sent to the token endpoint, i.e. "authorization_code" for the authorization code exchange, or "refresh_token" for an access token refresh request. diff --git a/Source/AppAuthCore/OIDTokenRequest.m b/Source/AppAuthCore/OIDTokenRequest.m index e09e5577d..6d30b6d6b 100644 --- a/Source/AppAuthCore/OIDTokenRequest.m +++ b/Source/AppAuthCore/OIDTokenRequest.m @@ -89,6 +89,52 @@ - (instancetype)init additionalHeaders:) ) +- (instancetype)initWithConfiguration:(nonnull OIDServiceConfiguration *)configuration + grantType:(nonnull NSString *)grantType + authorizationCode:(nullable NSString *)code + redirectURL:(nullable NSURL *)redirectURL + clientID:(nonnull NSString *)clientID + clientSecret:(nullable NSString *)clientSecret + scopes:(nullable NSArray *)scopes + refreshToken:(nullable NSString *)refreshToken + codeVerifier:(nullable NSString *)codeVerifier + additionalParameters:(nullable NSDictionary *)additionalParameters { + return [self initWithConfiguration:configuration + grantType:grantType + authorizationCode:code + redirectURL:redirectURL + clientID:clientID + clientSecret:clientSecret + scopes:scopes + refreshToken:refreshToken + codeVerifier:codeVerifier + additionalParameters:additionalParameters + additionalHeaders:_additionalHeaders]; +} + +- (instancetype)initWithConfiguration:(nonnull OIDServiceConfiguration *)configuration + grantType:(nonnull NSString *)grantType + authorizationCode:(nullable NSString *)code + redirectURL:(nullable NSURL *)redirectURL + clientID:(nonnull NSString *)clientID + clientSecret:(nullable NSString *)clientSecret + scope:(nullable NSString *)scope + refreshToken:(nullable NSString *)refreshToken + codeVerifier:(nullable NSString *)codeVerifier + additionalParameters:(nullable NSDictionary *)additionalParameters { + return [self initWithConfiguration:configuration + grantType:grantType + authorizationCode:code + redirectURL:redirectURL + clientID:clientID + clientSecret:clientSecret + scope:scope + refreshToken:refreshToken + codeVerifier:codeVerifier + additionalParameters:additionalParameters + additionalHeaders:_additionalHeaders]; +} + - (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration grantType:(NSString *)grantType authorizationCode:(nullable NSString *)code diff --git a/Source/AppAuthTV/OIDTVTokenRequest.h b/Source/AppAuthTV/OIDTVTokenRequest.h index 021dc9b9d..8643b4cc5 100644 --- a/Source/AppAuthTV/OIDTVTokenRequest.h +++ b/Source/AppAuthTV/OIDTVTokenRequest.h @@ -80,6 +80,20 @@ NS_ASSUME_NONNULL_BEGIN (nullable NSDictionary *)additionalHeaders NS_UNAVAILABLE; +/*! @brief Designated initializer. + @param configuration The service's configuration. + @param deviceCode The device verification code received from the authorization server. + @param clientID The client identifier. + @param clientSecret The client secret (nullable). + @param additionalParameters The client's additional token request parameters. +*/ +- (instancetype)initWithConfiguration:(OIDTVServiceConfiguration *)configuration + deviceCode:(NSString *)deviceCode + clientID:(NSString *)clientID + clientSecret:(nullable NSString *)clientSecret + additionalParameters: + (nullable NSDictionary *)additionalParameters; + /*! @brief Designated initializer. @param configuration The service's configuration. @param deviceCode The device verification code received from the authorization server. diff --git a/Source/AppAuthTV/OIDTVTokenRequest.m b/Source/AppAuthTV/OIDTVTokenRequest.m index ed5e4d3f2..0878c7934 100644 --- a/Source/AppAuthTV/OIDTVTokenRequest.m +++ b/Source/AppAuthTV/OIDTVTokenRequest.m @@ -90,6 +90,19 @@ - (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration additionalHeaders: )) +- (instancetype)initWithConfiguration:(OIDTVServiceConfiguration *)configuration + deviceCode:(NSString *)deviceCode + clientID:(NSString *)clientID + clientSecret:(NSString *)clientSecret + additionalParameters:(NSDictionary *)additionalParameters { + return [self initWithConfiguration:configuration + deviceCode:deviceCode + clientID:clientID + clientSecret:clientSecret + additionalParameters:additionalParameters + additionalHeaders:nil]; +} + - (instancetype)initWithConfiguration:(OIDTVServiceConfiguration *)configuration deviceCode:(NSString *)deviceCode clientID:(NSString *)clientID From 059f77eb1ccf015a6f5b88cb450376dc0707e1b6 Mon Sep 17 00:00:00 2001 From: mdmathias Date: Fri, 8 Mar 2024 17:33:53 -0800 Subject: [PATCH 73/81] Prep for patch release fixing broken API change (#827) --- AppAuth.podspec | 2 +- CHANGELOG.md | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/AppAuth.podspec b/AppAuth.podspec index c9efaffff..5df6b76fe 100644 --- a/AppAuth.podspec +++ b/AppAuth.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "AppAuth" - s.version = "1.7.0" + s.version = "1.7.1" s.summary = "AppAuth for iOS and macOS is a client SDK for communicating with OAuth 2.0 and OpenID Connect providers." s.description = <<-DESC diff --git a/CHANGELOG.md b/CHANGELOG.md index 71c7e3bbc..a2f0e0fca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,11 @@ +# 1.7.1 +- Add back missing method to OIDAuthorizationResponse ([#825](https://github.com/openid/AppAuth-iOS/pull/825)) +- Fix OIDTokenRequest for AppAuthCore and AppAuthTV ([#826](https://github.com/openid/AppAuth-iOS/pull/826)) + # 1.7.0 - Introduce addtional http headers to OIDTokenRequest ([#770](https://github.com/openid/AppAuth-iOS/pull/770)) - Fix nullability annotation for -[OIDExternalUserAgentIOS init] ([#727](https://github.com/openid/AppAuth-iOS/pull/727)) - Feat: allow custom nonce in OIDAuthorizationRequest ([#788](https://github.com/openid/AppAuth-iOS/pull/788)) -- Introduce addtional http headers to OIDTokenRequest ([#770](https://github.com/openid/AppAuth-iOS/pull/770)) - Add privacy manifest ([#822](https://github.com/openid/AppAuth-iOS/pull/822)) # 1.6.2 From 97b19039d34d07e313fd7f68317c81d501003722 Mon Sep 17 00:00:00 2001 From: mdmathias Date: Mon, 11 Mar 2024 10:46:37 -0700 Subject: [PATCH 74/81] Streamline copying of privacy manifest (#830) --- AppAuth.podspec | 6 ------ PrivacyInfo.xcprivacy | 2 -- 2 files changed, 8 deletions(-) diff --git a/AppAuth.podspec b/AppAuth.podspec index 5df6b76fe..27f2fac3a 100644 --- a/AppAuth.podspec +++ b/AppAuth.podspec @@ -54,9 +54,6 @@ It follows the OAuth 2.0 for Native Apps best current practice externalUserAgent.dependency 'AppAuth/Core' externalUserAgent.source_files = "Source/AppAuth.h", "Source/AppAuth/*.{h,m}" - externalUserAgent.resource_bundles = { - "AppAuthExternalUserAgent_Privacy" => ["PrivacyInfo.xcprivacy"] - } # iOS externalUserAgent.ios.source_files = "Source/AppAuth/iOS/**/*.{h,m}" @@ -74,9 +71,6 @@ It follows the OAuth 2.0 for Native Apps best current practice s.subspec 'TV' do |tv| tv.source_files = "Source/AppAuthTV.h", "Source/AppAuthTV/*.{h,m}" tv.dependency 'AppAuth/Core' - tv.resource_bundles = { - "AppAuthTV" => ["PrivacyInfo.xcprivacy"] - } end s.default_subspecs = 'Core', 'ExternalUserAgent' diff --git a/PrivacyInfo.xcprivacy b/PrivacyInfo.xcprivacy index 33b390120..cc6746dcb 100644 --- a/PrivacyInfo.xcprivacy +++ b/PrivacyInfo.xcprivacy @@ -4,11 +4,9 @@ NSPrivacyAccessedAPITypes - NSPrivacyCollectedDataTypes - NSPrivacyTrackingDomains From 269c90515328c24f90b2ed17a67c8a796b485448 Mon Sep 17 00:00:00 2001 From: mdmathias Date: Mon, 11 Mar 2024 11:16:35 -0700 Subject: [PATCH 75/81] Prep patch release fixing errors in privacy reports (#831) --- AppAuth.podspec | 2 +- CHANGELOG.md | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/AppAuth.podspec b/AppAuth.podspec index 27f2fac3a..a328e6be5 100644 --- a/AppAuth.podspec +++ b/AppAuth.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "AppAuth" - s.version = "1.7.1" + s.version = "1.7.2" s.summary = "AppAuth for iOS and macOS is a client SDK for communicating with OAuth 2.0 and OpenID Connect providers." s.description = <<-DESC diff --git a/CHANGELOG.md b/CHANGELOG.md index a2f0e0fca..12e915e1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 1.7.2 + - Streamline copying of privacy manifest ([#830](https://github.com/openid/AppAuth-iOS/pull/830)) + # 1.7.1 - Add back missing method to OIDAuthorizationResponse ([#825](https://github.com/openid/AppAuth-iOS/pull/825)) - Fix OIDTokenRequest for AppAuthCore and AppAuthTV ([#826](https://github.com/openid/AppAuth-iOS/pull/826)) From 5563d068aac2bbcadd081a1e26e9cf0dbe8af8ba Mon Sep 17 00:00:00 2001 From: mdmathias Date: Wed, 13 Mar 2024 13:26:42 -0700 Subject: [PATCH 76/81] Fix missing manifest in bundle using SPM (#833) --- AppAuth.podspec | 12 ++-- AppAuth.xcodeproj/project.pbxproj | 56 +++++++++++++------ Package.swift | 12 ++-- {Source => Sources}/AppAuth.h | 0 .../AppAuth/Resources/PrivacyInfo.xcprivacy | 0 .../AppAuth/iOS/OIDAuthState+IOS.h | 0 .../AppAuth/iOS/OIDAuthState+IOS.m | 0 .../AppAuth/iOS/OIDAuthorizationService+IOS.h | 0 .../AppAuth/iOS/OIDAuthorizationService+IOS.m | 0 .../iOS/OIDExternalUserAgentCatalyst.h | 0 .../iOS/OIDExternalUserAgentCatalyst.m | 0 .../AppAuth/iOS/OIDExternalUserAgentIOS.h | 0 .../AppAuth/iOS/OIDExternalUserAgentIOS.m | 0 .../OIDExternalUserAgentIOSCustomBrowser.h | 0 .../OIDExternalUserAgentIOSCustomBrowser.m | 0 .../OIDLoopbackHTTPServer.h | 0 .../OIDLoopbackHTTPServer.m | 0 .../AppAuth/macOS/OIDAuthState+Mac.h | 0 .../AppAuth/macOS/OIDAuthState+Mac.m | 0 .../macOS/OIDAuthorizationService+Mac.h | 0 .../macOS/OIDAuthorizationService+Mac.m | 0 .../AppAuth/macOS/OIDExternalUserAgentMac.h | 0 .../AppAuth/macOS/OIDExternalUserAgentMac.m | 0 .../AppAuth/macOS/OIDRedirectHTTPHandler.h | 0 .../AppAuth/macOS/OIDRedirectHTTPHandler.m | 0 {Source => Sources}/AppAuthCore.h | 0 .../AppAuthCore/OIDAuthState.h | 0 .../AppAuthCore/OIDAuthState.m | 0 .../AppAuthCore/OIDAuthStateChangeDelegate.h | 0 .../AppAuthCore/OIDAuthStateErrorDelegate.h | 0 .../AppAuthCore/OIDAuthorizationRequest.h | 0 .../AppAuthCore/OIDAuthorizationRequest.m | 0 .../AppAuthCore/OIDAuthorizationResponse.h | 0 .../AppAuthCore/OIDAuthorizationResponse.m | 0 .../AppAuthCore/OIDAuthorizationService.h | 0 .../AppAuthCore/OIDAuthorizationService.m | 0 .../AppAuthCore/OIDClientMetadataParameters.h | 0 .../AppAuthCore/OIDClientMetadataParameters.m | 0 {Source => Sources}/AppAuthCore/OIDDefines.h | 0 .../AppAuthCore/OIDEndSessionRequest.h | 0 .../AppAuthCore/OIDEndSessionRequest.m | 0 .../AppAuthCore/OIDEndSessionResponse.h | 0 .../AppAuthCore/OIDEndSessionResponse.m | 0 {Source => Sources}/AppAuthCore/OIDError.h | 0 {Source => Sources}/AppAuthCore/OIDError.m | 0 .../AppAuthCore/OIDErrorUtilities.h | 0 .../AppAuthCore/OIDErrorUtilities.m | 0 .../AppAuthCore/OIDExternalUserAgent.h | 0 .../AppAuthCore/OIDExternalUserAgentRequest.h | 0 .../AppAuthCore/OIDExternalUserAgentSession.h | 0 .../AppAuthCore/OIDFieldMapping.h | 0 .../AppAuthCore/OIDFieldMapping.m | 0 .../AppAuthCore/OIDGrantTypes.h | 0 .../AppAuthCore/OIDGrantTypes.m | 0 {Source => Sources}/AppAuthCore/OIDIDToken.h | 0 {Source => Sources}/AppAuthCore/OIDIDToken.m | 0 .../AppAuthCore/OIDRegistrationRequest.h | 0 .../AppAuthCore/OIDRegistrationRequest.m | 0 .../AppAuthCore/OIDRegistrationResponse.h | 0 .../AppAuthCore/OIDRegistrationResponse.m | 0 .../AppAuthCore/OIDResponseTypes.h | 0 .../AppAuthCore/OIDResponseTypes.m | 0 .../AppAuthCore/OIDScopeUtilities.h | 0 .../AppAuthCore/OIDScopeUtilities.m | 0 {Source => Sources}/AppAuthCore/OIDScopes.h | 0 {Source => Sources}/AppAuthCore/OIDScopes.m | 0 .../AppAuthCore/OIDServiceConfiguration.h | 0 .../AppAuthCore/OIDServiceConfiguration.m | 0 .../AppAuthCore/OIDServiceDiscovery.h | 0 .../AppAuthCore/OIDServiceDiscovery.m | 0 .../AppAuthCore/OIDTokenRequest.h | 0 .../AppAuthCore/OIDTokenRequest.m | 0 .../AppAuthCore/OIDTokenResponse.h | 0 .../AppAuthCore/OIDTokenResponse.m | 0 .../AppAuthCore/OIDTokenUtilities.h | 0 .../AppAuthCore/OIDTokenUtilities.m | 0 .../AppAuthCore/OIDURLQueryComponent.h | 0 .../AppAuthCore/OIDURLQueryComponent.m | 0 .../AppAuthCore/OIDURLSessionProvider.h | 0 .../AppAuthCore/OIDURLSessionProvider.m | 0 .../Resources/PrivacyInfo.xcprivacy | 16 ++++++ {Source => Sources}/AppAuthTV.h | 0 .../AppAuthTV/OIDTVAuthorizationRequest.h | 0 .../AppAuthTV/OIDTVAuthorizationRequest.m | 0 .../AppAuthTV/OIDTVAuthorizationResponse.h | 0 .../AppAuthTV/OIDTVAuthorizationResponse.m | 0 .../AppAuthTV/OIDTVAuthorizationService.h | 0 .../AppAuthTV/OIDTVAuthorizationService.m | 0 .../AppAuthTV/OIDTVServiceConfiguration.h | 0 .../AppAuthTV/OIDTVServiceConfiguration.m | 0 .../AppAuthTV/OIDTVTokenRequest.h | 0 .../AppAuthTV/OIDTVTokenRequest.m | 0 .../AppAuthTV/Resources/PrivacyInfo.xcprivacy | 16 ++++++ .../CoreFramework/AppAuthCore.h | 0 {Source => Sources}/CoreFramework/Info.plist | 0 {Source => Sources}/Framework/AppAuth.h | 0 {Source => Sources}/Framework/Info.plist | 0 {Source => Sources}/TVFramework/AppAuthTV.h | 0 {Source => Sources}/TVFramework/Info.plist | 0 .../OIDTVAuthorizationRequestTests.m | 8 +-- .../OIDTVAuthorizationResponseTests.m | 12 ++-- UnitTests/AppAuthTV/OIDTVTokenRequestTests.m | 10 ++-- UnitTests/OIDAuthStateTests.h | 4 +- UnitTests/OIDAuthStateTests.m | 10 ++-- UnitTests/OIDAuthorizationRequestTests.m | 6 +- UnitTests/OIDAuthorizationResponseTests.m | 6 +- UnitTests/OIDEndSessionRequestTests.m | 6 +- UnitTests/OIDGrantTypesTests.m | 2 +- UnitTests/OIDRegistrationRequestTests.m | 6 +- UnitTests/OIDRegistrationResponseTests.m | 4 +- UnitTests/OIDResponseTypesTests.m | 2 +- UnitTests/OIDScopesTests.m | 2 +- UnitTests/OIDServiceConfigurationTests.m | 8 +-- UnitTests/OIDServiceDiscoveryTests.m | 4 +- UnitTests/OIDTokenRequestTests.m | 10 ++-- UnitTests/OIDTokenResponseTests.m | 4 +- UnitTests/OIDTokenUtilitiesTests.m | 2 +- UnitTests/OIDURLQueryComponentTests.m | 2 +- UnitTests/OIDURLQueryComponentTestsIOS7.m | 2 +- 119 files changed, 139 insertions(+), 83 deletions(-) rename {Source => Sources}/AppAuth.h (100%) rename PrivacyInfo.xcprivacy => Sources/AppAuth/Resources/PrivacyInfo.xcprivacy (100%) rename {Source => Sources}/AppAuth/iOS/OIDAuthState+IOS.h (100%) rename {Source => Sources}/AppAuth/iOS/OIDAuthState+IOS.m (100%) rename {Source => Sources}/AppAuth/iOS/OIDAuthorizationService+IOS.h (100%) rename {Source => Sources}/AppAuth/iOS/OIDAuthorizationService+IOS.m (100%) rename {Source => Sources}/AppAuth/iOS/OIDExternalUserAgentCatalyst.h (100%) rename {Source => Sources}/AppAuth/iOS/OIDExternalUserAgentCatalyst.m (100%) rename {Source => Sources}/AppAuth/iOS/OIDExternalUserAgentIOS.h (100%) rename {Source => Sources}/AppAuth/iOS/OIDExternalUserAgentIOS.m (100%) rename {Source => Sources}/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.h (100%) rename {Source => Sources}/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.m (100%) rename {Source => Sources}/AppAuth/macOS/LoopbackHTTPServer/OIDLoopbackHTTPServer.h (100%) rename {Source => Sources}/AppAuth/macOS/LoopbackHTTPServer/OIDLoopbackHTTPServer.m (100%) rename {Source => Sources}/AppAuth/macOS/OIDAuthState+Mac.h (100%) rename {Source => Sources}/AppAuth/macOS/OIDAuthState+Mac.m (100%) rename {Source => Sources}/AppAuth/macOS/OIDAuthorizationService+Mac.h (100%) rename {Source => Sources}/AppAuth/macOS/OIDAuthorizationService+Mac.m (100%) rename {Source => Sources}/AppAuth/macOS/OIDExternalUserAgentMac.h (100%) rename {Source => Sources}/AppAuth/macOS/OIDExternalUserAgentMac.m (100%) rename {Source => Sources}/AppAuth/macOS/OIDRedirectHTTPHandler.h (100%) rename {Source => Sources}/AppAuth/macOS/OIDRedirectHTTPHandler.m (100%) rename {Source => Sources}/AppAuthCore.h (100%) rename {Source => Sources}/AppAuthCore/OIDAuthState.h (100%) rename {Source => Sources}/AppAuthCore/OIDAuthState.m (100%) rename {Source => Sources}/AppAuthCore/OIDAuthStateChangeDelegate.h (100%) rename {Source => Sources}/AppAuthCore/OIDAuthStateErrorDelegate.h (100%) rename {Source => Sources}/AppAuthCore/OIDAuthorizationRequest.h (100%) rename {Source => Sources}/AppAuthCore/OIDAuthorizationRequest.m (100%) rename {Source => Sources}/AppAuthCore/OIDAuthorizationResponse.h (100%) rename {Source => Sources}/AppAuthCore/OIDAuthorizationResponse.m (100%) rename {Source => Sources}/AppAuthCore/OIDAuthorizationService.h (100%) rename {Source => Sources}/AppAuthCore/OIDAuthorizationService.m (100%) rename {Source => Sources}/AppAuthCore/OIDClientMetadataParameters.h (100%) rename {Source => Sources}/AppAuthCore/OIDClientMetadataParameters.m (100%) rename {Source => Sources}/AppAuthCore/OIDDefines.h (100%) rename {Source => Sources}/AppAuthCore/OIDEndSessionRequest.h (100%) rename {Source => Sources}/AppAuthCore/OIDEndSessionRequest.m (100%) rename {Source => Sources}/AppAuthCore/OIDEndSessionResponse.h (100%) rename {Source => Sources}/AppAuthCore/OIDEndSessionResponse.m (100%) rename {Source => Sources}/AppAuthCore/OIDError.h (100%) rename {Source => Sources}/AppAuthCore/OIDError.m (100%) rename {Source => Sources}/AppAuthCore/OIDErrorUtilities.h (100%) rename {Source => Sources}/AppAuthCore/OIDErrorUtilities.m (100%) rename {Source => Sources}/AppAuthCore/OIDExternalUserAgent.h (100%) rename {Source => Sources}/AppAuthCore/OIDExternalUserAgentRequest.h (100%) rename {Source => Sources}/AppAuthCore/OIDExternalUserAgentSession.h (100%) rename {Source => Sources}/AppAuthCore/OIDFieldMapping.h (100%) rename {Source => Sources}/AppAuthCore/OIDFieldMapping.m (100%) rename {Source => Sources}/AppAuthCore/OIDGrantTypes.h (100%) rename {Source => Sources}/AppAuthCore/OIDGrantTypes.m (100%) rename {Source => Sources}/AppAuthCore/OIDIDToken.h (100%) rename {Source => Sources}/AppAuthCore/OIDIDToken.m (100%) rename {Source => Sources}/AppAuthCore/OIDRegistrationRequest.h (100%) rename {Source => Sources}/AppAuthCore/OIDRegistrationRequest.m (100%) rename {Source => Sources}/AppAuthCore/OIDRegistrationResponse.h (100%) rename {Source => Sources}/AppAuthCore/OIDRegistrationResponse.m (100%) rename {Source => Sources}/AppAuthCore/OIDResponseTypes.h (100%) rename {Source => Sources}/AppAuthCore/OIDResponseTypes.m (100%) rename {Source => Sources}/AppAuthCore/OIDScopeUtilities.h (100%) rename {Source => Sources}/AppAuthCore/OIDScopeUtilities.m (100%) rename {Source => Sources}/AppAuthCore/OIDScopes.h (100%) rename {Source => Sources}/AppAuthCore/OIDScopes.m (100%) rename {Source => Sources}/AppAuthCore/OIDServiceConfiguration.h (100%) rename {Source => Sources}/AppAuthCore/OIDServiceConfiguration.m (100%) rename {Source => Sources}/AppAuthCore/OIDServiceDiscovery.h (100%) rename {Source => Sources}/AppAuthCore/OIDServiceDiscovery.m (100%) rename {Source => Sources}/AppAuthCore/OIDTokenRequest.h (100%) rename {Source => Sources}/AppAuthCore/OIDTokenRequest.m (100%) rename {Source => Sources}/AppAuthCore/OIDTokenResponse.h (100%) rename {Source => Sources}/AppAuthCore/OIDTokenResponse.m (100%) rename {Source => Sources}/AppAuthCore/OIDTokenUtilities.h (100%) rename {Source => Sources}/AppAuthCore/OIDTokenUtilities.m (100%) rename {Source => Sources}/AppAuthCore/OIDURLQueryComponent.h (100%) rename {Source => Sources}/AppAuthCore/OIDURLQueryComponent.m (100%) rename {Source => Sources}/AppAuthCore/OIDURLSessionProvider.h (100%) rename {Source => Sources}/AppAuthCore/OIDURLSessionProvider.m (100%) create mode 100644 Sources/AppAuthCore/Resources/PrivacyInfo.xcprivacy rename {Source => Sources}/AppAuthTV.h (100%) rename {Source => Sources}/AppAuthTV/OIDTVAuthorizationRequest.h (100%) rename {Source => Sources}/AppAuthTV/OIDTVAuthorizationRequest.m (100%) rename {Source => Sources}/AppAuthTV/OIDTVAuthorizationResponse.h (100%) rename {Source => Sources}/AppAuthTV/OIDTVAuthorizationResponse.m (100%) rename {Source => Sources}/AppAuthTV/OIDTVAuthorizationService.h (100%) rename {Source => Sources}/AppAuthTV/OIDTVAuthorizationService.m (100%) rename {Source => Sources}/AppAuthTV/OIDTVServiceConfiguration.h (100%) rename {Source => Sources}/AppAuthTV/OIDTVServiceConfiguration.m (100%) rename {Source => Sources}/AppAuthTV/OIDTVTokenRequest.h (100%) rename {Source => Sources}/AppAuthTV/OIDTVTokenRequest.m (100%) create mode 100644 Sources/AppAuthTV/Resources/PrivacyInfo.xcprivacy rename {Source => Sources}/CoreFramework/AppAuthCore.h (100%) rename {Source => Sources}/CoreFramework/Info.plist (100%) rename {Source => Sources}/Framework/AppAuth.h (100%) rename {Source => Sources}/Framework/Info.plist (100%) rename {Source => Sources}/TVFramework/AppAuthTV.h (100%) rename {Source => Sources}/TVFramework/Info.plist (100%) diff --git a/AppAuth.podspec b/AppAuth.podspec index a328e6be5..70f3e4168 100644 --- a/AppAuth.podspec +++ b/AppAuth.podspec @@ -43,9 +43,9 @@ It follows the OAuth 2.0 for Native Apps best current practice # Subspec for the core AppAuth library classes only, suitable for extensions. s.subspec 'Core' do |core| - core.source_files = "Source/AppAuthCore.h", "Source/AppAuthCore/*.{h,m}" + core.source_files = "Sources/AppAuthCore.h", "Sources/AppAuthCore/*.{h,m}" core.resource_bundles = { - "AppAuthCore_Privacy" => ["PrivacyInfo.xcprivacy"] + "AppAuthCore_Privacy" => ["Sources/AppAuthCore/Resources/PrivacyInfo.xcprivacy"] } end @@ -53,23 +53,23 @@ It follows the OAuth 2.0 for Native Apps best current practice s.subspec 'ExternalUserAgent' do |externalUserAgent| externalUserAgent.dependency 'AppAuth/Core' - externalUserAgent.source_files = "Source/AppAuth.h", "Source/AppAuth/*.{h,m}" + externalUserAgent.source_files = "Sources/AppAuth.h", "Sources/AppAuth/*.{h,m}" # iOS - externalUserAgent.ios.source_files = "Source/AppAuth/iOS/**/*.{h,m}" + externalUserAgent.ios.source_files = "Sources/AppAuth/iOS/**/*.{h,m}" externalUserAgent.ios.deployment_target = ios_deployment_target externalUserAgent.ios.frameworks = "SafariServices" externalUserAgent.ios.weak_frameworks = "AuthenticationServices" # macOS - externalUserAgent.osx.source_files = "Source/AppAuth/macOS/**/*.{h,m}" + externalUserAgent.osx.source_files = "Sources/AppAuth/macOS/**/*.{h,m}" externalUserAgent.osx.deployment_target = osx_deployment_target externalUserAgent.osx.weak_frameworks = "AuthenticationServices" end # Subspec for the full AppAuth library, including platform-dependent external user agents. s.subspec 'TV' do |tv| - tv.source_files = "Source/AppAuthTV.h", "Source/AppAuthTV/*.{h,m}" + tv.source_files = "Sources/AppAuthTV.h", "Sources/AppAuthTV/*.{h,m}" tv.dependency 'AppAuth/Core' end diff --git a/AppAuth.xcodeproj/project.pbxproj b/AppAuth.xcodeproj/project.pbxproj index 1f4a2a876..8d770d93c 100644 --- a/AppAuth.xcodeproj/project.pbxproj +++ b/AppAuth.xcodeproj/project.pbxproj @@ -1000,6 +1000,7 @@ 2D47AAD7249A86E30059B5A4 /* AppAuthTV */ = { isa = PBXGroup; children = ( + 7322C49B2BA20BFA00DF9B2F /* Resources */, 2D47AAD9249A87010059B5A4 /* OIDTVAuthorizationRequest.h */, 2D47AADD249A87010059B5A4 /* OIDTVAuthorizationRequest.m */, 2D47AADC249A87010059B5A4 /* OIDTVAuthorizationResponse.h */, @@ -1055,10 +1056,9 @@ 340E73731C5D819B0076B1F6 = { isa = PBXGroup; children = ( - 73F574332B7C42690023FFF0 /* PrivacyInfo.xcprivacy */, 341742291C5D84D0000EF209 /* Frameworks */, 341741FB1C5D82D3000EF209 /* UnitTests */, - 341741AE1C5D8243000EF209 /* Source */, + 341741AE1C5D8243000EF209 /* Sources */, 340E737D1C5D819B0076B1F6 /* Products */, ); indentWidth = 2; @@ -1090,7 +1090,7 @@ name = Products; sourceTree = ""; }; - 341741AE1C5D8243000EF209 /* Source */ = { + 341741AE1C5D8243000EF209 /* Sources */ = { isa = PBXGroup; children = ( 348970992178F40600ABEED4 /* CoreFramework */, @@ -1103,7 +1103,7 @@ 3489709E21791B0C00ABEED4 /* AppAuthCore.h */, 2D47AADB249A87010059B5A4 /* AppAuthTV.h */, ); - path = Source; + path = Sources; sourceTree = ""; }; 341741FB1C5D82D3000EF209 /* UnitTests */ = { @@ -1184,9 +1184,32 @@ path = LoopbackHTTPServer; sourceTree = ""; }; + 7322C4992BA2095100DF9B2F /* Resources */ = { + isa = PBXGroup; + children = ( + 73F574332B7C42690023FFF0 /* PrivacyInfo.xcprivacy */, + ); + path = Resources; + sourceTree = ""; + }; + 7322C49A2BA20BEF00DF9B2F /* Resources */ = { + isa = PBXGroup; + children = ( + ); + path = Resources; + sourceTree = ""; + }; + 7322C49B2BA20BFA00DF9B2F /* Resources */ = { + isa = PBXGroup; + children = ( + ); + path = Resources; + sourceTree = ""; + }; 8A9B9D5E24561EC40055353E /* AppAuthCore */ = { isa = PBXGroup; children = ( + 7322C4992BA2095100DF9B2F /* Resources */, 341741B41C5D8243000EF209 /* OIDAuthorizationRequest.h */, 341741B51C5D8243000EF209 /* OIDAuthorizationRequest.m */, 341741B61C5D8243000EF209 /* OIDAuthorizationResponse.h */, @@ -1248,6 +1271,7 @@ 8A9B9D632456227D0055353E /* AppAuth */ = { isa = PBXGroup; children = ( + 7322C49A2BA20BEF00DF9B2F /* Resources */, 340DAE241D581FE700EC285B /* macOS */, F6F60FAF1D2BFEF000325CB3 /* iOS */, ); @@ -2668,7 +2692,7 @@ "DEBUG=1", "$(inherited)", ); - INFOPLIST_FILE = "$(SRCROOT)/Source/TVFramework/Info.plist"; + INFOPLIST_FILE = Sources/TVFramework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; @@ -2700,7 +2724,7 @@ DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_C_LANGUAGE_STANDARD = gnu11; - INFOPLIST_FILE = "$(SRCROOT)/Source/TVFramework/Info.plist"; + INFOPLIST_FILE = Sources/TVFramework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_FAST_MATH = YES; @@ -3012,7 +3036,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Source/CoreFramework/Info.plist; + INFOPLIST_FILE = Sources/CoreFramework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -3038,7 +3062,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Source/CoreFramework/Info.plist; + INFOPLIST_FILE = Sources/CoreFramework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -3063,7 +3087,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Source/Framework/Info.plist; + INFOPLIST_FILE = Sources/Framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -3088,7 +3112,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Source/Framework/Info.plist; + INFOPLIST_FILE = Sources/Framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -3142,7 +3166,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Source/Framework/Info.plist; + INFOPLIST_FILE = Sources/Framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "net.openid.AppAuth-watchOS"; @@ -3168,7 +3192,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Source/Framework/Info.plist; + INFOPLIST_FILE = Sources/Framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "net.openid.AppAuth-watchOS"; @@ -3193,7 +3217,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Source/Framework/Info.plist; + INFOPLIST_FILE = Sources/Framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "net.openid.AppAuth-tvOS"; @@ -3218,7 +3242,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Source/Framework/Info.plist; + INFOPLIST_FILE = Sources/Framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "net.openid.AppAuth-tvOS"; @@ -3275,7 +3299,7 @@ DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; - INFOPLIST_FILE = Source/Framework/Info.plist; + INFOPLIST_FILE = Sources/Framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "net.openid.AppAuth-macOS"; @@ -3300,7 +3324,7 @@ DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; - INFOPLIST_FILE = Source/Framework/Info.plist; + INFOPLIST_FILE = Sources/Framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "net.openid.AppAuth-macOS"; diff --git a/Package.swift b/Package.swift index 820e74a6e..103c0f761 100644 --- a/Package.swift +++ b/Package.swift @@ -43,16 +43,16 @@ let package = Package( targets: [ .target( name: "AppAuthCore", - path: "Source/AppAuthCore", - resources: [.copy("../../PrivacyInfo.xcprivacy")], + path: "Sources/AppAuthCore", + resources: [.copy("Resources/PrivacyInfo.xcprivacy")], publicHeadersPath: "" ), .target( name: "AppAuth", dependencies: ["AppAuthCore"], - path: "Source/AppAuth", + path: "Sources/AppAuth", sources: ["iOS", "macOS"], - resources: [.copy("../../PrivacyInfo.xcprivacy")], + resources: [.copy("Resources/PrivacyInfo.xcprivacy")], publicHeadersPath: "", cSettings: [ .headerSearchPath("iOS"), @@ -63,8 +63,8 @@ let package = Package( .target( name: "AppAuthTV", dependencies: ["AppAuthCore"], - path: "Source/AppAuthTV", - resources: [.copy("../../PrivacyInfo.xcprivacy")], + path: "Sources/AppAuthTV", + resources: [.copy("Resources/PrivacyInfo.xcprivacy")], publicHeadersPath: "" ), .testTarget( diff --git a/Source/AppAuth.h b/Sources/AppAuth.h similarity index 100% rename from Source/AppAuth.h rename to Sources/AppAuth.h diff --git a/PrivacyInfo.xcprivacy b/Sources/AppAuth/Resources/PrivacyInfo.xcprivacy similarity index 100% rename from PrivacyInfo.xcprivacy rename to Sources/AppAuth/Resources/PrivacyInfo.xcprivacy diff --git a/Source/AppAuth/iOS/OIDAuthState+IOS.h b/Sources/AppAuth/iOS/OIDAuthState+IOS.h similarity index 100% rename from Source/AppAuth/iOS/OIDAuthState+IOS.h rename to Sources/AppAuth/iOS/OIDAuthState+IOS.h diff --git a/Source/AppAuth/iOS/OIDAuthState+IOS.m b/Sources/AppAuth/iOS/OIDAuthState+IOS.m similarity index 100% rename from Source/AppAuth/iOS/OIDAuthState+IOS.m rename to Sources/AppAuth/iOS/OIDAuthState+IOS.m diff --git a/Source/AppAuth/iOS/OIDAuthorizationService+IOS.h b/Sources/AppAuth/iOS/OIDAuthorizationService+IOS.h similarity index 100% rename from Source/AppAuth/iOS/OIDAuthorizationService+IOS.h rename to Sources/AppAuth/iOS/OIDAuthorizationService+IOS.h diff --git a/Source/AppAuth/iOS/OIDAuthorizationService+IOS.m b/Sources/AppAuth/iOS/OIDAuthorizationService+IOS.m similarity index 100% rename from Source/AppAuth/iOS/OIDAuthorizationService+IOS.m rename to Sources/AppAuth/iOS/OIDAuthorizationService+IOS.m diff --git a/Source/AppAuth/iOS/OIDExternalUserAgentCatalyst.h b/Sources/AppAuth/iOS/OIDExternalUserAgentCatalyst.h similarity index 100% rename from Source/AppAuth/iOS/OIDExternalUserAgentCatalyst.h rename to Sources/AppAuth/iOS/OIDExternalUserAgentCatalyst.h diff --git a/Source/AppAuth/iOS/OIDExternalUserAgentCatalyst.m b/Sources/AppAuth/iOS/OIDExternalUserAgentCatalyst.m similarity index 100% rename from Source/AppAuth/iOS/OIDExternalUserAgentCatalyst.m rename to Sources/AppAuth/iOS/OIDExternalUserAgentCatalyst.m diff --git a/Source/AppAuth/iOS/OIDExternalUserAgentIOS.h b/Sources/AppAuth/iOS/OIDExternalUserAgentIOS.h similarity index 100% rename from Source/AppAuth/iOS/OIDExternalUserAgentIOS.h rename to Sources/AppAuth/iOS/OIDExternalUserAgentIOS.h diff --git a/Source/AppAuth/iOS/OIDExternalUserAgentIOS.m b/Sources/AppAuth/iOS/OIDExternalUserAgentIOS.m similarity index 100% rename from Source/AppAuth/iOS/OIDExternalUserAgentIOS.m rename to Sources/AppAuth/iOS/OIDExternalUserAgentIOS.m diff --git a/Source/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.h b/Sources/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.h similarity index 100% rename from Source/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.h rename to Sources/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.h diff --git a/Source/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.m b/Sources/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.m similarity index 100% rename from Source/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.m rename to Sources/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.m diff --git a/Source/AppAuth/macOS/LoopbackHTTPServer/OIDLoopbackHTTPServer.h b/Sources/AppAuth/macOS/LoopbackHTTPServer/OIDLoopbackHTTPServer.h similarity index 100% rename from Source/AppAuth/macOS/LoopbackHTTPServer/OIDLoopbackHTTPServer.h rename to Sources/AppAuth/macOS/LoopbackHTTPServer/OIDLoopbackHTTPServer.h diff --git a/Source/AppAuth/macOS/LoopbackHTTPServer/OIDLoopbackHTTPServer.m b/Sources/AppAuth/macOS/LoopbackHTTPServer/OIDLoopbackHTTPServer.m similarity index 100% rename from Source/AppAuth/macOS/LoopbackHTTPServer/OIDLoopbackHTTPServer.m rename to Sources/AppAuth/macOS/LoopbackHTTPServer/OIDLoopbackHTTPServer.m diff --git a/Source/AppAuth/macOS/OIDAuthState+Mac.h b/Sources/AppAuth/macOS/OIDAuthState+Mac.h similarity index 100% rename from Source/AppAuth/macOS/OIDAuthState+Mac.h rename to Sources/AppAuth/macOS/OIDAuthState+Mac.h diff --git a/Source/AppAuth/macOS/OIDAuthState+Mac.m b/Sources/AppAuth/macOS/OIDAuthState+Mac.m similarity index 100% rename from Source/AppAuth/macOS/OIDAuthState+Mac.m rename to Sources/AppAuth/macOS/OIDAuthState+Mac.m diff --git a/Source/AppAuth/macOS/OIDAuthorizationService+Mac.h b/Sources/AppAuth/macOS/OIDAuthorizationService+Mac.h similarity index 100% rename from Source/AppAuth/macOS/OIDAuthorizationService+Mac.h rename to Sources/AppAuth/macOS/OIDAuthorizationService+Mac.h diff --git a/Source/AppAuth/macOS/OIDAuthorizationService+Mac.m b/Sources/AppAuth/macOS/OIDAuthorizationService+Mac.m similarity index 100% rename from Source/AppAuth/macOS/OIDAuthorizationService+Mac.m rename to Sources/AppAuth/macOS/OIDAuthorizationService+Mac.m diff --git a/Source/AppAuth/macOS/OIDExternalUserAgentMac.h b/Sources/AppAuth/macOS/OIDExternalUserAgentMac.h similarity index 100% rename from Source/AppAuth/macOS/OIDExternalUserAgentMac.h rename to Sources/AppAuth/macOS/OIDExternalUserAgentMac.h diff --git a/Source/AppAuth/macOS/OIDExternalUserAgentMac.m b/Sources/AppAuth/macOS/OIDExternalUserAgentMac.m similarity index 100% rename from Source/AppAuth/macOS/OIDExternalUserAgentMac.m rename to Sources/AppAuth/macOS/OIDExternalUserAgentMac.m diff --git a/Source/AppAuth/macOS/OIDRedirectHTTPHandler.h b/Sources/AppAuth/macOS/OIDRedirectHTTPHandler.h similarity index 100% rename from Source/AppAuth/macOS/OIDRedirectHTTPHandler.h rename to Sources/AppAuth/macOS/OIDRedirectHTTPHandler.h diff --git a/Source/AppAuth/macOS/OIDRedirectHTTPHandler.m b/Sources/AppAuth/macOS/OIDRedirectHTTPHandler.m similarity index 100% rename from Source/AppAuth/macOS/OIDRedirectHTTPHandler.m rename to Sources/AppAuth/macOS/OIDRedirectHTTPHandler.m diff --git a/Source/AppAuthCore.h b/Sources/AppAuthCore.h similarity index 100% rename from Source/AppAuthCore.h rename to Sources/AppAuthCore.h diff --git a/Source/AppAuthCore/OIDAuthState.h b/Sources/AppAuthCore/OIDAuthState.h similarity index 100% rename from Source/AppAuthCore/OIDAuthState.h rename to Sources/AppAuthCore/OIDAuthState.h diff --git a/Source/AppAuthCore/OIDAuthState.m b/Sources/AppAuthCore/OIDAuthState.m similarity index 100% rename from Source/AppAuthCore/OIDAuthState.m rename to Sources/AppAuthCore/OIDAuthState.m diff --git a/Source/AppAuthCore/OIDAuthStateChangeDelegate.h b/Sources/AppAuthCore/OIDAuthStateChangeDelegate.h similarity index 100% rename from Source/AppAuthCore/OIDAuthStateChangeDelegate.h rename to Sources/AppAuthCore/OIDAuthStateChangeDelegate.h diff --git a/Source/AppAuthCore/OIDAuthStateErrorDelegate.h b/Sources/AppAuthCore/OIDAuthStateErrorDelegate.h similarity index 100% rename from Source/AppAuthCore/OIDAuthStateErrorDelegate.h rename to Sources/AppAuthCore/OIDAuthStateErrorDelegate.h diff --git a/Source/AppAuthCore/OIDAuthorizationRequest.h b/Sources/AppAuthCore/OIDAuthorizationRequest.h similarity index 100% rename from Source/AppAuthCore/OIDAuthorizationRequest.h rename to Sources/AppAuthCore/OIDAuthorizationRequest.h diff --git a/Source/AppAuthCore/OIDAuthorizationRequest.m b/Sources/AppAuthCore/OIDAuthorizationRequest.m similarity index 100% rename from Source/AppAuthCore/OIDAuthorizationRequest.m rename to Sources/AppAuthCore/OIDAuthorizationRequest.m diff --git a/Source/AppAuthCore/OIDAuthorizationResponse.h b/Sources/AppAuthCore/OIDAuthorizationResponse.h similarity index 100% rename from Source/AppAuthCore/OIDAuthorizationResponse.h rename to Sources/AppAuthCore/OIDAuthorizationResponse.h diff --git a/Source/AppAuthCore/OIDAuthorizationResponse.m b/Sources/AppAuthCore/OIDAuthorizationResponse.m similarity index 100% rename from Source/AppAuthCore/OIDAuthorizationResponse.m rename to Sources/AppAuthCore/OIDAuthorizationResponse.m diff --git a/Source/AppAuthCore/OIDAuthorizationService.h b/Sources/AppAuthCore/OIDAuthorizationService.h similarity index 100% rename from Source/AppAuthCore/OIDAuthorizationService.h rename to Sources/AppAuthCore/OIDAuthorizationService.h diff --git a/Source/AppAuthCore/OIDAuthorizationService.m b/Sources/AppAuthCore/OIDAuthorizationService.m similarity index 100% rename from Source/AppAuthCore/OIDAuthorizationService.m rename to Sources/AppAuthCore/OIDAuthorizationService.m diff --git a/Source/AppAuthCore/OIDClientMetadataParameters.h b/Sources/AppAuthCore/OIDClientMetadataParameters.h similarity index 100% rename from Source/AppAuthCore/OIDClientMetadataParameters.h rename to Sources/AppAuthCore/OIDClientMetadataParameters.h diff --git a/Source/AppAuthCore/OIDClientMetadataParameters.m b/Sources/AppAuthCore/OIDClientMetadataParameters.m similarity index 100% rename from Source/AppAuthCore/OIDClientMetadataParameters.m rename to Sources/AppAuthCore/OIDClientMetadataParameters.m diff --git a/Source/AppAuthCore/OIDDefines.h b/Sources/AppAuthCore/OIDDefines.h similarity index 100% rename from Source/AppAuthCore/OIDDefines.h rename to Sources/AppAuthCore/OIDDefines.h diff --git a/Source/AppAuthCore/OIDEndSessionRequest.h b/Sources/AppAuthCore/OIDEndSessionRequest.h similarity index 100% rename from Source/AppAuthCore/OIDEndSessionRequest.h rename to Sources/AppAuthCore/OIDEndSessionRequest.h diff --git a/Source/AppAuthCore/OIDEndSessionRequest.m b/Sources/AppAuthCore/OIDEndSessionRequest.m similarity index 100% rename from Source/AppAuthCore/OIDEndSessionRequest.m rename to Sources/AppAuthCore/OIDEndSessionRequest.m diff --git a/Source/AppAuthCore/OIDEndSessionResponse.h b/Sources/AppAuthCore/OIDEndSessionResponse.h similarity index 100% rename from Source/AppAuthCore/OIDEndSessionResponse.h rename to Sources/AppAuthCore/OIDEndSessionResponse.h diff --git a/Source/AppAuthCore/OIDEndSessionResponse.m b/Sources/AppAuthCore/OIDEndSessionResponse.m similarity index 100% rename from Source/AppAuthCore/OIDEndSessionResponse.m rename to Sources/AppAuthCore/OIDEndSessionResponse.m diff --git a/Source/AppAuthCore/OIDError.h b/Sources/AppAuthCore/OIDError.h similarity index 100% rename from Source/AppAuthCore/OIDError.h rename to Sources/AppAuthCore/OIDError.h diff --git a/Source/AppAuthCore/OIDError.m b/Sources/AppAuthCore/OIDError.m similarity index 100% rename from Source/AppAuthCore/OIDError.m rename to Sources/AppAuthCore/OIDError.m diff --git a/Source/AppAuthCore/OIDErrorUtilities.h b/Sources/AppAuthCore/OIDErrorUtilities.h similarity index 100% rename from Source/AppAuthCore/OIDErrorUtilities.h rename to Sources/AppAuthCore/OIDErrorUtilities.h diff --git a/Source/AppAuthCore/OIDErrorUtilities.m b/Sources/AppAuthCore/OIDErrorUtilities.m similarity index 100% rename from Source/AppAuthCore/OIDErrorUtilities.m rename to Sources/AppAuthCore/OIDErrorUtilities.m diff --git a/Source/AppAuthCore/OIDExternalUserAgent.h b/Sources/AppAuthCore/OIDExternalUserAgent.h similarity index 100% rename from Source/AppAuthCore/OIDExternalUserAgent.h rename to Sources/AppAuthCore/OIDExternalUserAgent.h diff --git a/Source/AppAuthCore/OIDExternalUserAgentRequest.h b/Sources/AppAuthCore/OIDExternalUserAgentRequest.h similarity index 100% rename from Source/AppAuthCore/OIDExternalUserAgentRequest.h rename to Sources/AppAuthCore/OIDExternalUserAgentRequest.h diff --git a/Source/AppAuthCore/OIDExternalUserAgentSession.h b/Sources/AppAuthCore/OIDExternalUserAgentSession.h similarity index 100% rename from Source/AppAuthCore/OIDExternalUserAgentSession.h rename to Sources/AppAuthCore/OIDExternalUserAgentSession.h diff --git a/Source/AppAuthCore/OIDFieldMapping.h b/Sources/AppAuthCore/OIDFieldMapping.h similarity index 100% rename from Source/AppAuthCore/OIDFieldMapping.h rename to Sources/AppAuthCore/OIDFieldMapping.h diff --git a/Source/AppAuthCore/OIDFieldMapping.m b/Sources/AppAuthCore/OIDFieldMapping.m similarity index 100% rename from Source/AppAuthCore/OIDFieldMapping.m rename to Sources/AppAuthCore/OIDFieldMapping.m diff --git a/Source/AppAuthCore/OIDGrantTypes.h b/Sources/AppAuthCore/OIDGrantTypes.h similarity index 100% rename from Source/AppAuthCore/OIDGrantTypes.h rename to Sources/AppAuthCore/OIDGrantTypes.h diff --git a/Source/AppAuthCore/OIDGrantTypes.m b/Sources/AppAuthCore/OIDGrantTypes.m similarity index 100% rename from Source/AppAuthCore/OIDGrantTypes.m rename to Sources/AppAuthCore/OIDGrantTypes.m diff --git a/Source/AppAuthCore/OIDIDToken.h b/Sources/AppAuthCore/OIDIDToken.h similarity index 100% rename from Source/AppAuthCore/OIDIDToken.h rename to Sources/AppAuthCore/OIDIDToken.h diff --git a/Source/AppAuthCore/OIDIDToken.m b/Sources/AppAuthCore/OIDIDToken.m similarity index 100% rename from Source/AppAuthCore/OIDIDToken.m rename to Sources/AppAuthCore/OIDIDToken.m diff --git a/Source/AppAuthCore/OIDRegistrationRequest.h b/Sources/AppAuthCore/OIDRegistrationRequest.h similarity index 100% rename from Source/AppAuthCore/OIDRegistrationRequest.h rename to Sources/AppAuthCore/OIDRegistrationRequest.h diff --git a/Source/AppAuthCore/OIDRegistrationRequest.m b/Sources/AppAuthCore/OIDRegistrationRequest.m similarity index 100% rename from Source/AppAuthCore/OIDRegistrationRequest.m rename to Sources/AppAuthCore/OIDRegistrationRequest.m diff --git a/Source/AppAuthCore/OIDRegistrationResponse.h b/Sources/AppAuthCore/OIDRegistrationResponse.h similarity index 100% rename from Source/AppAuthCore/OIDRegistrationResponse.h rename to Sources/AppAuthCore/OIDRegistrationResponse.h diff --git a/Source/AppAuthCore/OIDRegistrationResponse.m b/Sources/AppAuthCore/OIDRegistrationResponse.m similarity index 100% rename from Source/AppAuthCore/OIDRegistrationResponse.m rename to Sources/AppAuthCore/OIDRegistrationResponse.m diff --git a/Source/AppAuthCore/OIDResponseTypes.h b/Sources/AppAuthCore/OIDResponseTypes.h similarity index 100% rename from Source/AppAuthCore/OIDResponseTypes.h rename to Sources/AppAuthCore/OIDResponseTypes.h diff --git a/Source/AppAuthCore/OIDResponseTypes.m b/Sources/AppAuthCore/OIDResponseTypes.m similarity index 100% rename from Source/AppAuthCore/OIDResponseTypes.m rename to Sources/AppAuthCore/OIDResponseTypes.m diff --git a/Source/AppAuthCore/OIDScopeUtilities.h b/Sources/AppAuthCore/OIDScopeUtilities.h similarity index 100% rename from Source/AppAuthCore/OIDScopeUtilities.h rename to Sources/AppAuthCore/OIDScopeUtilities.h diff --git a/Source/AppAuthCore/OIDScopeUtilities.m b/Sources/AppAuthCore/OIDScopeUtilities.m similarity index 100% rename from Source/AppAuthCore/OIDScopeUtilities.m rename to Sources/AppAuthCore/OIDScopeUtilities.m diff --git a/Source/AppAuthCore/OIDScopes.h b/Sources/AppAuthCore/OIDScopes.h similarity index 100% rename from Source/AppAuthCore/OIDScopes.h rename to Sources/AppAuthCore/OIDScopes.h diff --git a/Source/AppAuthCore/OIDScopes.m b/Sources/AppAuthCore/OIDScopes.m similarity index 100% rename from Source/AppAuthCore/OIDScopes.m rename to Sources/AppAuthCore/OIDScopes.m diff --git a/Source/AppAuthCore/OIDServiceConfiguration.h b/Sources/AppAuthCore/OIDServiceConfiguration.h similarity index 100% rename from Source/AppAuthCore/OIDServiceConfiguration.h rename to Sources/AppAuthCore/OIDServiceConfiguration.h diff --git a/Source/AppAuthCore/OIDServiceConfiguration.m b/Sources/AppAuthCore/OIDServiceConfiguration.m similarity index 100% rename from Source/AppAuthCore/OIDServiceConfiguration.m rename to Sources/AppAuthCore/OIDServiceConfiguration.m diff --git a/Source/AppAuthCore/OIDServiceDiscovery.h b/Sources/AppAuthCore/OIDServiceDiscovery.h similarity index 100% rename from Source/AppAuthCore/OIDServiceDiscovery.h rename to Sources/AppAuthCore/OIDServiceDiscovery.h diff --git a/Source/AppAuthCore/OIDServiceDiscovery.m b/Sources/AppAuthCore/OIDServiceDiscovery.m similarity index 100% rename from Source/AppAuthCore/OIDServiceDiscovery.m rename to Sources/AppAuthCore/OIDServiceDiscovery.m diff --git a/Source/AppAuthCore/OIDTokenRequest.h b/Sources/AppAuthCore/OIDTokenRequest.h similarity index 100% rename from Source/AppAuthCore/OIDTokenRequest.h rename to Sources/AppAuthCore/OIDTokenRequest.h diff --git a/Source/AppAuthCore/OIDTokenRequest.m b/Sources/AppAuthCore/OIDTokenRequest.m similarity index 100% rename from Source/AppAuthCore/OIDTokenRequest.m rename to Sources/AppAuthCore/OIDTokenRequest.m diff --git a/Source/AppAuthCore/OIDTokenResponse.h b/Sources/AppAuthCore/OIDTokenResponse.h similarity index 100% rename from Source/AppAuthCore/OIDTokenResponse.h rename to Sources/AppAuthCore/OIDTokenResponse.h diff --git a/Source/AppAuthCore/OIDTokenResponse.m b/Sources/AppAuthCore/OIDTokenResponse.m similarity index 100% rename from Source/AppAuthCore/OIDTokenResponse.m rename to Sources/AppAuthCore/OIDTokenResponse.m diff --git a/Source/AppAuthCore/OIDTokenUtilities.h b/Sources/AppAuthCore/OIDTokenUtilities.h similarity index 100% rename from Source/AppAuthCore/OIDTokenUtilities.h rename to Sources/AppAuthCore/OIDTokenUtilities.h diff --git a/Source/AppAuthCore/OIDTokenUtilities.m b/Sources/AppAuthCore/OIDTokenUtilities.m similarity index 100% rename from Source/AppAuthCore/OIDTokenUtilities.m rename to Sources/AppAuthCore/OIDTokenUtilities.m diff --git a/Source/AppAuthCore/OIDURLQueryComponent.h b/Sources/AppAuthCore/OIDURLQueryComponent.h similarity index 100% rename from Source/AppAuthCore/OIDURLQueryComponent.h rename to Sources/AppAuthCore/OIDURLQueryComponent.h diff --git a/Source/AppAuthCore/OIDURLQueryComponent.m b/Sources/AppAuthCore/OIDURLQueryComponent.m similarity index 100% rename from Source/AppAuthCore/OIDURLQueryComponent.m rename to Sources/AppAuthCore/OIDURLQueryComponent.m diff --git a/Source/AppAuthCore/OIDURLSessionProvider.h b/Sources/AppAuthCore/OIDURLSessionProvider.h similarity index 100% rename from Source/AppAuthCore/OIDURLSessionProvider.h rename to Sources/AppAuthCore/OIDURLSessionProvider.h diff --git a/Source/AppAuthCore/OIDURLSessionProvider.m b/Sources/AppAuthCore/OIDURLSessionProvider.m similarity index 100% rename from Source/AppAuthCore/OIDURLSessionProvider.m rename to Sources/AppAuthCore/OIDURLSessionProvider.m diff --git a/Sources/AppAuthCore/Resources/PrivacyInfo.xcprivacy b/Sources/AppAuthCore/Resources/PrivacyInfo.xcprivacy new file mode 100644 index 000000000..cc6746dcb --- /dev/null +++ b/Sources/AppAuthCore/Resources/PrivacyInfo.xcprivacy @@ -0,0 +1,16 @@ + + + + + NSPrivacyAccessedAPITypes + + + NSPrivacyCollectedDataTypes + + + NSPrivacyTrackingDomains + + NSPrivacyTracking + + + diff --git a/Source/AppAuthTV.h b/Sources/AppAuthTV.h similarity index 100% rename from Source/AppAuthTV.h rename to Sources/AppAuthTV.h diff --git a/Source/AppAuthTV/OIDTVAuthorizationRequest.h b/Sources/AppAuthTV/OIDTVAuthorizationRequest.h similarity index 100% rename from Source/AppAuthTV/OIDTVAuthorizationRequest.h rename to Sources/AppAuthTV/OIDTVAuthorizationRequest.h diff --git a/Source/AppAuthTV/OIDTVAuthorizationRequest.m b/Sources/AppAuthTV/OIDTVAuthorizationRequest.m similarity index 100% rename from Source/AppAuthTV/OIDTVAuthorizationRequest.m rename to Sources/AppAuthTV/OIDTVAuthorizationRequest.m diff --git a/Source/AppAuthTV/OIDTVAuthorizationResponse.h b/Sources/AppAuthTV/OIDTVAuthorizationResponse.h similarity index 100% rename from Source/AppAuthTV/OIDTVAuthorizationResponse.h rename to Sources/AppAuthTV/OIDTVAuthorizationResponse.h diff --git a/Source/AppAuthTV/OIDTVAuthorizationResponse.m b/Sources/AppAuthTV/OIDTVAuthorizationResponse.m similarity index 100% rename from Source/AppAuthTV/OIDTVAuthorizationResponse.m rename to Sources/AppAuthTV/OIDTVAuthorizationResponse.m diff --git a/Source/AppAuthTV/OIDTVAuthorizationService.h b/Sources/AppAuthTV/OIDTVAuthorizationService.h similarity index 100% rename from Source/AppAuthTV/OIDTVAuthorizationService.h rename to Sources/AppAuthTV/OIDTVAuthorizationService.h diff --git a/Source/AppAuthTV/OIDTVAuthorizationService.m b/Sources/AppAuthTV/OIDTVAuthorizationService.m similarity index 100% rename from Source/AppAuthTV/OIDTVAuthorizationService.m rename to Sources/AppAuthTV/OIDTVAuthorizationService.m diff --git a/Source/AppAuthTV/OIDTVServiceConfiguration.h b/Sources/AppAuthTV/OIDTVServiceConfiguration.h similarity index 100% rename from Source/AppAuthTV/OIDTVServiceConfiguration.h rename to Sources/AppAuthTV/OIDTVServiceConfiguration.h diff --git a/Source/AppAuthTV/OIDTVServiceConfiguration.m b/Sources/AppAuthTV/OIDTVServiceConfiguration.m similarity index 100% rename from Source/AppAuthTV/OIDTVServiceConfiguration.m rename to Sources/AppAuthTV/OIDTVServiceConfiguration.m diff --git a/Source/AppAuthTV/OIDTVTokenRequest.h b/Sources/AppAuthTV/OIDTVTokenRequest.h similarity index 100% rename from Source/AppAuthTV/OIDTVTokenRequest.h rename to Sources/AppAuthTV/OIDTVTokenRequest.h diff --git a/Source/AppAuthTV/OIDTVTokenRequest.m b/Sources/AppAuthTV/OIDTVTokenRequest.m similarity index 100% rename from Source/AppAuthTV/OIDTVTokenRequest.m rename to Sources/AppAuthTV/OIDTVTokenRequest.m diff --git a/Sources/AppAuthTV/Resources/PrivacyInfo.xcprivacy b/Sources/AppAuthTV/Resources/PrivacyInfo.xcprivacy new file mode 100644 index 000000000..cc6746dcb --- /dev/null +++ b/Sources/AppAuthTV/Resources/PrivacyInfo.xcprivacy @@ -0,0 +1,16 @@ + + + + + NSPrivacyAccessedAPITypes + + + NSPrivacyCollectedDataTypes + + + NSPrivacyTrackingDomains + + NSPrivacyTracking + + + diff --git a/Source/CoreFramework/AppAuthCore.h b/Sources/CoreFramework/AppAuthCore.h similarity index 100% rename from Source/CoreFramework/AppAuthCore.h rename to Sources/CoreFramework/AppAuthCore.h diff --git a/Source/CoreFramework/Info.plist b/Sources/CoreFramework/Info.plist similarity index 100% rename from Source/CoreFramework/Info.plist rename to Sources/CoreFramework/Info.plist diff --git a/Source/Framework/AppAuth.h b/Sources/Framework/AppAuth.h similarity index 100% rename from Source/Framework/AppAuth.h rename to Sources/Framework/AppAuth.h diff --git a/Source/Framework/Info.plist b/Sources/Framework/Info.plist similarity index 100% rename from Source/Framework/Info.plist rename to Sources/Framework/Info.plist diff --git a/Source/TVFramework/AppAuthTV.h b/Sources/TVFramework/AppAuthTV.h similarity index 100% rename from Source/TVFramework/AppAuthTV.h rename to Sources/TVFramework/AppAuthTV.h diff --git a/Source/TVFramework/Info.plist b/Sources/TVFramework/Info.plist similarity index 100% rename from Source/TVFramework/Info.plist rename to Sources/TVFramework/Info.plist diff --git a/UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.m b/UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.m index 7b1d19c95..a5ccd6e1d 100644 --- a/UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.m +++ b/UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.m @@ -21,10 +21,10 @@ #if SWIFT_PACKAGE @import AppAuthTV; #else -#import "Source/AppAuthCore/OIDScopeUtilities.h" -#import "Source/AppAuthCore/OIDURLQueryComponent.h" -#import "Source/AppAuthTV/OIDTVAuthorizationRequest.h" -#import "Source/AppAuthTV/OIDTVServiceConfiguration.h" +#import "Sources/AppAuthCore/OIDScopeUtilities.h" +#import "Sources/AppAuthCore/OIDURLQueryComponent.h" +#import "Sources/AppAuthTV/OIDTVAuthorizationRequest.h" +#import "Sources/AppAuthTV/OIDTVServiceConfiguration.h" #endif // Ignore warnings about "Use of GNU statement expression extension" which is raised by our use of diff --git a/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.m b/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.m index 288228e88..436232322 100644 --- a/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.m +++ b/UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.m @@ -21,12 +21,12 @@ #if SWIFT_PACKAGE @import AppAuthTV; #else -#import "Source/AppAuthCore/OIDScopeUtilities.h" -#import "Source/AppAuthCore/OIDURLQueryComponent.h" -#import "Source/AppAuthTV/OIDTVAuthorizationRequest.h" -#import "Source/AppAuthTV/OIDTVAuthorizationResponse.h" -#import "Source/AppAuthTV/OIDTVServiceConfiguration.h" -#import "Source/AppAuthTV/OIDTVTokenRequest.h" +#import "Sources/AppAuthCore/OIDScopeUtilities.h" +#import "Sources/AppAuthCore/OIDURLQueryComponent.h" +#import "Sources/AppAuthTV/OIDTVAuthorizationRequest.h" +#import "Sources/AppAuthTV/OIDTVAuthorizationResponse.h" +#import "Sources/AppAuthTV/OIDTVServiceConfiguration.h" +#import "Sources/AppAuthTV/OIDTVTokenRequest.h" #endif /*! @brief Test value for the @c deviceAuthorizationEndpoint property. diff --git a/UnitTests/AppAuthTV/OIDTVTokenRequestTests.m b/UnitTests/AppAuthTV/OIDTVTokenRequestTests.m index 4778a227b..cd56344fd 100644 --- a/UnitTests/AppAuthTV/OIDTVTokenRequestTests.m +++ b/UnitTests/AppAuthTV/OIDTVTokenRequestTests.m @@ -21,11 +21,11 @@ #if SWIFT_PACKAGE @import AppAuthTV; #else -#import "Source/AppAuthCore/OIDScopeUtilities.h" -#import "Source/AppAuthTV/OIDTVAuthorizationRequest.h" -#import "Source/AppAuthTV/OIDTVAuthorizationResponse.h" -#import "Source/AppAuthTV/OIDTVServiceConfiguration.h" -#import "Source/AppAuthTV/OIDTVTokenRequest.h" +#import "Sources/AppAuthCore/OIDScopeUtilities.h" +#import "Sources/AppAuthTV/OIDTVAuthorizationRequest.h" +#import "Sources/AppAuthTV/OIDTVAuthorizationResponse.h" +#import "Sources/AppAuthTV/OIDTVServiceConfiguration.h" +#import "Sources/AppAuthTV/OIDTVTokenRequest.h" #endif // Ignore warnings about "Use of GNU statement expression extension" which is diff --git a/UnitTests/OIDAuthStateTests.h b/UnitTests/OIDAuthStateTests.h index 2f1a62ab1..3bd1eb6fb 100644 --- a/UnitTests/OIDAuthStateTests.h +++ b/UnitTests/OIDAuthStateTests.h @@ -21,8 +21,8 @@ #if SWIFT_PACKAGE @import AppAuthCore; #else -#import "Source/AppAuthCore/OIDAuthStateChangeDelegate.h" -#import "Source/AppAuthCore/OIDAuthStateErrorDelegate.h" +#import "Sources/AppAuthCore/OIDAuthStateChangeDelegate.h" +#import "Sources/AppAuthCore/OIDAuthStateErrorDelegate.h" #endif @class OIDAuthState; diff --git a/UnitTests/OIDAuthStateTests.m b/UnitTests/OIDAuthStateTests.m index d12f2a831..051902833 100644 --- a/UnitTests/OIDAuthStateTests.m +++ b/UnitTests/OIDAuthStateTests.m @@ -25,11 +25,11 @@ #if SWIFT_PACKAGE @import AppAuthCore; #else -#import "Source/AppAuthCore/OIDAuthState.h" -#import "Source/AppAuthCore/OIDAuthorizationResponse.h" -#import "Source/AppAuthCore/OIDErrorUtilities.h" -#import "Source/AppAuthCore/OIDRegistrationResponse.h" -#import "Source/AppAuthCore/OIDTokenResponse.h" +#import "Sources/AppAuthCore/OIDAuthState.h" +#import "Sources/AppAuthCore/OIDAuthorizationResponse.h" +#import "Sources/AppAuthCore/OIDErrorUtilities.h" +#import "Sources/AppAuthCore/OIDRegistrationResponse.h" +#import "Sources/AppAuthCore/OIDTokenResponse.h" #endif #import "OIDTokenRequestTests.h" diff --git a/UnitTests/OIDAuthorizationRequestTests.m b/UnitTests/OIDAuthorizationRequestTests.m index 92ed8ee05..dd1329383 100644 --- a/UnitTests/OIDAuthorizationRequestTests.m +++ b/UnitTests/OIDAuthorizationRequestTests.m @@ -23,9 +23,9 @@ #if SWIFT_PACKAGE @import AppAuthCore; #else -#import "Source/AppAuthCore/OIDAuthorizationRequest.h" -#import "Source/AppAuthCore/OIDScopeUtilities.h" -#import "Source/AppAuthCore/OIDServiceConfiguration.h" +#import "Sources/AppAuthCore/OIDAuthorizationRequest.h" +#import "Sources/AppAuthCore/OIDScopeUtilities.h" +#import "Sources/AppAuthCore/OIDServiceConfiguration.h" #endif // Ignore warnings about "Use of GNU statement expression extension" which is raised by our use of diff --git a/UnitTests/OIDAuthorizationResponseTests.m b/UnitTests/OIDAuthorizationResponseTests.m index 10e48eaa8..3aded7eaa 100644 --- a/UnitTests/OIDAuthorizationResponseTests.m +++ b/UnitTests/OIDAuthorizationResponseTests.m @@ -23,9 +23,9 @@ #if SWIFT_PACKAGE @import AppAuthCore; #else -#import "Source/AppAuthCore/OIDAuthorizationRequest.h" -#import "Source/AppAuthCore/OIDAuthorizationResponse.h" -#import "Source/AppAuthCore/OIDGrantTypes.h" +#import "Sources/AppAuthCore/OIDAuthorizationRequest.h" +#import "Sources/AppAuthCore/OIDAuthorizationResponse.h" +#import "Sources/AppAuthCore/OIDGrantTypes.h" #endif // Ignore warnings about "Use of GNU statement expression extension" which is raised by our use of diff --git a/UnitTests/OIDEndSessionRequestTests.m b/UnitTests/OIDEndSessionRequestTests.m index 4620d3b82..38543c8d3 100644 --- a/UnitTests/OIDEndSessionRequestTests.m +++ b/UnitTests/OIDEndSessionRequestTests.m @@ -23,9 +23,9 @@ #if SWIFT_PACKAGE @import AppAuthCore; #else -#import "Source/AppAuthCore/OIDEndSessionRequest.h" -#import "Source/AppAuthCore/OIDServiceConfiguration.h" -#import "Source/AppAuthCore/OIDServiceDiscovery.h" +#import "Sources/AppAuthCore/OIDEndSessionRequest.h" +#import "Sources/AppAuthCore/OIDServiceConfiguration.h" +#import "Sources/AppAuthCore/OIDServiceDiscovery.h" #endif /*! @brief Test value for the @c redirectURL property. diff --git a/UnitTests/OIDGrantTypesTests.m b/UnitTests/OIDGrantTypesTests.m index 8c06d5701..b6efc8ea1 100644 --- a/UnitTests/OIDGrantTypesTests.m +++ b/UnitTests/OIDGrantTypesTests.m @@ -21,7 +21,7 @@ #if SWIFT_PACKAGE @import AppAuthCore; #else -#import "Source/AppAuthCore/OIDGrantTypes.h" +#import "Sources/AppAuthCore/OIDGrantTypes.h" #endif // Ignore warnings about "Use of GNU statement expression extension" which is raised by our use of diff --git a/UnitTests/OIDRegistrationRequestTests.m b/UnitTests/OIDRegistrationRequestTests.m index 5fbbd585e..440dab2a5 100644 --- a/UnitTests/OIDRegistrationRequestTests.m +++ b/UnitTests/OIDRegistrationRequestTests.m @@ -23,9 +23,9 @@ #if SWIFT_PACKAGE @import AppAuthCore; #else -#import "Source/AppAuthCore/OIDClientMetadataParameters.h" -#import "Source/AppAuthCore/OIDRegistrationRequest.h" -#import "Source/AppAuthCore/OIDServiceConfiguration.h" +#import "Sources/AppAuthCore/OIDClientMetadataParameters.h" +#import "Sources/AppAuthCore/OIDRegistrationRequest.h" +#import "Sources/AppAuthCore/OIDServiceConfiguration.h" #endif /*! @brief Test key for the @c additionalParameters property. diff --git a/UnitTests/OIDRegistrationResponseTests.m b/UnitTests/OIDRegistrationResponseTests.m index f747cc244..92e57e338 100644 --- a/UnitTests/OIDRegistrationResponseTests.m +++ b/UnitTests/OIDRegistrationResponseTests.m @@ -24,8 +24,8 @@ #if SWIFT_PACKAGE @import AppAuthCore; #else -#import "Source/AppAuthCore/OIDRegistrationRequest.h" -#import "Source/AppAuthCore/OIDRegistrationResponse.h" +#import "Sources/AppAuthCore/OIDRegistrationRequest.h" +#import "Sources/AppAuthCore/OIDRegistrationResponse.h" #endif /*! @brief The test value for the @c clientID property. diff --git a/UnitTests/OIDResponseTypesTests.m b/UnitTests/OIDResponseTypesTests.m index 5402ebbf5..659597735 100644 --- a/UnitTests/OIDResponseTypesTests.m +++ b/UnitTests/OIDResponseTypesTests.m @@ -21,7 +21,7 @@ #if SWIFT_PACKAGE @import AppAuthCore; #else -#import "Source/AppAuthCore/OIDResponseTypes.h" +#import "Sources/AppAuthCore/OIDResponseTypes.h" #endif // Ignore warnings about "Use of GNU statement expression extension" which is raised by our use of diff --git a/UnitTests/OIDScopesTests.m b/UnitTests/OIDScopesTests.m index 2d9173748..b5276ebd8 100644 --- a/UnitTests/OIDScopesTests.m +++ b/UnitTests/OIDScopesTests.m @@ -21,7 +21,7 @@ #if SWIFT_PACKAGE @import AppAuthCore; #else -#import "Source/AppAuthCore/OIDScopes.h" +#import "Sources/AppAuthCore/OIDScopes.h" #endif // Ignore warnings about "Use of GNU statement expression extension" which is raised by our use of diff --git a/UnitTests/OIDServiceConfigurationTests.m b/UnitTests/OIDServiceConfigurationTests.m index 3be785e60..7f4fcb11c 100644 --- a/UnitTests/OIDServiceConfigurationTests.m +++ b/UnitTests/OIDServiceConfigurationTests.m @@ -25,10 +25,10 @@ #if SWIFT_PACKAGE @import AppAuthCore; #else -#import "Source/AppAuthCore/OIDAuthorizationService.h" -#import "Source/AppAuthCore/OIDError.h" -#import "Source/AppAuthCore/OIDServiceConfiguration.h" -#import "Source/AppAuthCore/OIDServiceDiscovery.h" +#import "Sources/AppAuthCore/OIDAuthorizationService.h" +#import "Sources/AppAuthCore/OIDError.h" +#import "Sources/AppAuthCore/OIDServiceConfiguration.h" +#import "Sources/AppAuthCore/OIDServiceDiscovery.h" #endif // Ignore warnings about "Use of GNU statement expression extension" which is raised by our use of diff --git a/UnitTests/OIDServiceDiscoveryTests.m b/UnitTests/OIDServiceDiscoveryTests.m index 6329feab3..6d9faf799 100644 --- a/UnitTests/OIDServiceDiscoveryTests.m +++ b/UnitTests/OIDServiceDiscoveryTests.m @@ -21,8 +21,8 @@ #if SWIFT_PACKAGE @import AppAuthCore; #else -#import "Source/AppAuthCore/OIDError.h" -#import "Source/AppAuthCore/OIDServiceDiscovery.h" +#import "Sources/AppAuthCore/OIDError.h" +#import "Sources/AppAuthCore/OIDServiceDiscovery.h" #endif // Ignore warnings about "Use of GNU statement expression extension" which is raised by our use of diff --git a/UnitTests/OIDTokenRequestTests.m b/UnitTests/OIDTokenRequestTests.m index 20ba691ca..c387bd809 100644 --- a/UnitTests/OIDTokenRequestTests.m +++ b/UnitTests/OIDTokenRequestTests.m @@ -24,11 +24,11 @@ #if SWIFT_PACKAGE @import AppAuthCore; #else -#import "Source/AppAuthCore/OIDAuthorizationRequest.h" -#import "Source/AppAuthCore/OIDAuthorizationResponse.h" -#import "Source/AppAuthCore/OIDScopeUtilities.h" -#import "Source/AppAuthCore/OIDServiceConfiguration.h" -#import "Source/AppAuthCore/OIDTokenRequest.h" +#import "Sources/AppAuthCore/OIDAuthorizationRequest.h" +#import "Sources/AppAuthCore/OIDAuthorizationResponse.h" +#import "Sources/AppAuthCore/OIDScopeUtilities.h" +#import "Sources/AppAuthCore/OIDServiceConfiguration.h" +#import "Sources/AppAuthCore/OIDTokenRequest.h" #endif // Ignore warnings about "Use of GNU statement expression extension" which is raised by our use of diff --git a/UnitTests/OIDTokenResponseTests.m b/UnitTests/OIDTokenResponseTests.m index 5d0a8f8ae..0eb525ed0 100644 --- a/UnitTests/OIDTokenResponseTests.m +++ b/UnitTests/OIDTokenResponseTests.m @@ -23,8 +23,8 @@ #if SWIFT_PACKAGE @import AppAuthCore; #else -#import "Source/AppAuthCore/OIDTokenRequest.h" -#import "Source/AppAuthCore/OIDTokenResponse.h" +#import "Sources/AppAuthCore/OIDTokenRequest.h" +#import "Sources/AppAuthCore/OIDTokenResponse.h" #endif // Ignore warnings about "Use of GNU statement expression extension" which is raised by our use of diff --git a/UnitTests/OIDTokenUtilitiesTests.m b/UnitTests/OIDTokenUtilitiesTests.m index 0a7ff15ec..783e81273 100644 --- a/UnitTests/OIDTokenUtilitiesTests.m +++ b/UnitTests/OIDTokenUtilitiesTests.m @@ -21,7 +21,7 @@ #if SWIFT_PACKAGE @import AppAuthCore; #else -#import "Source/AppAuthCore/OIDTokenUtilities.h" +#import "Sources/AppAuthCore/OIDTokenUtilities.h" #endif @interface OIDTokenUtilitiesTests : XCTestCase diff --git a/UnitTests/OIDURLQueryComponentTests.m b/UnitTests/OIDURLQueryComponentTests.m index d0eec3e5c..eac017c43 100644 --- a/UnitTests/OIDURLQueryComponentTests.m +++ b/UnitTests/OIDURLQueryComponentTests.m @@ -21,7 +21,7 @@ #if SWIFT_PACKAGE @import AppAuthCore; #else -#import "Source/AppAuthCore/OIDURLQueryComponent.h" +#import "Sources/AppAuthCore/OIDURLQueryComponent.h" #endif // Ignore warnings about "Use of GNU statement expression extension" which is raised by our use of diff --git a/UnitTests/OIDURLQueryComponentTestsIOS7.m b/UnitTests/OIDURLQueryComponentTestsIOS7.m index af26ef107..571f61bba 100644 --- a/UnitTests/OIDURLQueryComponentTestsIOS7.m +++ b/UnitTests/OIDURLQueryComponentTestsIOS7.m @@ -21,7 +21,7 @@ #if SWIFT_PACKAGE @import AppAuthCore; #else -#import "Source/AppAuthCore/OIDURLQueryComponent.h" +#import "Sources/AppAuthCore/OIDURLQueryComponent.h" #endif // Ignore warnings about "Use of GNU statement expression extension" which is raised by our use of From 7e2c09cbeb3bb799f26c268dbedb26325ea722a9 Mon Sep 17 00:00:00 2001 From: mdmathias Date: Wed, 13 Mar 2024 16:06:30 -0700 Subject: [PATCH 77/81] Prepare for 1.7.3 release (#834) --- AppAuth.podspec | 2 +- CHANGELOG.md | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/AppAuth.podspec b/AppAuth.podspec index 70f3e4168..393dad42a 100644 --- a/AppAuth.podspec +++ b/AppAuth.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "AppAuth" - s.version = "1.7.2" + s.version = "1.7.3" s.summary = "AppAuth for iOS and macOS is a client SDK for communicating with OAuth 2.0 and OpenID Connect providers." s.description = <<-DESC diff --git a/CHANGELOG.md b/CHANGELOG.md index 12e915e1b..6411e5afb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 1.7.3 +- Fix missing manifest in bundle using SPM ([#833](https://github.com/openid/AppAuth-iOS/pull/833)) + # 1.7.2 - Streamline copying of privacy manifest ([#830](https://github.com/openid/AppAuth-iOS/pull/830)) From eee20d36310e37a26dde368b23c681a7616ec69b Mon Sep 17 00:00:00 2001 From: mdmathias Date: Tue, 2 Apr 2024 10:34:02 -0700 Subject: [PATCH 78/81] Adds defines module to AppAuth.podspec (#845) --- AppAuth.podspec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/AppAuth.podspec b/AppAuth.podspec index 393dad42a..cd11563a6 100644 --- a/AppAuth.podspec +++ b/AppAuth.podspec @@ -41,6 +41,10 @@ It follows the OAuth 2.0 for Native Apps best current practice s.source = { :git => "https://github.com/openid/AppAuth-iOS.git", :tag => s.version } s.requires_arc = true + s.xcconfig = { + 'DEFINES_MODULE' => 'YES', + } + # Subspec for the core AppAuth library classes only, suitable for extensions. s.subspec 'Core' do |core| core.source_files = "Sources/AppAuthCore.h", "Sources/AppAuthCore/*.{h,m}" From 8c0b028aedf617d6d780d448dc836f7048166d0f Mon Sep 17 00:00:00 2001 From: mdmathias Date: Thu, 11 Apr 2024 15:26:02 -0700 Subject: [PATCH 79/81] Prepare for 1.7.4 release (#846) --- AppAuth.podspec | 2 +- CHANGELOG.md | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/AppAuth.podspec b/AppAuth.podspec index cd11563a6..cd9f99af3 100644 --- a/AppAuth.podspec +++ b/AppAuth.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "AppAuth" - s.version = "1.7.3" + s.version = "1.7.4" s.summary = "AppAuth for iOS and macOS is a client SDK for communicating with OAuth 2.0 and OpenID Connect providers." s.description = <<-DESC diff --git a/CHANGELOG.md b/CHANGELOG.md index 6411e5afb..73401d806 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 1.7.4 +- Adds defines module to AppAuth.podspec ([#845](https://github.com/openid/AppAuth-iOS/pull/845)) + # 1.7.3 - Fix missing manifest in bundle using SPM ([#833](https://github.com/openid/AppAuth-iOS/pull/833)) From bbc3648ff20e594c3fb60774341ccebe679fa22d Mon Sep 17 00:00:00 2001 From: mdmathias Date: Thu, 18 Apr 2024 14:33:48 -0700 Subject: [PATCH 80/81] Use correct xcconfig syntax for podspec (#851) --- AppAuth.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppAuth.podspec b/AppAuth.podspec index cd9f99af3..f1dfdf080 100644 --- a/AppAuth.podspec +++ b/AppAuth.podspec @@ -41,7 +41,7 @@ It follows the OAuth 2.0 for Native Apps best current practice s.source = { :git => "https://github.com/openid/AppAuth-iOS.git", :tag => s.version } s.requires_arc = true - s.xcconfig = { + s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', } From c89ed571ae140f8eb1142735e6e23d7bb8c34cb2 Mon Sep 17 00:00:00 2001 From: mdmathias Date: Mon, 22 Apr 2024 15:53:53 -0700 Subject: [PATCH 81/81] Prepare for 1.7.5 release (#852) --- AppAuth.podspec | 2 +- CHANGELOG.md | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/AppAuth.podspec b/AppAuth.podspec index f1dfdf080..bfffe6cda 100644 --- a/AppAuth.podspec +++ b/AppAuth.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "AppAuth" - s.version = "1.7.4" + s.version = "1.7.5" s.summary = "AppAuth for iOS and macOS is a client SDK for communicating with OAuth 2.0 and OpenID Connect providers." s.description = <<-DESC diff --git a/CHANGELOG.md b/CHANGELOG.md index 73401d806..3fce4cb8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 1.7.5 +- Use correct xcconfig syntax for podspec ([#851](https://github.com/openid/AppAuth-iOS/pull/851)) + # 1.7.4 - Adds defines module to AppAuth.podspec ([#845](https://github.com/openid/AppAuth-iOS/pull/845))