├── .codecov.yml ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── config.yml │ └── feature_request.md └── workflows │ └── tests.yml ├── .gitignore ├── .travis.yml ├── AUTHORS ├── AppAuth.podspec ├── AppAuth.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ ├── AppAuth-iOS.xcscheme │ ├── AppAuth-macOS.xcscheme │ ├── AppAuth-tvOS.xcscheme │ ├── AppAuth-watchOS.xcscheme │ ├── AppAuthCore.xcscheme │ ├── AppAuthTV.xcscheme │ ├── AppAuth_iOS.xcscheme │ ├── AppAuth_macOS.xcscheme │ ├── AppAuth_tvOS.xcscheme │ └── AppAuth_watchOS.xcscheme ├── CHANGELOG.md ├── CONTRIBUTING.md ├── CONTRIBUTORS ├── DESIGN.md ├── Doxyfile ├── Examples ├── Example-iOS_ObjC-Carthage │ ├── .gitignore │ ├── Cartfile │ ├── Example.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── Example.xcscheme │ │ │ └── Example_Extension.xcscheme │ ├── Example_Extension │ │ ├── Base.lproj │ │ │ └── MainInterface.storyboard │ │ ├── Example_Extension.entitlements │ │ ├── Info.plist │ │ ├── TodayViewController.h │ │ └── TodayViewController.m │ ├── README.md │ └── Source │ │ ├── AppAuthExampleViewController.h │ │ ├── AppAuthExampleViewController.m │ │ ├── AppAuthExampleViewController.xib │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── AppAuth_Icon_1024.png │ │ │ ├── AppAuth_Icon_120.png │ │ │ ├── AppAuth_Icon_152.png │ │ │ ├── AppAuth_Icon_167.png │ │ │ ├── AppAuth_Icon_180.png │ │ │ ├── AppAuth_Icon_76.png │ │ │ └── Contents.json │ │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ │ ├── Example.entitlements │ │ ├── Info.plist │ │ └── main.m ├── Example-iOS_ObjC │ ├── .gitignore │ ├── Example-iOS_ObjC.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── Example-iOS_ObjC.xcscheme │ │ │ └── Example-iOS_ObjC_Extension.xcscheme │ ├── Example-iOS_ObjC.xcworkspace │ │ └── contents.xcworkspacedata │ ├── Example-iOS_ObjC_Extension │ │ ├── Base.lproj │ │ │ └── MainInterface.storyboard │ │ ├── Example-iOS_ObjC_Extension.entitlements │ │ ├── Info.plist │ │ ├── TodayViewController.h │ │ └── TodayViewController.m │ ├── Podfile │ ├── README.md │ ├── Source │ │ ├── AppAuthExampleViewController.h │ │ ├── AppAuthExampleViewController.m │ │ ├── AppAuthExampleViewController.xib │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Assets.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ ├── AppAuth_Icon_1024.png │ │ │ │ ├── AppAuth_Icon_120.png │ │ │ │ ├── AppAuth_Icon_152.png │ │ │ │ ├── AppAuth_Icon_167.png │ │ │ │ ├── AppAuth_Icon_180.png │ │ │ │ ├── AppAuth_Icon_76.png │ │ │ │ └── Contents.json │ │ ├── Base.lproj │ │ │ └── LaunchScreen.storyboard │ │ ├── Example-iOS_ObjC.entitlements │ │ ├── Info.plist │ │ └── main.m │ └── Tests │ │ ├── AppAuthExampleTests.m │ │ └── Info.plist ├── Example-iOS_Swift-Carthage │ ├── .gitignore │ ├── Cartfile │ ├── Example.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── Example.xcscheme │ │ │ └── Example_Extension.xcscheme │ ├── Example_Extension │ │ ├── Base.lproj │ │ │ └── MainInterface.storyboard │ │ ├── Example_Extension.entitlements │ │ ├── Info.plist │ │ └── TodayViewController.swift │ ├── README.md │ └── Source │ │ ├── AppAuthExampleViewController.swift │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── AppAuth_Icon_1024.png │ │ │ ├── AppAuth_Icon_120.png │ │ │ ├── AppAuth_Icon_152.png │ │ │ ├── AppAuth_Icon_167.png │ │ │ ├── AppAuth_Icon_180.png │ │ │ ├── AppAuth_Icon_76.png │ │ │ └── Contents.json │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Example.entitlements │ │ └── Info.plist ├── Example-macOS │ ├── .gitignore │ ├── Example-macOS.xcodeproj │ │ └── project.pbxproj │ ├── Example-macOS.xcworkspace │ │ └── contents.xcworkspacedata │ ├── Podfile │ ├── README.md │ ├── Source │ │ ├── AppAuthExampleViewController.h │ │ ├── AppAuthExampleViewController.m │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Assets.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ ├── AppAuth_macOS_Icon_1024.png │ │ │ │ ├── AppAuth_macOS_Icon_512.png │ │ │ │ └── Contents.json │ │ ├── Base.lproj │ │ │ ├── AppAuthExampleViewController.xib │ │ │ └── MainMenu.xib │ │ ├── Info.plist │ │ └── main.m │ └── Tests │ │ ├── AppAuthExampleTests.m │ │ └── Info.plist ├── Example-tvOS │ ├── Example-tvOS.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── Example-tvOS │ │ ├── AppAuthTVExampleViewController.h │ │ ├── AppAuthTVExampleViewController.m │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Assets.xcassets │ │ │ ├── App Icon & Top Shelf Image.brandassets │ │ │ │ ├── App Icon - App Store.imagestack │ │ │ │ │ ├── Back.imagestacklayer │ │ │ │ │ │ ├── Content.imageset │ │ │ │ │ │ │ └── Contents.json │ │ │ │ │ │ └── Contents.json │ │ │ │ │ ├── Contents.json │ │ │ │ │ ├── Front.imagestacklayer │ │ │ │ │ │ ├── Content.imageset │ │ │ │ │ │ │ └── Contents.json │ │ │ │ │ │ └── Contents.json │ │ │ │ │ └── Middle.imagestacklayer │ │ │ │ │ │ ├── Content.imageset │ │ │ │ │ │ └── Contents.json │ │ │ │ │ │ └── Contents.json │ │ │ │ ├── App Icon.imagestack │ │ │ │ │ ├── Back.imagestacklayer │ │ │ │ │ │ ├── Content.imageset │ │ │ │ │ │ │ └── Contents.json │ │ │ │ │ │ └── Contents.json │ │ │ │ │ ├── Contents.json │ │ │ │ │ ├── Front.imagestacklayer │ │ │ │ │ │ ├── Content.imageset │ │ │ │ │ │ │ └── Contents.json │ │ │ │ │ │ └── Contents.json │ │ │ │ │ └── Middle.imagestacklayer │ │ │ │ │ │ ├── Content.imageset │ │ │ │ │ │ └── Contents.json │ │ │ │ │ │ └── Contents.json │ │ │ │ ├── Contents.json │ │ │ │ ├── Top Shelf Image Wide.imageset │ │ │ │ │ └── Contents.json │ │ │ │ └── Top Shelf Image.imageset │ │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Base.lproj │ │ │ └── LaunchScreen.storyboard │ │ ├── Info.plist │ │ ├── Main.storyboard │ │ └── main.m │ ├── Podfile │ └── README.md ├── README-Google.md ├── README-IdentityServer.md ├── README-Okta.md ├── README-PingFederate.md └── README.md ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── Package.swift ├── README.md ├── Sources ├── AppAuth.h ├── AppAuth │ ├── Resources │ │ └── PrivacyInfo.xcprivacy │ ├── iOS │ │ ├── OIDAuthState+IOS.h │ │ ├── OIDAuthState+IOS.m │ │ ├── OIDAuthorizationService+IOS.h │ │ ├── OIDAuthorizationService+IOS.m │ │ ├── OIDExternalUserAgentCatalyst.h │ │ ├── OIDExternalUserAgentCatalyst.m │ │ ├── OIDExternalUserAgentIOS.h │ │ ├── OIDExternalUserAgentIOS.m │ │ ├── OIDExternalUserAgentIOSCustomBrowser.h │ │ └── OIDExternalUserAgentIOSCustomBrowser.m │ └── macOS │ │ ├── LoopbackHTTPServer │ │ ├── OIDLoopbackHTTPServer.h │ │ └── OIDLoopbackHTTPServer.m │ │ ├── OIDAuthState+Mac.h │ │ ├── OIDAuthState+Mac.m │ │ ├── OIDAuthorizationService+Mac.h │ │ ├── OIDAuthorizationService+Mac.m │ │ ├── OIDExternalUserAgentMac.h │ │ ├── OIDExternalUserAgentMac.m │ │ ├── OIDRedirectHTTPHandler.h │ │ └── OIDRedirectHTTPHandler.m ├── AppAuthCore.h ├── AppAuthCore │ ├── OIDAuthState.h │ ├── OIDAuthState.m │ ├── OIDAuthStateChangeDelegate.h │ ├── OIDAuthStateErrorDelegate.h │ ├── OIDAuthorizationRequest.h │ ├── OIDAuthorizationRequest.m │ ├── OIDAuthorizationResponse.h │ ├── OIDAuthorizationResponse.m │ ├── OIDAuthorizationService.h │ ├── OIDAuthorizationService.m │ ├── OIDClientMetadataParameters.h │ ├── OIDClientMetadataParameters.m │ ├── OIDDefines.h │ ├── OIDEndSessionRequest.h │ ├── OIDEndSessionRequest.m │ ├── OIDEndSessionResponse.h │ ├── OIDEndSessionResponse.m │ ├── OIDError.h │ ├── OIDError.m │ ├── OIDErrorUtilities.h │ ├── OIDErrorUtilities.m │ ├── OIDExternalUserAgent.h │ ├── OIDExternalUserAgentRequest.h │ ├── OIDExternalUserAgentSession.h │ ├── OIDFieldMapping.h │ ├── OIDFieldMapping.m │ ├── OIDGrantTypes.h │ ├── OIDGrantTypes.m │ ├── OIDIDToken.h │ ├── OIDIDToken.m │ ├── OIDRegistrationRequest.h │ ├── OIDRegistrationRequest.m │ ├── OIDRegistrationResponse.h │ ├── OIDRegistrationResponse.m │ ├── OIDResponseTypes.h │ ├── OIDResponseTypes.m │ ├── OIDScopeUtilities.h │ ├── OIDScopeUtilities.m │ ├── OIDScopes.h │ ├── OIDScopes.m │ ├── OIDServiceConfiguration.h │ ├── OIDServiceConfiguration.m │ ├── OIDServiceDiscovery.h │ ├── OIDServiceDiscovery.m │ ├── OIDTokenRequest.h │ ├── OIDTokenRequest.m │ ├── OIDTokenResponse.h │ ├── OIDTokenResponse.m │ ├── OIDTokenUtilities.h │ ├── OIDTokenUtilities.m │ ├── OIDURLQueryComponent.h │ ├── OIDURLQueryComponent.m │ ├── OIDURLSessionProvider.h │ ├── OIDURLSessionProvider.m │ └── Resources │ │ └── PrivacyInfo.xcprivacy ├── AppAuthTV.h ├── AppAuthTV │ ├── OIDTVAuthorizationRequest.h │ ├── OIDTVAuthorizationRequest.m │ ├── OIDTVAuthorizationResponse.h │ ├── OIDTVAuthorizationResponse.m │ ├── OIDTVAuthorizationService.h │ ├── OIDTVAuthorizationService.m │ ├── OIDTVServiceConfiguration.h │ ├── OIDTVServiceConfiguration.m │ ├── OIDTVTokenRequest.h │ ├── OIDTVTokenRequest.m │ └── Resources │ │ └── PrivacyInfo.xcprivacy ├── CoreFramework │ ├── AppAuthCore.h │ └── Info.plist ├── Framework │ ├── AppAuth.h │ └── Info.plist └── TVFramework │ ├── AppAuthTV.h │ └── Info.plist ├── UnitTests ├── AppAuthTV │ ├── OIDTVAuthorizationRequestTests.h │ ├── OIDTVAuthorizationRequestTests.m │ ├── OIDTVAuthorizationResponseTests.h │ ├── OIDTVAuthorizationResponseTests.m │ ├── OIDTVTokenRequestTests.h │ └── OIDTVTokenRequestTests.m ├── OIDAppAuthTests-Bridging-Header.h ├── OIDAuthStateTests.h ├── OIDAuthStateTests.m ├── OIDAuthorizationRequestTests.h ├── OIDAuthorizationRequestTests.m ├── OIDAuthorizationResponseTests.h ├── OIDAuthorizationResponseTests.m ├── OIDEndSessionRequestTests.h ├── OIDEndSessionRequestTests.m ├── OIDGrantTypesTests.m ├── OIDRPProfileCode.h ├── OIDRPProfileCode.m ├── OIDRegistrationRequestTests.h ├── OIDRegistrationRequestTests.m ├── OIDRegistrationResponseTests.h ├── OIDRegistrationResponseTests.m ├── OIDResponseTypesTests.m ├── OIDScopesTests.m ├── OIDServiceConfigurationTests.h ├── OIDServiceConfigurationTests.m ├── OIDServiceDiscoveryTests.h ├── OIDServiceDiscoveryTests.m ├── OIDSwiftTests.swift ├── OIDTokenRequestTests.h ├── OIDTokenRequestTests.m ├── OIDTokenResponseTests.h ├── OIDTokenResponseTests.m ├── OIDTokenUtilitiesTests.m ├── OIDURLQueryComponentTests.h ├── OIDURLQueryComponentTests.m ├── OIDURLQueryComponentTestsIOS7.m ├── OIDURLSessionProviderTests.m └── UnitTestsInfo.plist └── appauth_lockup.svg /.codecov.yml: -------------------------------------------------------------------------------- 1 | ignore: 2 | - "UnitTests" 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: Submit a bug report if something isn't working as expected. 4 | title: "" 5 | labels: bug, triage 6 | assignees: "" 7 | --- 8 | 9 | **Describe the bug** 10 | A clear and concise description of what the bug is. 11 | 12 | **To Reproduce** 13 | Steps to reproduce the behavior: 14 | 1. Go to '...' 15 | 2. Tap on '....' 16 | 3. Scroll down to '....' 17 | 4. See error 18 | 19 | **Expected behavior** 20 | A clear and concise description of what you expected to happen. 21 | 22 | **Screenshots** 23 | If applicable, add screenshots to help explain your problem. 24 | 25 | **Environment** 26 | - Device: [ e.g. iPhone 13, MacBook Pro, etc ] 27 | - OS: [ e.g. iOS 15, macOS 11, etc ] 28 | - Browser: [ e.g. Safari, Chrome, etc ] 29 | 30 | **Additional context** 31 | Add any other context about the problem here. 32 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: Make a feature request if you have a suggestion for something new. 4 | title: "" 5 | labels: enhancement, triage 6 | assignees: "" 7 | --- 8 | 9 | **Is your feature request related to a problem you're having? Please describe.** 10 | A clear and concise description of what the problem is. 11 | 12 | **Describe the solution you'd like** 13 | A clear and concise description of what you want to happen. 14 | 15 | **Describe alternatives you've considered** 16 | A clear and concise description of any alternative solutions or features you've considered. 17 | 18 | **Additional context** 19 | Add any other context or screenshots about the feature request here. 20 | -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: tests 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | workflow_dispatch: 11 | 12 | jobs: 13 | 14 | xcode-project-test: 15 | runs-on: macos-13 16 | strategy: 17 | matrix: 18 | flags: [ 19 | "-scheme AppAuth-iOS -destination 'platform=iOS Simulator,name=iPhone 15,OS=17.2' -sdk 'iphonesimulator17.2'", 20 | "-scheme AppAuth-macOS -destination 'platform=macOS,arch=x86_64' -sdk 'macosx14.2'", 21 | "-scheme AppAuth_macOS -destination 'platform=macOS,arch=x86_64' -sdk 'macosx14.2'", 22 | "-scheme AppAuth-tvOS -destination 'platform=tvOS Simulator,name=Apple TV,OS=17.2' -sdk 'appletvsimulator17.2'", 23 | "-scheme AppAuth_tvOS -destination 'platform=tvOS Simulator,name=Apple TV,OS=17.2' -sdk 'appletvsimulator17.2'", 24 | "-scheme AppAuthTV -destination 'platform=tvOS Simulator,name=Apple TV,OS=17.2' -sdk 'appletvsimulator17.2'" 25 | ] 26 | steps: 27 | - uses: actions/checkout@v3 28 | - name: Run unit test targets 29 | run: | 30 | xcodebuild test \ 31 | -project AppAuth.xcodeproj \ 32 | ${{ matrix.flags }} 33 | 34 | pod-lib-lint: 35 | runs-on: macos-13 36 | strategy: 37 | matrix: 38 | flags: [ 39 | '', 40 | '--use-libraries', 41 | '--use-static-frameworks' 42 | ] 43 | steps: 44 | - uses: actions/checkout@v3 45 | - name: Update Bundler 46 | run: bundle update --bundler 47 | - name: Install Ruby gems with Bundler 48 | run: bundle install 49 | - name: Lint podspec using local source 50 | run: pod lib lint --verbose ${{ matrix.flags }} 51 | 52 | spm-build-test: 53 | runs-on: macos-13 54 | steps: 55 | - uses: actions/checkout@v3 56 | - name: Build unit test target 57 | run: swift build 58 | - name: Run unit test target 59 | run: swift test --enable-code-coverage 60 | - name: Upload coverage to Codecov 61 | uses: codecov/codecov-action@v3 62 | with: 63 | version: v0.7.3 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Docs/ 2 | xcuserdata/ 3 | Carthage/ 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Travis CI config for AppAuth 2 | # Use the `wwtd` gem to test locally. 3 | language: objective-c 4 | 5 | jobs: 6 | include: 7 | - stage: Swift PM 8 | osx_image: xcode11.4 9 | script: 10 | # Build the project using Swift PM 11 | - swift build 12 | # Test the project using Swift PM 13 | - swift test 14 | 15 | - stage: Xcode Tests 16 | osx_image: xcode11 17 | # Tests iOS, macOS and tvOS: both static library and framework schemes. 18 | env: 19 | # To generate this list, use `xcodebuild -showsdks` to get possible SDK values, and platforms. 20 | # Use `instruments -s devices` to get the device name. 21 | - SCHEME=AppAuth-iOS DESTINATION="'platform=iOS Simulator,name=iPhone 11,OS=13.0'" SDK=iphonesimulator13.0 22 | - SCHEME=AppAuth_iOS DESTINATION="'platform=iOS Simulator,name=iPhone 11,OS=13.0'" SDK=iphonesimulator13.0 23 | - SCHEME=AppAuth-macOS DESTINATION="'platform=macOS,arch=x86_64'" SDK=macosx10.15 24 | - SCHEME=AppAuth_macOS DESTINATION="'platform=macOS,arch=x86_64'" SDK=macosx10.15 25 | - SCHEME=AppAuth-tvOS DESTINATION="'platform=tvOS Simulator,name=Apple TV,OS=13.0'" SDK=appletvsimulator13.0 26 | - SCHEME=AppAuth_tvOS DESTINATION="'platform=tvOS Simulator,name=Apple TV,OS=13.0'" SDK=appletvsimulator13.0 27 | - SCHEME=AppAuthTV DESTINATION="'platform=tvOS Simulator,name=Apple TV,OS=13.0'" SDK=appletvsimulator13.0 28 | before_script: 29 | - sudo gem install xcpretty 30 | script: 31 | # Breaking down this command: 32 | # eval is used here, otherwise environment variables are not present. 33 | # `set -o pipefail && ` is so that the return code isn't gobbled by xcpretty (per https://github.com/supermarin/xcpretty#usage) 34 | # then it's standard xcodebuild | xcpretty. 35 | - eval "set -o pipefail && xcodebuild -project AppAuth.xcodeproj -scheme $SCHEME -sdk $SDK -destination $DESTINATION -enableCodeCoverage YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES OTHERCFLAGS='-Werror' test | xcpretty" 36 | after_success: 37 | - bash <(curl -s https://codecov.io/bash) 38 | 39 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of the AppAuth for iOS authors for copyright purposes. 2 | # This file is distinct from the CONTRIBUTORS files. 3 | # See the latter for an explanation. 4 | # Names should be added to this file as: 5 | # Name or Organization 6 | # The email address is not required for organizations. 7 | 8 | Google Inc. 9 | Rebecka Gulliksson 10 | Ping Identity 11 | equinux AG 12 | Craig Lane 13 | Hernan Zalazar 14 | Julien Bodet 15 | 16 | -------------------------------------------------------------------------------- /AppAuth.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AppAuth.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to AppAuth 2 | 3 | All contributions to AppAuth for iOS are welcome! 4 | 5 | Note that as this library is planned to be used in high-profile production code, 6 | we insist on a very high standards for the code and design, but don't feel shy: 7 | discuss your plans over 8 | [GitHub Issues](https://github.com/openid/AppAuth-iOS/issues) and the 9 | [mailing list](http://lists.openid.net/mailman/listinfo/openid-specs-ab), and 10 | send in those pull requests! 11 | 12 | # Signing the Agreements 13 | 14 | In order to contribute to this project, you need to execute two legal agreements 15 | that cover your contributions. Pull requests from users who have not signed 16 | these agreements will not be merged. 17 | 18 | ## Execute the Contributor License Agreement (CLA) 19 | 20 | 1. Visit http://openid.net/contribution-license-agreement/ 21 | 2. Tap *Execute OpenID Foundation Contribution License Agreement* for the 22 | version relevant to you (Individual or Corporate). 23 | 3. Follow the instructions to sign the agreement. 24 | 25 | ## Execute the Working Group Contribution Agreement 26 | 27 | In addition to the Code License Agreement, the OpenID Foundation also requires 28 | a working group contribution agreement to cover any contributions you may make 29 | towards the OpenID Connect spec itself (e.g. in comments, bug reports, feature 30 | requests). 31 | 32 | 1. Visit http://openid.net/intellectual-property/ 33 | 2. Tap *Execute Contributor Agreement By Electronic Signature* in the box 34 | marked *Resources*. 35 | 3. Follow the instructions to sign the document, state `OpenID AB/Connect` as 36 | the Initial Working Group 37 | 38 | # Making a Pull Request 39 | 40 | ## Before you Start 41 | 42 | Before you work on a big new feature, get in touch to make sure that your work 43 | is inline with the direction of the project and get input on your architecture. 44 | You can file an [Issue](https://github.com/openid/AppAuth-iOS/issues) 45 | discussing your proposal, or email the 46 | [list](http://lists.openid.net/mailman/listinfo/openid-specs-ab). 47 | 48 | ## Coding Standards 49 | 50 | The AppAuth library follows the 51 | [Google Objective-C Style Guide](https://google.github.io/styleguide/objcguide.html). Please review your own code for adherence to the 52 | standard. 53 | 54 | ## Pull Request Reviews 55 | 56 | All pull requests, even by members who have repository write access need to be 57 | reviewed and marked as "LGTM" before they will be merged. 58 | 59 | -------------------------------------------------------------------------------- /CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # People who have agreed to one of the CLAs and can contribute patches. 2 | # The AUTHORS file lists the copyright holders; this file 3 | # lists people. For example, Google employees are listed here 4 | # but not in AUTHORS, because Google holds the copyright. 5 | # 6 | # https://developers.google.com/open-source/cla/individual 7 | # https://developers.google.com/open-source/cla/corporate 8 | # 9 | # Names should be added to this file as: 10 | # Name 11 | 12 | Steven E Wright 13 | William Denniss 14 | Iain McGinniss 15 | Xiangtian Dai 16 | Rebecka Gulliksson 17 | David Waite 18 | Craig Lane https://github.com/ProjectLane 19 | Hernan Zalazar https://github.com/hzalaz 20 | Joseph Heenan https://github.com/jogu 21 | Julien Bodet https://github.com/julienbodet 22 | Tobias Schröpf https://github.com/schroepf 23 | Dave MacLachlan https://github.com/dmaclach -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC-Carthage/.gitignore: -------------------------------------------------------------------------------- 1 | ## Build generated 2 | build/ 3 | DerivedData/ 4 | 5 | ## Various settings 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata/ 15 | 16 | ## Other 17 | *.moved-aside 18 | *.xccheckout 19 | *.xcscmblueprint 20 | 21 | ## Obj-C/Swift specific 22 | *.hmap 23 | *.ipa 24 | *.dSYM.zip 25 | *.dSYM 26 | 27 | # Pods are ignored in the samples as all Pods & their dependencies are either 28 | # development Pods (this repo) or sourced from repos in the same organization. 29 | # Generally we recommend committing Pod artifacts to version control, read about 30 | # the pros & cons here: 31 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 32 | Pods 33 | 34 | # Carthage 35 | # 36 | # Add these lines if you want to avoid checking in source code from Carthage 37 | # dependencies. Generally we recommend committing Carthage artifacts to version 38 | # control. 39 | Carthage/Checkouts 40 | Carthage/Build 41 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC-Carthage/Cartfile: -------------------------------------------------------------------------------- 1 | github "openid/AppAuth-iOS" "master" 2 | 3 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC-Carthage/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC-Carthage/Example_Extension/Example_Extension.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.application-groups 6 | 7 | group.net.openid.appauth.Example 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC-Carthage/Example_Extension/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Example_Extension 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | XPC! 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | NSExtension 24 | 25 | NSExtensionMainStoryboard 26 | MainInterface 27 | NSExtensionPointIdentifier 28 | com.apple.widget-extension 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC-Carthage/Example_Extension/TodayViewController.h: -------------------------------------------------------------------------------- 1 | /*! @file TodayViewController.h 2 | @brief AppAuth iOS SDK Example 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | @interface TodayViewController : UIViewController 22 | 23 | @end 24 | 25 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC-Carthage/README.md: -------------------------------------------------------------------------------- 1 | # Example Project 2 | 3 | ## Setup & Open the Project 4 | 5 | You'll need to have [Carthage](https://github.com/Carthage/Carthage) installed 6 | in order to pull the AppAuth dependency. 7 | 8 | So first run `carthage bootstrap` to build AppAuth framework then open the 9 | `Example.xcodeproj` file. 10 | 11 | ## Configuration 12 | 13 | The example doesn't work out of the box, you need to configure it with your own 14 | client ID. 15 | 16 | ### Information You'll Need 17 | 18 | * Issuer 19 | * Client ID 20 | * Redirect URI 21 | 22 | How to get this information varies by IdP, but we have 23 | [instructions](../README.md#openid-certified-providers) for some OpenID 24 | Certified providers. 25 | 26 | ### Configure the Example 27 | 28 | #### In the file `AppAuthExampleViewController.m` 29 | 30 | 1. Update `kIssuer` with the IdP's issuer. 31 | 2. Update `kClientID` with your new client id. 32 | 3. Update `kRedirectURI` redirect URI 33 | 34 | #### In the file `Info.plist` 35 | 36 | Fully expand "URL types" (a.k.a. `CFBundleURLTypes`) and replace 37 | `com.example.app` with the *scheme* of your redirect URI. 38 | The scheme is everything before the colon (`:`). For example, if the redirect 39 | URI is `com.example.app:/oauth2redirect/example-provider`, then the scheme 40 | would be `com.example.app`. 41 | 42 | ### Running the Example 43 | 44 | Now your example should be ready to run. 45 | 46 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC-Carthage/Source/AppAuthExampleViewController.h: -------------------------------------------------------------------------------- 1 | /*! @file AppAuthExampleViewController.h 2 | @brief AppAuth iOS SDK Example 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | #import 19 | 20 | @class OIDAuthState; 21 | @class OIDServiceConfiguration; 22 | 23 | NS_ASSUME_NONNULL_BEGIN 24 | 25 | /*! @brief The example application's view controller. 26 | */ 27 | @interface AppAuthExampleViewController : UIViewController 28 | 29 | @property(nullable) IBOutlet UIButton *authAutoButton; 30 | @property(nullable) IBOutlet UIButton *authManual; 31 | @property(nullable) IBOutlet UIButton *codeExchangeButton; 32 | @property(nullable) IBOutlet UIButton *userinfoButton; 33 | @property(nullable) IBOutlet UIButton *clearAuthStateButton; 34 | @property(nullable) IBOutlet UITextView *logTextView; 35 | 36 | /*! @brief The authorization state. This is the AppAuth object that you should keep around and 37 | serialize to disk. 38 | */ 39 | @property(nonatomic, readonly, nullable) OIDAuthState *authState; 40 | 41 | /*! @brief Authorization code flow using @c OIDAuthState automatic code exchanges. 42 | @param sender IBAction sender. 43 | */ 44 | - (IBAction)authWithAutoCodeExchange:(nullable id)sender; 45 | 46 | /*! @brief Authorization code flow without a the code exchange (need to call @c codeExchange: 47 | manually) 48 | @param sender IBAction sender. 49 | */ 50 | - (IBAction)authNoCodeExchange:(nullable id)sender; 51 | 52 | /*! @brief Performs the authorization code exchange at the token endpoint. 53 | @param sender IBAction sender. 54 | */ 55 | - (IBAction)codeExchange:(nullable id)sender; 56 | 57 | /*! @brief Performs a Userinfo API call using @c OIDAuthState.performActionWithFreshTokens. 58 | @param sender IBAction sender. 59 | */ 60 | - (IBAction)userinfo:(nullable id)sender; 61 | 62 | /*! @brief Nils the @c OIDAuthState object. 63 | @param sender IBAction sender. 64 | */ 65 | - (IBAction)clearAuthState:(nullable id)sender; 66 | 67 | /*! @brief Clears the UI log. 68 | @param sender IBAction sender. 69 | */ 70 | - (IBAction)clearLog:(nullable id)sender; 71 | 72 | @end 73 | 74 | NS_ASSUME_NONNULL_END 75 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC-Carthage/Source/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /*! @file AppDelegate.h 2 | @brief AppAuth iOS SDK Example 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | #import 19 | 20 | @protocol OIDExternalUserAgentSession; 21 | 22 | /*! @brief The example application's delegate. 23 | */ 24 | @interface AppDelegate : UIResponder 25 | 26 | /*! @brief The sample application's @c UIWindow. 27 | */ 28 | @property(nonatomic, strong, nullable) UIWindow *window; 29 | 30 | /*! @brief The authorization flow session which receives the return URL from \SFSafariViewController. 31 | @discussion We need to store this in the app delegate as it's that delegate which receives the 32 | incoming URL on UIApplicationDelegate.application:openURL:options:. This property will be 33 | nil, except when an authorization flow is in progress. 34 | */ 35 | @property(nonatomic, strong, nullable) id currentAuthorizationFlow; 36 | 37 | @end 38 | 39 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC-Carthage/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openid/AppAuth-iOS/145104f5ea9d58ae21b60add007c33c1cc0c948e/Examples/Example-iOS_ObjC-Carthage/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_1024.png -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC-Carthage/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openid/AppAuth-iOS/145104f5ea9d58ae21b60add007c33c1cc0c948e/Examples/Example-iOS_ObjC-Carthage/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_120.png -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC-Carthage/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openid/AppAuth-iOS/145104f5ea9d58ae21b60add007c33c1cc0c948e/Examples/Example-iOS_ObjC-Carthage/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_152.png -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC-Carthage/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openid/AppAuth-iOS/145104f5ea9d58ae21b60add007c33c1cc0c948e/Examples/Example-iOS_ObjC-Carthage/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_167.png -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC-Carthage/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openid/AppAuth-iOS/145104f5ea9d58ae21b60add007c33c1cc0c948e/Examples/Example-iOS_ObjC-Carthage/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_180.png -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC-Carthage/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openid/AppAuth-iOS/145104f5ea9d58ae21b60add007c33c1cc0c948e/Examples/Example-iOS_ObjC-Carthage/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_76.png -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC-Carthage/Source/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "60x60", 35 | "idiom" : "iphone", 36 | "filename" : "AppAuth_Icon_120.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "AppAuth_Icon_180.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "idiom" : "ipad", 47 | "size" : "20x20", 48 | "scale" : "1x" 49 | }, 50 | { 51 | "idiom" : "ipad", 52 | "size" : "20x20", 53 | "scale" : "2x" 54 | }, 55 | { 56 | "idiom" : "ipad", 57 | "size" : "29x29", 58 | "scale" : "1x" 59 | }, 60 | { 61 | "idiom" : "ipad", 62 | "size" : "29x29", 63 | "scale" : "2x" 64 | }, 65 | { 66 | "idiom" : "ipad", 67 | "size" : "40x40", 68 | "scale" : "1x" 69 | }, 70 | { 71 | "idiom" : "ipad", 72 | "size" : "40x40", 73 | "scale" : "2x" 74 | }, 75 | { 76 | "size" : "76x76", 77 | "idiom" : "ipad", 78 | "filename" : "AppAuth_Icon_76.png", 79 | "scale" : "1x" 80 | }, 81 | { 82 | "size" : "76x76", 83 | "idiom" : "ipad", 84 | "filename" : "AppAuth_Icon_152.png", 85 | "scale" : "2x" 86 | }, 87 | { 88 | "size" : "83.5x83.5", 89 | "idiom" : "ipad", 90 | "filename" : "AppAuth_Icon_167.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "1024x1024", 95 | "idiom" : "ios-marketing", 96 | "filename" : "AppAuth_Icon_1024.png", 97 | "scale" : "1x" 98 | } 99 | ], 100 | "info" : { 101 | "version" : 1, 102 | "author" : "xcode" 103 | } 104 | } -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC-Carthage/Source/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC-Carthage/Source/Example.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.application-groups 6 | 7 | group.net.openid.appauth.Example 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC-Carthage/Source/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleURLTypes 22 | 23 | 24 | CFBundleTypeRole 25 | Editor 26 | CFBundleURLSchemes 27 | 28 | com.example.app 29 | 30 | 31 | 32 | CFBundleVersion 33 | 1 34 | LSRequiresIPhoneOS 35 | 36 | UILaunchStoryboardName 37 | LaunchScreen 38 | UIRequiredDeviceCapabilities 39 | 40 | armv7 41 | 42 | UISupportedInterfaceOrientations 43 | 44 | UIInterfaceOrientationPortrait 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | UISupportedInterfaceOrientations~ipad 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationPortraitUpsideDown 52 | UIInterfaceOrientationLandscapeLeft 53 | UIInterfaceOrientationLandscapeRight 54 | 55 | NSAppTransportSecurity 56 | 57 | NSExceptionDomains 58 | 59 | localhost 60 | 61 | NSExceptionAllowsInsecureHTTPLoads 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC-Carthage/Source/main.m: -------------------------------------------------------------------------------- 1 | /*! @file main.m 2 | @brief AppAuth iOS SDK Example 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | #import "AppDelegate.h" 22 | 23 | /*! @brief Application main entry point. 24 | @return Exit code. 25 | */ 26 | int main(int argc, char *argv[]) { 27 | @autoreleasepool { 28 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC/.gitignore: -------------------------------------------------------------------------------- 1 | ## Build generated 2 | build/ 3 | DerivedData/ 4 | 5 | ## Various settings 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata/ 15 | 16 | ## Other 17 | *.moved-aside 18 | *.xcuserstate 19 | 20 | # Pods are ignored in the samples as all Pods & their dependencies are either 21 | # development Pods (this repo) or sourced from repos in the same organization. 22 | # Generally we recommend versioning Pods, see the pros & cons here: 23 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 24 | Pods 25 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC/Example-iOS_ObjC.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/Example-iOS_ObjC_Extension.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.application-groups 6 | 7 | group.net.openid.appauth.Example 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Example-iOS_ObjC_Extension 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | XPC! 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | NSExtension 24 | 25 | NSExtensionMainStoryboard 26 | MainInterface 27 | NSExtensionPointIdentifier 28 | com.apple.widget-extension 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC/Example-iOS_ObjC_Extension/TodayViewController.h: -------------------------------------------------------------------------------- 1 | /*! @file TodayViewController.h 2 | @brief AppAuth iOS SDK Example 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | @interface TodayViewController : UIViewController 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '11.0' 2 | 3 | use_frameworks! 4 | 5 | target 'Example-iOS_ObjC' do 6 | # AppAuth Pod 7 | # In production, just use `pod 'AppAuth'` without the path reference. 8 | pod 'AppAuth', :path => '../../' 9 | end 10 | 11 | target 'Example-iOS_ObjC_Extension' do 12 | # AppAuth/Core Pod 13 | # In production, just use `pod 'AppAuth/Core'` without the path reference. 14 | pod 'AppAuth/Core', :path => '../../' 15 | end 16 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC/README.md: -------------------------------------------------------------------------------- 1 | # Example Project 2 | 3 | ## Setup & Open the Project 4 | 5 | 1. In the `Example-iOS_ObjC` folder, run the following command to install the 6 | AppAuth pod. 7 | 8 | ``` 9 | pod install 10 | ``` 11 | 12 | 2. Open the `Example-iOS_ObjC.xcworkspace` workspace. 13 | 14 | ``` 15 | open Example-iOS_ObjC.xcworkspace 16 | ``` 17 | 18 | This workspace is configured to include AppAuth via CocoaPods. You can also 19 | directly include AppAuth as a static library using the build targets in the 20 | `AppAuth.xcodeproj` project. 21 | 22 | ## Configuration 23 | 24 | The example doesn't work out of the box, you need to configure it with your own 25 | client ID. 26 | 27 | ### Information You'll Need 28 | 29 | * Issuer 30 | * Client ID 31 | * Redirect URI 32 | 33 | How to get this information varies by IdP, but we have 34 | [instructions](../README.md#openid-certified-providers) for some OpenID 35 | Certified providers. 36 | 37 | ### Configure the Example 38 | 39 | #### In the file `AppAuthExampleViewController.m` 40 | 41 | 1. Update `kIssuer` with the IdP's issuer. 42 | 2. Update `kClientID` with your new client id. 43 | 3. Update `kRedirectURI` redirect URI 44 | 45 | #### In the file `Info.plist` 46 | 47 | Fully expand "URL types" (a.k.a. `CFBundleURLTypes`) and replace 48 | `com.example.app` with the *scheme* of your redirect URI. 49 | The scheme is everything before the colon (`:`). For example, if the redirect 50 | URI is `com.example.app:/oauth2redirect/example-provider`, then the scheme 51 | would be `com.example.app`. 52 | 53 | ### Running the Example 54 | 55 | Now your example should be ready to run. 56 | 57 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC/Source/AppAuthExampleViewController.h: -------------------------------------------------------------------------------- 1 | /*! @file AppAuthExampleViewController.h 2 | @brief AppAuth iOS SDK Example 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | #import 19 | 20 | @class OIDAuthState; 21 | @class OIDServiceConfiguration; 22 | 23 | NS_ASSUME_NONNULL_BEGIN 24 | 25 | /*! @brief The example application's view controller. 26 | */ 27 | @interface AppAuthExampleViewController : UIViewController 28 | 29 | @property(nullable) IBOutlet UIButton *authAutoButton; 30 | @property(nullable) IBOutlet UIButton *authManual; 31 | @property(nullable) IBOutlet UIButton *codeExchangeButton; 32 | @property(nullable) IBOutlet UIButton *userinfoButton; 33 | @property(nullable) IBOutlet UIButton *clearAuthStateButton; 34 | @property(nullable) IBOutlet UITextView *logTextView; 35 | 36 | /*! @brief The authorization state. This is the AppAuth object that you should keep around and 37 | serialize to disk. 38 | */ 39 | @property(nonatomic, readonly, nullable) OIDAuthState *authState; 40 | 41 | /*! @brief Authorization code flow using @c OIDAuthState automatic code exchanges. 42 | @param sender IBAction sender. 43 | */ 44 | - (IBAction)authWithAutoCodeExchange:(nullable id)sender; 45 | 46 | /*! @brief Authorization code flow without a the code exchange (need to call @c codeExchange: 47 | manually) 48 | @param sender IBAction sender. 49 | */ 50 | - (IBAction)authNoCodeExchange:(nullable id)sender; 51 | 52 | /*! @brief Performs the authorization code exchange at the token endpoint. 53 | @param sender IBAction sender. 54 | */ 55 | - (IBAction)codeExchange:(nullable id)sender; 56 | 57 | /*! @brief Performs a Userinfo API call using @c OIDAuthState.performActionWithFreshTokens. 58 | @param sender IBAction sender. 59 | */ 60 | - (IBAction)userinfo:(nullable id)sender; 61 | 62 | /*! @brief Nils the @c OIDAuthState object. 63 | @param sender IBAction sender. 64 | */ 65 | - (IBAction)clearAuthState:(nullable id)sender; 66 | 67 | /*! @brief Clears the UI log. 68 | @param sender IBAction sender. 69 | */ 70 | - (IBAction)clearLog:(nullable id)sender; 71 | 72 | @end 73 | 74 | NS_ASSUME_NONNULL_END 75 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC/Source/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /*! @file AppDelegate.h 2 | @brief AppAuth iOS SDK Example 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | #import 19 | 20 | @protocol OIDExternalUserAgentSession; 21 | 22 | /*! @brief The example application's delegate. 23 | */ 24 | @interface AppDelegate : UIResponder 25 | 26 | /*! @brief The sample application's @c UIWindow. 27 | */ 28 | @property(nonatomic, strong, nullable) UIWindow *window; 29 | 30 | /*! @brief The authorization flow session which receives the return URL from \SFSafariViewController. 31 | @discussion We need to store this in the app delegate as it's that delegate which receives the 32 | incoming URL on UIApplicationDelegate.application:openURL:options:. This property will be 33 | nil, except when an authorization flow is in progress. 34 | */ 35 | @property(nonatomic, strong, nullable) id currentAuthorizationFlow; 36 | 37 | @end 38 | 39 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC/Source/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /*! @file AppDelegate.m 2 | @brief AppAuth iOS SDK Example 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import "AppDelegate.h" 20 | 21 | #import "AppAuth.h" 22 | #import "AppAuthExampleViewController.h" 23 | 24 | @interface AppDelegate () 25 | 26 | @end 27 | 28 | @implementation AppDelegate 29 | 30 | - (BOOL)application:(UIApplication *)application 31 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 32 | 33 | UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 34 | UIViewController *mainViewController = 35 | [[AppAuthExampleViewController alloc] initWithNibName:nil bundle:nil]; 36 | window.rootViewController = mainViewController; 37 | 38 | _window = window; 39 | [_window makeKeyAndVisible]; 40 | 41 | return YES; 42 | } 43 | 44 | /*! @brief Handles inbound URLs. Checks if the URL matches the redirect URI for a pending 45 | AppAuth authorization request. 46 | */ 47 | - (BOOL)application:(UIApplication *)app 48 | openURL:(NSURL *)url 49 | options:(NSDictionary *)options { 50 | // Sends the URL to the current authorization flow (if any) which will process it if it relates to 51 | // an authorization response. 52 | if ([_currentAuthorizationFlow resumeExternalUserAgentFlowWithURL:url]) { 53 | _currentAuthorizationFlow = nil; 54 | return YES; 55 | } 56 | 57 | // Your additional URL handling (if any) goes here. 58 | 59 | return NO; 60 | } 61 | 62 | /*! @brief Forwards inbound URLs for iOS 8.x and below to @c application:openURL:options:. 63 | @discussion When you drop support for versions of iOS earlier than 9.0, you can delete this 64 | method. NB. this implementation doesn't forward the sourceApplication or annotations. If you 65 | need these, then you may want @c application:openURL:options to call this method instead. 66 | */ 67 | - (BOOL)application:(UIApplication *)application 68 | openURL:(NSURL *)url 69 | sourceApplication:(NSString *)sourceApplication 70 | annotation:(id)annotation { 71 | return [self application:application 72 | openURL:url 73 | options:@{}]; 74 | } 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openid/AppAuth-iOS/145104f5ea9d58ae21b60add007c33c1cc0c948e/Examples/Example-iOS_ObjC/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_1024.png -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openid/AppAuth-iOS/145104f5ea9d58ae21b60add007c33c1cc0c948e/Examples/Example-iOS_ObjC/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_120.png -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openid/AppAuth-iOS/145104f5ea9d58ae21b60add007c33c1cc0c948e/Examples/Example-iOS_ObjC/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_152.png -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openid/AppAuth-iOS/145104f5ea9d58ae21b60add007c33c1cc0c948e/Examples/Example-iOS_ObjC/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_167.png -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openid/AppAuth-iOS/145104f5ea9d58ae21b60add007c33c1cc0c948e/Examples/Example-iOS_ObjC/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_180.png -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openid/AppAuth-iOS/145104f5ea9d58ae21b60add007c33c1cc0c948e/Examples/Example-iOS_ObjC/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_76.png -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC/Source/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "60x60", 35 | "idiom" : "iphone", 36 | "filename" : "AppAuth_Icon_120.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "AppAuth_Icon_180.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "idiom" : "ipad", 47 | "size" : "20x20", 48 | "scale" : "1x" 49 | }, 50 | { 51 | "idiom" : "ipad", 52 | "size" : "20x20", 53 | "scale" : "2x" 54 | }, 55 | { 56 | "idiom" : "ipad", 57 | "size" : "29x29", 58 | "scale" : "1x" 59 | }, 60 | { 61 | "idiom" : "ipad", 62 | "size" : "29x29", 63 | "scale" : "2x" 64 | }, 65 | { 66 | "idiom" : "ipad", 67 | "size" : "40x40", 68 | "scale" : "1x" 69 | }, 70 | { 71 | "idiom" : "ipad", 72 | "size" : "40x40", 73 | "scale" : "2x" 74 | }, 75 | { 76 | "size" : "76x76", 77 | "idiom" : "ipad", 78 | "filename" : "AppAuth_Icon_76.png", 79 | "scale" : "1x" 80 | }, 81 | { 82 | "size" : "76x76", 83 | "idiom" : "ipad", 84 | "filename" : "AppAuth_Icon_152.png", 85 | "scale" : "2x" 86 | }, 87 | { 88 | "size" : "83.5x83.5", 89 | "idiom" : "ipad", 90 | "filename" : "AppAuth_Icon_167.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "1024x1024", 95 | "idiom" : "ios-marketing", 96 | "filename" : "AppAuth_Icon_1024.png", 97 | "scale" : "1x" 98 | } 99 | ], 100 | "info" : { 101 | "version" : 1, 102 | "author" : "xcode" 103 | } 104 | } -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC/Source/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC/Source/Example-iOS_ObjC.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.application-groups 6 | 7 | group.net.openid.appauth.Example 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC/Source/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | AppAuth iOS 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleURLTypes 24 | 25 | 26 | CFBundleTypeRole 27 | Editor 28 | CFBundleURLSchemes 29 | 30 | com.example.app 31 | 32 | 33 | 34 | CFBundleVersion 35 | 1 36 | LSRequiresIPhoneOS 37 | 38 | UILaunchStoryboardName 39 | LaunchScreen 40 | UIRequiredDeviceCapabilities 41 | 42 | armv7 43 | 44 | UISupportedInterfaceOrientations 45 | 46 | UIInterfaceOrientationPortrait 47 | UIInterfaceOrientationLandscapeLeft 48 | UIInterfaceOrientationLandscapeRight 49 | 50 | UISupportedInterfaceOrientations~ipad 51 | 52 | UIInterfaceOrientationPortrait 53 | UIInterfaceOrientationPortraitUpsideDown 54 | UIInterfaceOrientationLandscapeLeft 55 | UIInterfaceOrientationLandscapeRight 56 | 57 | NSAppTransportSecurity 58 | 59 | NSExceptionDomains 60 | 61 | localhost 62 | 63 | NSExceptionAllowsInsecureHTTPLoads 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC/Source/main.m: -------------------------------------------------------------------------------- 1 | /*! @file main.m 2 | @brief AppAuth iOS SDK Example 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | #import "AppDelegate.h" 22 | 23 | /*! @brief Application main entry point. 24 | @return Exit code. 25 | */ 26 | int main(int argc, char *argv[]) { 27 | @autoreleasepool { 28 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC/Tests/AppAuthExampleTests.m: -------------------------------------------------------------------------------- 1 | /*! @file AppAuthExampleTests.m 2 | @brief AppAuth iOS SDK Example Tests 3 | @copyright 4 | Copyright 2017 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | @interface AppAuthExampleTests : XCTestCase 22 | 23 | @end 24 | 25 | @implementation AppAuthExampleTests 26 | 27 | - (void)setUp { 28 | [super setUp]; 29 | // Put setup code here. This method is called before the invocation of each test method in the class. 30 | } 31 | 32 | - (void)tearDown { 33 | // Put teardown code here. This method is called after the invocation of each test method in the class. 34 | [super tearDown]; 35 | } 36 | 37 | /*! @brief A smoke test, just to verify the target builds. 38 | */ 39 | - (void)testBuilt { 40 | XCTAssert(true); 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Examples/Example-iOS_ObjC/Tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Examples/Example-iOS_Swift-Carthage/.gitignore: -------------------------------------------------------------------------------- 1 | ## Build generated 2 | build/ 3 | DerivedData/ 4 | 5 | ## Various settings 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata/ 15 | 16 | ## Other 17 | *.moved-aside 18 | *.xccheckout 19 | *.xcscmblueprint 20 | 21 | ## Obj-C/Swift specific 22 | *.hmap 23 | *.ipa 24 | *.dSYM.zip 25 | *.dSYM 26 | 27 | # Pods are ignored in the samples as all Pods & their dependencies are either 28 | # development Pods (this repo) or sourced from repos in the same organization. 29 | # Generally we recommend committing Pod artifacts to version control, read about 30 | # the pros & cons here: 31 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 32 | Pods 33 | 34 | # Carthage 35 | # 36 | # Add these lines if you want to avoid checking in source code from Carthage 37 | # dependencies. Generally we recommend committing Carthage artifacts to version 38 | # control. 39 | Carthage/Checkouts 40 | Carthage/Build 41 | -------------------------------------------------------------------------------- /Examples/Example-iOS_Swift-Carthage/Cartfile: -------------------------------------------------------------------------------- 1 | github "openid/AppAuth-iOS" "master" 2 | 3 | -------------------------------------------------------------------------------- /Examples/Example-iOS_Swift-Carthage/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Examples/Example-iOS_Swift-Carthage/Example_Extension/Example_Extension.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.application-groups 6 | 7 | group.net.openid.appauth.Example 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Examples/Example-iOS_Swift-Carthage/Example_Extension/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Example_Extension 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | XPC! 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | NSExtension 24 | 25 | NSExtensionMainStoryboard 26 | MainInterface 27 | NSExtensionPointIdentifier 28 | com.apple.widget-extension 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Examples/Example-iOS_Swift-Carthage/README.md: -------------------------------------------------------------------------------- 1 | # Example Project 2 | 3 | ## Setup & Open the Project 4 | 5 | You'll need to have [Carthage](https://github.com/Carthage/Carthage) installed 6 | in order to pull the AppAuth dependency. 7 | 8 | So first run `carthage bootstrap` to build AppAuth framework then open the 9 | `Example.xcodeproj` file. 10 | 11 | ## Configuration 12 | 13 | The example doesn't work out of the box, you need to configure it with your own 14 | client ID. 15 | 16 | ### Information You'll Need 17 | 18 | * Issuer 19 | * Client ID 20 | * Redirect URI 21 | 22 | How to get this information varies by IdP, but we have 23 | [instructions](../README.md#openid-certified-providers) for some OpenID 24 | Certified providers. 25 | 26 | ### Configure the Example 27 | 28 | #### In the file `AppAuthExampleViewController.swift` 29 | 30 | 1. Update `kIssuer` with the IdP's issuer. 31 | 2. Update `kClientID` with your new client id. 32 | 3. Update `kRedirectURI` redirect URI 33 | 34 | #### In the file `Info.plist` 35 | 36 | Fully expand "URL types" (a.k.a. `CFBundleURLTypes`) and replace 37 | `com.example.app` with the *scheme* of your redirect URI. 38 | The scheme is everything before the colon (`:`). For example, if the redirect 39 | URI is `com.example.app:/oauth2redirect/example-provider`, then the scheme 40 | would be `com.example.app`. 41 | 42 | ### Running the Example 43 | 44 | Now your example should be ready to run. 45 | 46 | -------------------------------------------------------------------------------- /Examples/Example-iOS_Swift-Carthage/Source/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // 4 | // Copyright (c) 2017 The AppAuth Authors. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | 19 | import AppAuth 20 | import UIKit 21 | 22 | @UIApplicationMain 23 | class AppDelegate: UIResponder, UIApplicationDelegate { 24 | 25 | var window: UIWindow? 26 | var currentAuthorizationFlow: OIDExternalUserAgentSession? 27 | 28 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 29 | // Override point for customization after application launch. 30 | return true 31 | } 32 | 33 | func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool { 34 | 35 | if let authorizationFlow = self.currentAuthorizationFlow, authorizationFlow.resumeExternalUserAgentFlow(with: url) { 36 | self.currentAuthorizationFlow = nil 37 | return true 38 | } 39 | 40 | return false 41 | } 42 | 43 | } 44 | 45 | -------------------------------------------------------------------------------- /Examples/Example-iOS_Swift-Carthage/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openid/AppAuth-iOS/145104f5ea9d58ae21b60add007c33c1cc0c948e/Examples/Example-iOS_Swift-Carthage/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_1024.png -------------------------------------------------------------------------------- /Examples/Example-iOS_Swift-Carthage/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openid/AppAuth-iOS/145104f5ea9d58ae21b60add007c33c1cc0c948e/Examples/Example-iOS_Swift-Carthage/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_120.png -------------------------------------------------------------------------------- /Examples/Example-iOS_Swift-Carthage/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openid/AppAuth-iOS/145104f5ea9d58ae21b60add007c33c1cc0c948e/Examples/Example-iOS_Swift-Carthage/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_152.png -------------------------------------------------------------------------------- /Examples/Example-iOS_Swift-Carthage/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openid/AppAuth-iOS/145104f5ea9d58ae21b60add007c33c1cc0c948e/Examples/Example-iOS_Swift-Carthage/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_167.png -------------------------------------------------------------------------------- /Examples/Example-iOS_Swift-Carthage/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openid/AppAuth-iOS/145104f5ea9d58ae21b60add007c33c1cc0c948e/Examples/Example-iOS_Swift-Carthage/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_180.png -------------------------------------------------------------------------------- /Examples/Example-iOS_Swift-Carthage/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openid/AppAuth-iOS/145104f5ea9d58ae21b60add007c33c1cc0c948e/Examples/Example-iOS_Swift-Carthage/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_Icon_76.png -------------------------------------------------------------------------------- /Examples/Example-iOS_Swift-Carthage/Source/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "60x60", 35 | "idiom" : "iphone", 36 | "filename" : "AppAuth_Icon_120.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "AppAuth_Icon_180.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "idiom" : "ipad", 47 | "size" : "20x20", 48 | "scale" : "1x" 49 | }, 50 | { 51 | "idiom" : "ipad", 52 | "size" : "20x20", 53 | "scale" : "2x" 54 | }, 55 | { 56 | "idiom" : "ipad", 57 | "size" : "29x29", 58 | "scale" : "1x" 59 | }, 60 | { 61 | "idiom" : "ipad", 62 | "size" : "29x29", 63 | "scale" : "2x" 64 | }, 65 | { 66 | "idiom" : "ipad", 67 | "size" : "40x40", 68 | "scale" : "1x" 69 | }, 70 | { 71 | "idiom" : "ipad", 72 | "size" : "40x40", 73 | "scale" : "2x" 74 | }, 75 | { 76 | "size" : "76x76", 77 | "idiom" : "ipad", 78 | "filename" : "AppAuth_Icon_76.png", 79 | "scale" : "1x" 80 | }, 81 | { 82 | "size" : "76x76", 83 | "idiom" : "ipad", 84 | "filename" : "AppAuth_Icon_152.png", 85 | "scale" : "2x" 86 | }, 87 | { 88 | "size" : "83.5x83.5", 89 | "idiom" : "ipad", 90 | "filename" : "AppAuth_Icon_167.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "1024x1024", 95 | "idiom" : "ios-marketing", 96 | "filename" : "AppAuth_Icon_1024.png", 97 | "scale" : "1x" 98 | } 99 | ], 100 | "info" : { 101 | "version" : 1, 102 | "author" : "xcode" 103 | } 104 | } -------------------------------------------------------------------------------- /Examples/Example-iOS_Swift-Carthage/Source/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Examples/Example-iOS_Swift-Carthage/Source/Example.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.application-groups 6 | 7 | group.net.openid.appauth.Example 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Examples/Example-iOS_Swift-Carthage/Source/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleURLTypes 20 | 21 | 22 | CFBundleTypeRole 23 | Editor 24 | CFBundleURLSchemes 25 | 26 | com.example.app 27 | 28 | 29 | 30 | CFBundleVersion 31 | 1 32 | LSRequiresIPhoneOS 33 | 34 | UILaunchStoryboardName 35 | LaunchScreen 36 | UIMainStoryboardFile 37 | Main 38 | UIRequiredDeviceCapabilities 39 | 40 | armv7 41 | 42 | UISupportedInterfaceOrientations 43 | 44 | UIInterfaceOrientationPortrait 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | UISupportedInterfaceOrientations~ipad 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationPortraitUpsideDown 52 | UIInterfaceOrientationLandscapeLeft 53 | UIInterfaceOrientationLandscapeRight 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /Examples/Example-macOS/.gitignore: -------------------------------------------------------------------------------- 1 | ## Build generated 2 | build/ 3 | DerivedData/ 4 | 5 | ## Various settings 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata/ 15 | 16 | ## Other 17 | *.moved-aside 18 | *.xcuserstate 19 | 20 | # Pods are ignored in the samples as all Pods & their dependencies are either 21 | # development Pods (this repo) or sourced from repos in the same organization. 22 | # Generally we recommend versioning Pods, see the pros & cons here: 23 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 24 | Pods 25 | -------------------------------------------------------------------------------- /Examples/Example-macOS/Example-macOS.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Examples/Example-macOS/Podfile: -------------------------------------------------------------------------------- 1 | target 'Example-macOS' do 2 | platform :osx, '10.12' 3 | 4 | # AppAuth Pod 5 | # In production, just use `pod 'AppAuth'` without the path reference. 6 | pod 'AppAuth', :path => '../../' 7 | end 8 | -------------------------------------------------------------------------------- /Examples/Example-macOS/README.md: -------------------------------------------------------------------------------- 1 | # Example Project 2 | 3 | ## Setup & Open the Project 4 | 5 | 1. In the `Example-macOS` folder, run the following command to install the 6 | AppAuth pod. 7 | 8 | ``` 9 | pod install 10 | ``` 11 | 12 | 2. Open the `Example-macOS.xcworkspace` workspace 13 | 14 | ``` 15 | open Example-macOS.xcworkspace 16 | ``` 17 | 18 | This workspace is configured to include AppAuth via CocoaPods. You can also 19 | directly include AppAuth as a static library using the build targets in the 20 | `AppAuth.xcodeproj` project. 21 | 22 | ## Configuration 23 | 24 | The example doesn't work out of the box, you need to configure it with your own 25 | client ID. 26 | 27 | ### Information You'll Need 28 | 29 | * Issuer 30 | * Client ID 31 | * Client Secret 32 | * Redirect URI (optional: if not using loopback). 33 | 34 | How to get this information varies by IdP, but we have 35 | [instructions](../README.md#openid-certified-providers) for some OpenID 36 | Certified providers. 37 | 38 | ### Configure the Example 39 | 40 | #### In the file `AppAuthExampleViewController.m` 41 | 42 | 1. Update `kIssuer` with the IdP's issuer. 43 | 2. Update `kClientID` with your new client id. 44 | 3. Update `kClientSecret` with your client id's secret. 45 | 4. Update `kRedirectURI` redirect URI (optional: if not using loopback) 46 | 47 | #### In the file `Info.plist` 48 | 49 | Fully expand "URL types" (a.k.a. `CFBundleURLTypes`) and replace 50 | `com.example.app` with the *scheme* of your redirect URI. 51 | The scheme is everything before the colon (`:`). For example, if the redirect 52 | URI is `com.example.app:/oauth2redirect/example-provider`, then the scheme 53 | would be `com.example.app`. 54 | 55 | ### Running the Example 56 | 57 | Now your example should be ready to run. 58 | -------------------------------------------------------------------------------- /Examples/Example-macOS/Source/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /*! @file AppDelegate.h 2 | @brief AppAuth macOS SDK Example 3 | @copyright 4 | Copyright 2016 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | @protocol OIDExternalUserAgentSession; 24 | 25 | /*! @class AppDelegate 26 | @brief The example application's delegate. 27 | */ 28 | @interface AppDelegate : NSObject 29 | 30 | /*! @property currentAuthorizationFlow 31 | @brief The authorization flow session which receives the return URL from the browser. 32 | @discussion We need to store this in the app delegate as it's that delegate which receives the 33 | incoming URL. This property will be nil, except when an authorization flow is in progress. 34 | */ 35 | @property(nonatomic, strong, nullable) id currentAuthorizationFlow; 36 | 37 | @end 38 | 39 | NS_ASSUME_NONNULL_END 40 | -------------------------------------------------------------------------------- /Examples/Example-macOS/Source/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /*! @file AppDelegate.m 2 | @brief AppAuth macOS SDK Example 3 | @copyright 4 | Copyright 2016 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import "AppDelegate.h" 20 | 21 | #import 22 | 23 | #import "AppAuthExampleViewController.h" 24 | 25 | NS_ASSUME_NONNULL_BEGIN 26 | 27 | @interface AppDelegate () 28 | @property(nullable) IBOutlet NSWindow *window; 29 | @end 30 | 31 | @implementation AppDelegate 32 | 33 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { 34 | _window.title = @"AppAuth Example for macOS"; 35 | AppAuthExampleViewController *contentViewController = 36 | [[AppAuthExampleViewController alloc] initWithNibName:nil bundle:nil]; 37 | contentViewController.appDelegate = self; 38 | _window.contentViewController = contentViewController; 39 | 40 | // Register for GetURL events. 41 | NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager]; 42 | [appleEventManager setEventHandler:self 43 | andSelector:@selector(handleGetURLEvent:withReplyEvent:) 44 | forEventClass:kInternetEventClass 45 | andEventID:kAEGetURL]; 46 | } 47 | 48 | - (void)handleGetURLEvent:(NSAppleEventDescriptor *)event 49 | withReplyEvent:(NSAppleEventDescriptor *)replyEvent { 50 | NSString *URLString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; 51 | NSURL *URL = [NSURL URLWithString:URLString]; 52 | [_currentAuthorizationFlow resumeExternalUserAgentFlowWithURL:URL]; 53 | } 54 | 55 | @end 56 | 57 | NS_ASSUME_NONNULL_END 58 | -------------------------------------------------------------------------------- /Examples/Example-macOS/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_macOS_Icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openid/AppAuth-iOS/145104f5ea9d58ae21b60add007c33c1cc0c948e/Examples/Example-macOS/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_macOS_Icon_1024.png -------------------------------------------------------------------------------- /Examples/Example-macOS/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_macOS_Icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openid/AppAuth-iOS/145104f5ea9d58ae21b60add007c33c1cc0c948e/Examples/Example-macOS/Source/Assets.xcassets/AppIcon.appiconset/AppAuth_macOS_Icon_512.png -------------------------------------------------------------------------------- /Examples/Example-macOS/Source/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "size" : "512x512", 45 | "idiom" : "mac", 46 | "filename" : "AppAuth_macOS_Icon_512.png", 47 | "scale" : "1x" 48 | }, 49 | { 50 | "size" : "512x512", 51 | "idiom" : "mac", 52 | "filename" : "AppAuth_macOS_Icon_1024.png", 53 | "scale" : "2x" 54 | } 55 | ], 56 | "info" : { 57 | "version" : 1, 58 | "author" : "xcode" 59 | } 60 | } -------------------------------------------------------------------------------- /Examples/Example-macOS/Source/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | $(MACOSX_DEPLOYMENT_TARGET) 27 | NSHumanReadableCopyright 28 | Copyright © 2016 Google. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | CFBundleURLTypes 34 | 35 | 36 | CFBundleTypeRole 37 | Editor 38 | CFBundleURLSchemes 39 | 40 | com.example.app 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Examples/Example-macOS/Source/main.m: -------------------------------------------------------------------------------- 1 | /*! @file main.m 2 | @brief Application main entry point. 3 | @copyright 4 | Copyright 2016 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | int main(int argc, const char * argv[]) { 22 | return NSApplicationMain(argc, argv); 23 | } 24 | -------------------------------------------------------------------------------- /Examples/Example-macOS/Tests/AppAuthExampleTests.m: -------------------------------------------------------------------------------- 1 | /*! @file AppAuthExampleTests.m 2 | @brief AppAuth macOS SDK Example Tests 3 | @copyright 4 | Copyright 2017 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | @interface AppAuthExampleTests : XCTestCase 22 | 23 | @end 24 | 25 | @implementation AppAuthExampleTests 26 | 27 | - (void)setUp { 28 | [super setUp]; 29 | // Put setup code here. This method is called before the invocation of each test method in the class. 30 | } 31 | 32 | - (void)tearDown { 33 | // Put teardown code here. This method is called after the invocation of each test method in the class. 34 | [super tearDown]; 35 | } 36 | 37 | /*! @brief A smoke test, just to verify the target builds. 38 | */ 39 | - (void)testBuilt { 40 | XCTAssert(true); 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Examples/Example-macOS/Tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS/AppAuthTVExampleViewController.h: -------------------------------------------------------------------------------- 1 | /*! @file AppAuthTVExampleViewController.h 2 | @brief AppAuth tvOS SDK Example 3 | @copyright 4 | Copyright 2016 Google Inc. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | @class OIDAuthState; 22 | 23 | NS_ASSUME_NONNULL_BEGIN 24 | 25 | /*! @brief The example application's view controller. 26 | */ 27 | @interface AppAuthTVExampleViewController : UIViewController 28 | 29 | @property(nullable) IBOutlet UIView *signInView; 30 | @property(nullable) IBOutlet UILabel *verificationURLLabel; 31 | @property(nullable) IBOutlet UILabel *userCodeLabel; 32 | @property(nullable) IBOutlet UIView *signInButtons; 33 | @property(nullable) IBOutlet UIButton *cancelSignInButton; 34 | @property(nullable) IBOutlet UIView *signedInButtons; 35 | @property(nullable) IBOutlet UITextView *logTextView; 36 | 37 | /*! @brief The authorization state. 38 | */ 39 | @property(nonatomic, nullable) OIDAuthState *authState; 40 | 41 | /*! @brief Initiates the sign-in. 42 | @param sender IBAction sender. 43 | */ 44 | - (IBAction)signin:(nullable id)sender; 45 | 46 | /*! @brief Cancels the active sign-in (if any), has no effect if a sign-in isn't in progress. 47 | @param sender IBAction sender. 48 | */ 49 | - (IBAction)cancelSignIn:(nullable id)sender; 50 | 51 | /*! @brief Forgets the authentication state, used to sign-out the user. 52 | @param sender IBAction sender. 53 | */ 54 | - (IBAction)clearAuthState:(nullable id)sender; 55 | 56 | /*! @brief Performs an authenticated API call. 57 | @param sender IBAction sender. 58 | */ 59 | - (IBAction)userinfo:(nullable id)sender; 60 | 61 | @end 62 | 63 | NS_ASSUME_NONNULL_END 64 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /*! @file AppDelegate.h 2 | @brief AppAuth tvOS SDK Example 3 | @copyright 4 | Copyright 2016 Google Inc. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | 19 | /*! @brief The example application's delegate. 20 | */ 21 | @interface AppDelegate : UIResponder 22 | 23 | /*! @brief The example application's @c UIWindow. 24 | */ 25 | @property (strong, nonatomic) UIWindow *window; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /*! @file AppDelegate.m 2 | @brief AppAuth tvOS SDK Example 3 | @copyright 4 | Copyright 2016 Google Inc. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import "AppDelegate.h" 18 | 19 | @implementation AppDelegate 20 | @end 21 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | }, 6 | "layers" : [ 7 | { 8 | "filename" : "Front.imagestacklayer" 9 | }, 10 | { 11 | "filename" : "Middle.imagestacklayer" 12 | }, 13 | { 14 | "filename" : "Back.imagestacklayer" 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "tv", 9 | "scale" : "2x" 10 | } 11 | ], 12 | "info" : { 13 | "author" : "xcode", 14 | "version" : 1 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | }, 6 | "layers" : [ 7 | { 8 | "filename" : "Front.imagestacklayer" 9 | }, 10 | { 11 | "filename" : "Middle.imagestacklayer" 12 | }, 13 | { 14 | "filename" : "Back.imagestacklayer" 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "tv", 9 | "scale" : "2x" 10 | } 11 | ], 12 | "info" : { 13 | "author" : "xcode", 14 | "version" : 1 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "tv", 9 | "scale" : "2x" 10 | } 11 | ], 12 | "info" : { 13 | "author" : "xcode", 14 | "version" : 1 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "assets" : [ 3 | { 4 | "filename" : "App Icon - App Store.imagestack", 5 | "idiom" : "tv", 6 | "role" : "primary-app-icon", 7 | "size" : "1280x768" 8 | }, 9 | { 10 | "filename" : "App Icon.imagestack", 11 | "idiom" : "tv", 12 | "role" : "primary-app-icon", 13 | "size" : "400x240" 14 | }, 15 | { 16 | "filename" : "Top Shelf Image Wide.imageset", 17 | "idiom" : "tv", 18 | "role" : "top-shelf-image-wide", 19 | "size" : "2320x720" 20 | }, 21 | { 22 | "filename" : "Top Shelf Image.imageset", 23 | "idiom" : "tv", 24 | "role" : "top-shelf-image", 25 | "size" : "1920x720" 26 | } 27 | ], 28 | "info" : { 29 | "author" : "xcode", 30 | "version" : 1 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "tv", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "tv-marketing", 13 | "scale" : "1x" 14 | }, 15 | { 16 | "idiom" : "tv-marketing", 17 | "scale" : "2x" 18 | } 19 | ], 20 | "info" : { 21 | "author" : "xcode", 22 | "version" : 1 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "tv", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "tv-marketing", 13 | "scale" : "1x" 14 | }, 15 | { 16 | "idiom" : "tv-marketing", 17 | "scale" : "2x" 18 | } 19 | ], 20 | "info" : { 21 | "author" : "xcode", 22 | "version" : 1 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | UILaunchStoryboardName 22 | LaunchScreen 23 | UIMainStoryboardFile 24 | Main 25 | UIRequiredDeviceCapabilities 26 | 27 | arm64 28 | 29 | UIUserInterfaceStyle 30 | Automatic 31 | 32 | 33 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Example-tvOS/main.m: -------------------------------------------------------------------------------- 1 | /*! @file main.m 2 | @brief AppAuth tvOS SDK Example 3 | @copyright 4 | Copyright 2016 Google Inc. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #import 18 | #import "AppDelegate.h" 19 | 20 | int main(int argc, char * argv[]) { 21 | @autoreleasepool { 22 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/Podfile: -------------------------------------------------------------------------------- 1 | platform :tvos, '9.0' 2 | 3 | use_frameworks! 4 | 5 | target 'Example-tvOS' do 6 | # AppAuth Pod, TV subspec 7 | # In production, just use `pod 'AppAuth/TV'` without the path reference. 8 | pod 'AppAuth/TV', :path => '../../' 9 | end 10 | -------------------------------------------------------------------------------- /Examples/Example-tvOS/README.md: -------------------------------------------------------------------------------- 1 | # Example Project 2 | 3 | ## Setup & Open the Project 4 | 5 | 1. In the `Example-tvOS` folder, run the following command to install the AppAuth pod with the TV 6 | subspec. 7 | 8 | ``` 9 | pod install 10 | ``` 11 | 12 | 2. Open the `Example-tvOS.xcworkspace` workspace. 13 | 14 | ``` 15 | open Example-tvOS.xcworkspace 16 | ``` 17 | 18 | This workspace is configured to include AppAuth via CocoaPods. You can also include AppAuthTV using 19 | Carthage or Swift Package Manager, please see the main [README](../../README.md) for instructions. 20 | 21 | ## Configuration 22 | 23 | The example doesn't work out of the box; you need to configure it with your own client and IdP details. 24 | 25 | ### Information You'll Need 26 | 27 | * Client ID 28 | * Client Secret (optional) 29 | 30 | If you are choosing to automatically discover endpoints: 31 | 32 | * Issuer URL 33 | 34 | If you are choosing to manually specify endpoints: 35 | 36 | * Device Authorization Endpoint 37 | * Token Endpoint 38 | * User Info Endpoint 39 | 40 | How to get this information varies by IdP, but we have 41 | [instructions](../README.md#openid-certified-providers) for some OpenID Certified providers. 42 | 43 | ### Configure the Example 44 | 45 | #### In the file `AppAuthTVExampleViewController.m` 46 | 47 | 1. Update `kClientID` with your new client ID. 48 | 2. Update `kClientSecret` with your client ID's secret, or set to `""` if not using. 49 | 50 | If you are choosing to automatically discover endpoints, also: 51 | 52 | 1. Update `kIssuer` with the issuer URL. 53 | 2. Set `shouldDiscoverEndpoints` to `YES` 54 | 55 | If you are choosing to manually specify endpoints, also: 56 | 57 | 1. Set `shouldDiscoverEndpoints` to `NO` 58 | 2. Update `kDeviceAuthorizationEndpoint` with the device authorization endpoint. 59 | 3. Update `kTokenEndpoint` with the token endpoint. 60 | 4. Update `kUserInfoEndpoint` with the token endpoint. 61 | 62 | ### Running the Example 63 | 64 | Now your example should be ready to run. 65 | -------------------------------------------------------------------------------- /Examples/README-Google.md: -------------------------------------------------------------------------------- 1 | # Using AppAuth for iOS and macOS with Google 2 | 3 | To configure the sample with a Google OAuth client, first visit 4 | https://console.developers.google.com/apis/credentials?project=_ and create a 5 | new project. Then tap "Create credentials" and select "OAuth client ID". 6 | 7 | Follow the instructions to configure the consent screen (just the Product Name 8 | is needed). 9 | 10 | Then follow the instructions for your platform: 11 | 12 | ## iOS 13 | 14 | Select "iOS" as the application type, and enter your Bundle ID. 15 | 16 | Then, setup the example with your configuration: 17 | 18 | | Configuration | Description | 19 | |---------------|------------------| 20 | | Issuer | `https://accounts.google.com`| 21 | | Client ID | The value named `Client ID` in the console, has the format `IDENTIFIER.apps.googleusercontent.com`.| 22 | | Client Secret | Google's iOS clients do not have a secret.| 23 | | 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.| 24 | 25 | ## macOS 26 | 27 | Select "Other" as the application type. 28 | 29 | Then, setup the example with your configuration: 30 | 31 | | Configuration | Description | 32 | |---------------|------------------| 33 | | Issuer | `https://accounts.google.com`| 34 | | Client ID | The value named `Client ID` in the console, has the format `IDENTIFIER.apps.googleusercontent.com`.| 35 | | Client Secret | The value named `Client secret` in the console.| 36 | | 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.| 37 | 38 | ## tvOS 39 | 40 | Select "TVs and Limited Input devices" as the application type. 41 | 42 | Then, setup the example with your configuration. 43 | 44 | | Configuration | Description | 45 | |---------------------------|------------------| 46 | | Issuer | `https://accounts.google.com` | 47 | | Client ID | The value named `Client ID` in the console, has the format `IDENTIFIER.apps.googleusercontent.com`.| 48 | | Client Secret | The value named `Client secret` in the console.| 49 | -------------------------------------------------------------------------------- /Examples/README-IdentityServer.md: -------------------------------------------------------------------------------- 1 | # Using AppAuth with [IdentityServer4](https://github.com/IdentityServer/IdentityServer4) 2 | 3 | Since IdentityServer4 is a certified OpenID Connect implementation and supports PKCE, there are no special steps needed to use it with AppAuth. 4 | 5 | Sample IdentityServer client definition that works OOB with the AppAuth sample: 6 | 7 | ```csharp 8 | var client = new Client 9 | { 10 | ClientId = "native.code", 11 | ClientName = "Native Client (Code with PKCE)", 12 | RequireClientSecret = false, 13 | 14 | RedirectUris = { "io.identityserver.demo:/oauthredirect" }, 15 | 16 | AllowedGrantTypes = GrantTypes.Code, 17 | RequirePkce = true, 18 | AllowedScopes = { "openid", "profile" }, 19 | AllowOfflineAccess = true 20 | }; 21 | ``` 22 | 23 | ## Connecting the AppAuth sample to the IdentityServer4 demo instance 24 | 25 | You can find a demo instance of IdentityServer4 at [https://demo.identityserver.io](https://demo.identityserver.io). 26 | On the main page you can find a number of registered clients and their configuration (all clients can use arbitrary redirect URIs). 27 | 28 | The following changes are required for the AppAuth sample: 29 | 30 | ``` 31 | // set the issuer 32 | static NSString *const kIssuer = @"https://demo.identityserver.io"; 33 | 34 | // client ID for code flow + PKCE 35 | static NSString *const kClientID = 36 | @"native.code"; 37 | 38 | // some redirect URI (must match the plist setting) 39 | static NSString *const kRedirectURI = 40 | @"io.identityserver.demo:/oauthredirect"; 41 | ``` 42 | 43 | ## Getting support for IdentityServer 44 | The IdentityServer project has an [issue tracker](https://github.com/IdentityServer/IdentityServer4/issues) and [documentation](https://identityserver4.readthedocs.io/en/release/). Feel free to open an issue when you think you found a bug or unexpected behavior. 45 | There's also a pretty active community on [StackOverflow](https://stackoverflow.com/questions/tagged/identityserver4) that can help out with more general questions. 46 | -------------------------------------------------------------------------------- /Examples/README-Okta.md: -------------------------------------------------------------------------------- 1 | # Using AppAuth with [Okta](https://developer.okta.com/docs/api/resources/oidc.html) 2 | 3 | Since Okta is a certified OpenID Connect provider and supports PKCE by default, configuration is quick and simple. There are no additional libraries or tools required. 4 | 5 | ## Add an OpenID Connect Client 6 | 7 | You can create an Okta developer account at [https://developer.okta.com/](https://developer.okta.com/). 8 | 9 | 1. After login, navigate to https://{{yourOrg}}-admin.oktapreview.com/admin/apps/add-app and select **Create New App** 10 | 1. Choose **Native** as the platform, Sign on method as **OpenID Connect** then select **Create**. 11 | 1. Populate your new OpenID Connect application with values similar to: 12 | 13 | | Setting | Value | 14 | | ------------------- | --------------------------------------------------- | 15 | | Application Name | OpenId Connect App *(must be unique)* | 16 | | Redirect URIs | com.oktapreview.yoursubdomain://callback_url| 17 | | Allowed grant types | Authorization Code | 18 | 19 | 4. Click **Finish** to redirect back to the *General Settings* of your application. 20 | 5. Copy the **Client ID**, as it will be needed for the client configuration. 21 | 22 | **Note:** *As with any Okta application, make sure you assign Users or Groups to the OpenID Connect Client. Otherwise, no one can use it.* 23 | 24 | The following changes are required for the AppAuth sample: 25 | 26 | ``` 27 | // set the issuer 28 | // This will be your specific subdomain.okta.com or subdomain.oktapreview.com 29 | static NSString *const kIssuer = @"https://subdomain.okta.com”; 30 | 31 | // client ID for code flow + PKCE 32 | // This is available from your OpenID Connect Client page 33 | static NSString *const kClientID = @“YourClientID”; 34 | 35 | static NSString *const kRedirectURI = @"com.oktapreview.yoursubdomain:/oauth"; 36 | -------------------------------------------------------------------------------- /Examples/README.md: -------------------------------------------------------------------------------- 1 | # AppAuth for iOS and macOS Examples 2 | 3 | The examples need to be configured with an OpenID Connect issuer (or 4 | Authorization and Token endpoints manually), and the OAuth client information 5 | like the Client ID and Redirect URI. 6 | 7 | ## Examples 8 | 9 | Each example has docs on how to configure: 10 | 11 | * [Example for iOS (Objective-C)](Example-iOS_ObjC/README.md) 12 | * [Example for iOS w/ Carthage (Objective-C)](Example-iOS_ObjC-Carthage/README.md) 13 | * [Example for macOS](Example-macOS/README.md) 14 | * [Example for tvOS](Example-tvOS/README.md) 15 | 16 | To get the Issuer, Client ID, and Redirect URI, for your particular IdP, you 17 | may view the IdP-specific information in the next section. 18 | 19 | ## OpenID Certified Providers 20 | 21 | All [Certified OpenID providers](http://openid.net/certification/) that support 22 | [RFC 8252](https://tools.ietf.org/html/rfc8252#appendix-A) 23 | are welcome to submit a README with IdP information. 24 | 25 | Those with instructions on file: 26 | 27 | * [Google](README-Google.md) 28 | * [IdentityServer](README-IdentityServer.md) 29 | * [Okta](README-Okta.md) 30 | * [PingFederate](README-PingFederate.md) 31 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'cocoapods', '1.11.3' 4 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | CFPropertyList (3.0.5) 5 | rexml 6 | activesupport (6.1.5) 7 | concurrent-ruby (~> 1.0, >= 1.0.2) 8 | i18n (>= 1.6, < 2) 9 | minitest (>= 5.1) 10 | tzinfo (~> 2.0) 11 | zeitwerk (~> 2.3) 12 | addressable (2.8.0) 13 | public_suffix (>= 2.0.2, < 5.0) 14 | algoliasearch (1.27.5) 15 | httpclient (~> 2.8, >= 2.8.3) 16 | json (>= 1.5.1) 17 | atomos (0.1.3) 18 | claide (1.1.0) 19 | cocoapods (1.11.3) 20 | addressable (~> 2.8) 21 | claide (>= 1.0.2, < 2.0) 22 | cocoapods-core (= 1.11.3) 23 | cocoapods-deintegrate (>= 1.0.3, < 2.0) 24 | cocoapods-downloader (>= 1.4.0, < 2.0) 25 | cocoapods-plugins (>= 1.0.0, < 2.0) 26 | cocoapods-search (>= 1.0.0, < 2.0) 27 | cocoapods-trunk (>= 1.4.0, < 2.0) 28 | cocoapods-try (>= 1.1.0, < 2.0) 29 | colored2 (~> 3.1) 30 | escape (~> 0.0.4) 31 | fourflusher (>= 2.3.0, < 3.0) 32 | gh_inspector (~> 1.0) 33 | molinillo (~> 0.8.0) 34 | nap (~> 1.0) 35 | ruby-macho (>= 1.0, < 3.0) 36 | xcodeproj (>= 1.21.0, < 2.0) 37 | cocoapods-core (1.11.3) 38 | activesupport (>= 5.0, < 7) 39 | addressable (~> 2.8) 40 | algoliasearch (~> 1.0) 41 | concurrent-ruby (~> 1.1) 42 | fuzzy_match (~> 2.0.4) 43 | nap (~> 1.0) 44 | netrc (~> 0.11) 45 | public_suffix (~> 4.0) 46 | typhoeus (~> 1.0) 47 | cocoapods-deintegrate (1.0.5) 48 | cocoapods-downloader (1.6.3) 49 | cocoapods-plugins (1.0.0) 50 | nap 51 | cocoapods-search (1.0.1) 52 | cocoapods-trunk (1.6.0) 53 | nap (>= 0.8, < 2.0) 54 | netrc (~> 0.11) 55 | cocoapods-try (1.2.0) 56 | colored2 (3.1.2) 57 | concurrent-ruby (1.1.9) 58 | escape (0.0.4) 59 | ethon (0.15.0) 60 | ffi (>= 1.15.0) 61 | ffi (1.15.5) 62 | fourflusher (2.3.1) 63 | fuzzy_match (2.0.4) 64 | gh_inspector (1.1.3) 65 | httpclient (2.8.3) 66 | i18n (1.10.0) 67 | concurrent-ruby (~> 1.0) 68 | json (2.6.1) 69 | minitest (5.15.0) 70 | molinillo (0.8.0) 71 | nanaimo (0.3.0) 72 | nap (1.1.0) 73 | netrc (0.11.0) 74 | public_suffix (4.0.6) 75 | rexml (3.2.5) 76 | ruby-macho (2.5.1) 77 | typhoeus (1.4.0) 78 | ethon (>= 0.9.0) 79 | tzinfo (2.0.4) 80 | concurrent-ruby (~> 1.0) 81 | xcodeproj (1.21.0) 82 | CFPropertyList (>= 2.3.3, < 4.0) 83 | atomos (~> 0.1.3) 84 | claide (>= 1.0.2, < 2.0) 85 | colored2 (~> 3.1) 86 | nanaimo (~> 0.3.0) 87 | rexml (~> 3.2.4) 88 | zeitwerk (2.5.4) 89 | 90 | PLATFORMS 91 | ruby 92 | 93 | DEPENDENCIES 94 | cocoapods (= 1.11.3) 95 | 96 | BUNDLED WITH 97 | 1.17.2 98 | -------------------------------------------------------------------------------- /Sources/AppAuth/Resources/PrivacyInfo.xcprivacy: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSPrivacyAccessedAPITypes 6 | 7 | 8 | NSPrivacyCollectedDataTypes 9 | 10 | 11 | NSPrivacyTrackingDomains 12 | 13 | NSPrivacyTracking 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Sources/AppAuth/iOS/OIDExternalUserAgentCatalyst.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDExternalUserAgentCatalyst.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2019 The AppAuth Authors. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | #if TARGET_OS_IOS || TARGET_OS_MACCATALYST 22 | 23 | #import 24 | 25 | #import "OIDExternalUserAgent.h" 26 | 27 | NS_ASSUME_NONNULL_BEGIN 28 | 29 | /*! @brief A Catalyst specific external user-agent that uses `ASWebAuthenticationSession` to 30 | present the request. 31 | */ 32 | API_AVAILABLE(macCatalyst(13)) API_UNAVAILABLE(ios) 33 | @interface OIDExternalUserAgentCatalyst : NSObject 34 | 35 | /*! @internal 36 | @brief Unavailable. Please use @c initWithPresentingViewController: 37 | */ 38 | - (nonnull instancetype)init NS_UNAVAILABLE; 39 | 40 | /*! @brief The designated initializer. 41 | @param presentingViewController The view controller from which to present the 42 | \SFSafariViewController. 43 | */ 44 | - (nullable instancetype)initWithPresentingViewController: 45 | (UIViewController *)presentingViewController 46 | NS_DESIGNATED_INITIALIZER; 47 | 48 | /*! @brief Create an external user-agent which optionally uses a private authentication session. 49 | @param presentingViewController The view controller from which to present the browser. 50 | @param prefersEphemeralSession Whether the caller prefers to use a private authentication 51 | session. See @c ASWebAuthenticationSession.prefersEphemeralWebBrowserSession for more. 52 | */ 53 | - (nullable instancetype)initWithPresentingViewController: 54 | (UIViewController *)presentingViewController 55 | prefersEphemeralSession:(BOOL)prefersEphemeralSession; 56 | 57 | @end 58 | 59 | NS_ASSUME_NONNULL_END 60 | 61 | #endif // TARGET_OS_IOS || TARGET_OS_MACCATALYST 62 | -------------------------------------------------------------------------------- /Sources/AppAuth/macOS/OIDExternalUserAgentMac.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDExternalUserAgentMac.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2016 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | #if TARGET_OS_OSX 22 | 23 | #import 24 | #import "OIDExternalUserAgent.h" 25 | 26 | NS_ASSUME_NONNULL_BEGIN 27 | 28 | /*! @brief A Mac-specific external user-agent UI Coordinator that uses the default browser to 29 | present an external user-agent request. 30 | */ 31 | @interface OIDExternalUserAgentMac : NSObject 32 | 33 | /*! @brief The designated initializer. 34 | @param presentingWindow The window from which to present the @c ASWebAuthenticationSession on 35 | macOS 10.15 and above. Older macOS versions use the system browser. 36 | */ 37 | - (instancetype)initWithPresentingWindow:(NSWindow *)presentingWindow NS_DESIGNATED_INITIALIZER; 38 | 39 | /*! @brief Create an external user-agent which optionally uses a private authentication session. 40 | @param presentingWindow The window from which to present the @c ASWebAuthenticationSession. 41 | @param prefersEphemeralSession Whether the caller prefers to use a private authentication 42 | session. See @c ASWebAuthenticationSession.prefersEphemeralWebBrowserSession for more. 43 | */ 44 | - (nullable instancetype)initWithPresentingWindow:(NSWindow *)presentingWindow 45 | prefersEphemeralSession:(BOOL)prefersEphemeralSession 46 | API_AVAILABLE(macos(10.15)); 47 | 48 | - (instancetype)init __deprecated_msg("Use initWithPresentingWindow for macOS 10.15 and above."); 49 | 50 | @end 51 | 52 | NS_ASSUME_NONNULL_END 53 | 54 | #endif // TARGET_OS_OSX 55 | -------------------------------------------------------------------------------- /Sources/AppAuthCore.h: -------------------------------------------------------------------------------- 1 | /*! @file AppAuthCore.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import "OIDAuthState.h" 20 | #import "OIDAuthStateChangeDelegate.h" 21 | #import "OIDAuthStateErrorDelegate.h" 22 | #import "OIDAuthorizationRequest.h" 23 | #import "OIDAuthorizationResponse.h" 24 | #import "OIDAuthorizationService.h" 25 | #import "OIDError.h" 26 | #import "OIDErrorUtilities.h" 27 | #import "OIDExternalUserAgent.h" 28 | #import "OIDExternalUserAgentRequest.h" 29 | #import "OIDExternalUserAgentSession.h" 30 | #import "OIDGrantTypes.h" 31 | #import "OIDIDToken.h" 32 | #import "OIDRegistrationRequest.h" 33 | #import "OIDRegistrationResponse.h" 34 | #import "OIDResponseTypes.h" 35 | #import "OIDScopes.h" 36 | #import "OIDScopeUtilities.h" 37 | #import "OIDServiceConfiguration.h" 38 | #import "OIDServiceDiscovery.h" 39 | #import "OIDTokenRequest.h" 40 | #import "OIDTokenResponse.h" 41 | #import "OIDTokenUtilities.h" 42 | #import "OIDURLSessionProvider.h" 43 | #import "OIDEndSessionRequest.h" 44 | #import "OIDEndSessionResponse.h" 45 | -------------------------------------------------------------------------------- /Sources/AppAuthCore/OIDAuthStateChangeDelegate.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDAuthStateChangeDelegate.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | @class OIDAuthState; 22 | 23 | NS_ASSUME_NONNULL_BEGIN 24 | 25 | /*! @protocol OIDAuthStateChangeDelegate 26 | @brief Delegate of the OIDAuthState used to monitor various changes in state. 27 | */ 28 | @protocol OIDAuthStateChangeDelegate 29 | 30 | /*! @brief Called when the authorization state changes and any backing storage needs to be updated. 31 | @param state The @c OIDAuthState that changed. 32 | @discussion If you are storing the authorization state, you should update the storage when the 33 | state changes. 34 | */ 35 | - (void)didChangeState:(OIDAuthState *)state; 36 | 37 | @end 38 | 39 | NS_ASSUME_NONNULL_END 40 | -------------------------------------------------------------------------------- /Sources/AppAuthCore/OIDClientMetadataParameters.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDClientMetadataParameters.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2016 The AppAuth for iOS Authors. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | /*! @brief Parameter name for the token endpoint authentication method. 24 | */ 25 | extern NSString *const OIDTokenEndpointAuthenticationMethodParam; 26 | 27 | /*! @brief Parameter name for the application type. 28 | */ 29 | extern NSString *const OIDApplicationTypeParam; 30 | 31 | /*! @brief Parameter name for the redirect URI values. 32 | */ 33 | extern NSString *const OIDRedirectURIsParam; 34 | 35 | /*! @brief Parameter name for the response type values. 36 | */ 37 | extern NSString *const OIDResponseTypesParam; 38 | 39 | /*! @brief Parameter name for the grant type values. 40 | */ 41 | extern NSString *const OIDGrantTypesParam; 42 | 43 | /*! @brief Parameter name for the subject type. 44 | */ 45 | extern NSString *const OIDSubjectTypeParam; 46 | 47 | /*! @brief Application type that indicates this client is a native (not a web) application. 48 | */ 49 | extern NSString *const OIDApplicationTypeNative; 50 | 51 | NS_ASSUME_NONNULL_END 52 | -------------------------------------------------------------------------------- /Sources/AppAuthCore/OIDClientMetadataParameters.m: -------------------------------------------------------------------------------- 1 | /*! @file OIDClientMetadataParameters.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2016 The AppAuth for iOS Authors. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import "OIDClientMetadataParameters.h" 20 | 21 | NSString *const OIDTokenEndpointAuthenticationMethodParam = @"token_endpoint_auth_method"; 22 | 23 | NSString *const OIDApplicationTypeParam = @"application_type"; 24 | 25 | NSString *const OIDRedirectURIsParam = @"redirect_uris"; 26 | 27 | NSString *const OIDResponseTypesParam = @"response_types"; 28 | 29 | NSString *const OIDGrantTypesParam = @"grant_types"; 30 | 31 | NSString *const OIDSubjectTypeParam = @"subject_type"; 32 | 33 | NSString *const OIDApplicationTypeNative = @"native"; 34 | -------------------------------------------------------------------------------- /Sources/AppAuthCore/OIDDefines.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDDefines.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | /*! @def OIDIsEqualIncludingNil(x, y) 20 | @brief Returns YES if x and y are equal by reference or value. 21 | @discussion NOTE: parameters may be evaluated multiple times. Be careful if using this check 22 | with expressions - especially if the expressions have side effects. 23 | @param x An object. 24 | @param y An object. 25 | */ 26 | #define OIDIsEqualIncludingNil(x, y) (((x) == (y)) || [(x) isEqual:(y)]) 27 | 28 | /*! @def OID_UNAVAILABLE_USE_INITIALIZER(designatedInitializer) 29 | @brief Provides a template implementation for init-family methods which have been marked as 30 | NS_UNAVILABLE. Stops the compiler from giving a warning when it's the super class' 31 | designated initializer, and gives callers useful feedback telling them what the 32 | new designated initializer is. 33 | @remarks Takes a SEL as a parameter instead of a string so that we get compiler warnings if the 34 | designated intializer's signature changes. 35 | @param designatedInitializer A SEL referencing the designated initializer. 36 | */ 37 | #define OID_UNAVAILABLE_USE_INITIALIZER(designatedInitializer) { \ 38 | NSString *reason = [NSString stringWithFormat:@"Called: %@\nDesignated Initializer:%@", \ 39 | NSStringFromSelector(_cmd), \ 40 | NSStringFromSelector(designatedInitializer)]; \ 41 | @throw [NSException exceptionWithName:@"Attempt to call unavailable initializer." \ 42 | reason:reason \ 43 | userInfo:nil]; \ 44 | } 45 | 46 | #ifdef _APPAUTHTRACE 47 | # define AppAuthRequestTrace(fmt, ...) NSLog(fmt, ##__VA_ARGS__); 48 | #else // _APPAUTHTRACE 49 | # define AppAuthRequestTrace(...) 50 | #endif // _APPAUTHTRACE 51 | 52 | -------------------------------------------------------------------------------- /Sources/AppAuthCore/OIDEndSessionResponse.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDEndSessionResponse.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2017 The AppAuth Authors. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | @class OIDEndSessionRequest; 22 | 23 | NS_ASSUME_NONNULL_BEGIN 24 | 25 | /*! @brief Represents the response to an End Session request. 26 | @see http://openid.net/specs/openid-connect-session-1_0.html#RPLogout 27 | */ 28 | 29 | @interface OIDEndSessionResponse : NSObject 30 | 31 | /*! @brief The request which was serviced. 32 | */ 33 | @property(nonatomic, readonly) OIDEndSessionRequest *request; 34 | 35 | /*! @brief REQUIRED if the "state" parameter was present in the client end-session request. The 36 | exact value received from the client. 37 | @remarks state 38 | */ 39 | @property(nonatomic, readonly, nullable) NSString *state; 40 | 41 | /*! @brief Additional parameters returned from the end session endpoint. 42 | */ 43 | @property(nonatomic, readonly, nullable) 44 | NSDictionary *> *additionalParameters; 45 | 46 | /*! @internal 47 | @brief Unavailable. Please use initWithParameters:. 48 | */ 49 | - (instancetype)init NS_UNAVAILABLE; 50 | 51 | /*! @brief Designated initializer. 52 | @param request The serviced request. 53 | @param parameters The decoded parameters returned from the End Session Endpoint. 54 | @remarks Known parameters are extracted from the @c parameters parameter and the normative 55 | properties are populated. Non-normative parameters are placed in the 56 | @c #additionalParameters dictionary. 57 | */ 58 | - (instancetype)initWithRequest:(OIDEndSessionRequest *)request 59 | parameters:(NSDictionary *> *)parameters 60 | NS_DESIGNATED_INITIALIZER; 61 | 62 | @end 63 | 64 | NS_ASSUME_NONNULL_END 65 | -------------------------------------------------------------------------------- /Sources/AppAuthCore/OIDError.m: -------------------------------------------------------------------------------- 1 | /*! @file OIDError.m 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import "OIDError.h" 20 | 21 | NSString *const OIDGeneralErrorDomain = @"org.openid.appauth.general"; 22 | 23 | NSString *const OIDOAuthTokenErrorDomain = @"org.openid.appauth.oauth_token"; 24 | 25 | NSString *const OIDOAuthAuthorizationErrorDomain = @"org.openid.appauth.oauth_authorization"; 26 | 27 | NSString *const OIDOAuthRegistrationErrorDomain = @"org.openid.appauth.oauth_registration"; 28 | 29 | NSString *const OIDResourceServerAuthorizationErrorDomain = @"org.openid.appauth.resourceserver"; 30 | 31 | NSString *const OIDHTTPErrorDomain = @"org.openid.appauth.remote-http"; 32 | 33 | NSString *const OIDOAuthExceptionInvalidAuthorizationFlow = @"An OAuth redirect was sent to a " 34 | "OIDExternalUserAgentSession after it already completed."; 35 | 36 | NSString *const OIDOAuthExceptionInvalidTokenRequestNullRedirectURL = @"A OIDTokenRequest was " 37 | "created with a grant_type that requires a redirectURL, but a null redirectURL was given"; 38 | 39 | NSString *const OIDOAuthErrorResponseErrorKey = @"OIDOAuthErrorResponseErrorKey"; 40 | 41 | NSString *const OIDOAuthErrorFieldError = @"error"; 42 | 43 | NSString *const OIDOAuthErrorFieldErrorDescription = @"error_description"; 44 | 45 | NSString *const OIDOAuthErrorFieldErrorURI = @"error_uri"; 46 | -------------------------------------------------------------------------------- /Sources/AppAuthCore/OIDExternalUserAgent.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDExternalUserAgent.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2016 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | @protocol OIDExternalUserAgentSession; 22 | @protocol OIDExternalUserAgentRequest; 23 | 24 | NS_ASSUME_NONNULL_BEGIN 25 | 26 | /*! @protocol OIDExternalUserAgent 27 | @brief An external user-agent UI that presents displays the request to the user. Clients may 28 | provide custom implementations of an external user-agent to customize the way the requests 29 | are presented to the end user. 30 | */ 31 | @protocol OIDExternalUserAgent 32 | 33 | /*! @brief Presents the request in the external user-agent. 34 | @param request The request to be presented in the external user-agent. 35 | @param session The @c OIDExternalUserAgentSession instance that initiates presenting the UI. 36 | Concrete implementations of a @c OIDExternalUserAgent may call 37 | resumeExternalUserAgentFlowWithURL or failExternalUserAgentFlowWithError on session to either 38 | resume or fail the request. 39 | @return YES If the request UI was successfully presented to the user. 40 | */ 41 | - (BOOL)presentExternalUserAgentRequest:(id )request 42 | session:(id)session; 43 | 44 | /*! @brief Dimisses the external user-agent and calls completion when the dismiss operation ends. 45 | @param animated Whether or not the dismiss operation should be animated. 46 | @remarks Has no effect if no UI is presented. 47 | @param completion The block to be called when the dismiss operations ends 48 | */ 49 | - (void)dismissExternalUserAgentAnimated:(BOOL)animated completion:(void (^)(void))completion; 50 | 51 | @end 52 | 53 | NS_ASSUME_NONNULL_END 54 | -------------------------------------------------------------------------------- /Sources/AppAuthCore/OIDExternalUserAgentRequest.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDExternalUserAgent.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2017 The AppAuth Authors. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | /*! @protocol OIDExternalUserAgent 20 | @brief An interface that any external user-agent request may implement to use the 21 | @c OIDExternalUserAgent flow. 22 | */ 23 | @protocol OIDExternalUserAgentRequest 24 | 25 | /*! @brief Method to create and return the complete request URL instance. 26 | @return A @c NSURL instance which contains the URL to be opened in an external UI (i.e. browser) 27 | */ 28 | - (NSURL*)externalUserAgentRequestURL; 29 | 30 | /*! @brief If this external user-agent request has a redirect URL, this should return its scheme. 31 | Since some external requests have optional callbacks (such as the end session endpoint), the 32 | return value of this method is nullable. 33 | @return A @c NSString instance that contains the scheme of a callback url, or nil if there is 34 | no callback url for this request. 35 | */ 36 | - (NSString*)redirectScheme; 37 | @end 38 | -------------------------------------------------------------------------------- /Sources/AppAuthCore/OIDGrantTypes.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDGrantTypes.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | /*! @brief For exchanging an authorization code for an access token. 22 | @see https://tools.ietf.org/html/rfc6749#section-4.1.3 23 | */ 24 | extern NSString *const OIDGrantTypeAuthorizationCode; 25 | 26 | /*! @brief For refreshing an access token with a refresh token. 27 | @see https://tools.ietf.org/html/rfc6749#section-6 28 | */ 29 | extern NSString *const OIDGrantTypeRefreshToken; 30 | 31 | /*! @brief For obtaining an access token with a username and password. 32 | @see https://tools.ietf.org/html/rfc6749#section-4.3.2 33 | */ 34 | extern NSString *const OIDGrantTypePassword; 35 | 36 | /*! @brief For obtaining an access token from the token endpoint using client credentials. 37 | @see https://tools.ietf.org/html/rfc6749#section-3.2.1 38 | @see https://tools.ietf.org/html/rfc6749#section-4.4.2 39 | */ 40 | extern NSString *const OIDGrantTypeClientCredentials; 41 | -------------------------------------------------------------------------------- /Sources/AppAuthCore/OIDGrantTypes.m: -------------------------------------------------------------------------------- 1 | /*! @file OIDGrantTypes.m 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import "OIDGrantTypes.h" 20 | 21 | NSString *const OIDGrantTypeAuthorizationCode = @"authorization_code"; 22 | 23 | NSString *const OIDGrantTypeRefreshToken = @"refresh_token"; 24 | 25 | NSString *const OIDGrantTypePassword = @"password"; 26 | 27 | NSString *const OIDGrantTypeClientCredentials = @"client_credentials"; 28 | -------------------------------------------------------------------------------- /Sources/AppAuthCore/OIDResponseTypes.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDResponseTypes.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | /*! @brief A constant for the standard OAuth2 Response Type of 'code'. 22 | */ 23 | extern NSString *const OIDResponseTypeCode; 24 | 25 | /*! @brief A constant for the standard OAuth2 Response Type of 'token'. 26 | */ 27 | extern NSString *const OIDResponseTypeToken; 28 | 29 | /*! @brief A constant for the standard OAuth2 Response Type of 'id_token'. 30 | */ 31 | extern NSString *const OIDResponseTypeIDToken; 32 | -------------------------------------------------------------------------------- /Sources/AppAuthCore/OIDResponseTypes.m: -------------------------------------------------------------------------------- 1 | /*! @file OIDResponseTypes.m 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import "OIDResponseTypes.h" 20 | 21 | NSString *const OIDResponseTypeCode = @"code"; 22 | 23 | NSString *const OIDResponseTypeToken = @"token"; 24 | 25 | NSString *const OIDResponseTypeIDToken = @"id_token"; 26 | -------------------------------------------------------------------------------- /Sources/AppAuthCore/OIDScopeUtilities.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDScopeUtilities.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | /*! @brief Provides convenience methods for dealing with scope strings. 24 | */ 25 | @interface OIDScopeUtilities : NSObject 26 | 27 | /*! @internal 28 | @brief Unavailable. This class should not be initialized. 29 | */ 30 | - (instancetype)init NS_UNAVAILABLE; 31 | 32 | /*! @brief Converts an array of scope strings to a single scope string per the OAuth 2 spec. 33 | @param scopes An array of scope strings. 34 | @return A space-delimited string of scopes. 35 | @see https://tools.ietf.org/html/rfc6749#section-3.3 36 | */ 37 | + (NSString *)scopesWithArray:(NSArray *)scopes; 38 | 39 | /*! @brief Converts an OAuth 2 spec-compliant scope string to an array of scopes. 40 | @param scopes An OAuth 2 spec-compliant scope string. 41 | @return An array of scope strings. 42 | @see https://tools.ietf.org/html/rfc6749#section-3.3 43 | */ 44 | + (NSArray *)scopesArrayWithString:(NSString *)scopes; 45 | 46 | @end 47 | 48 | NS_ASSUME_NONNULL_END 49 | -------------------------------------------------------------------------------- /Sources/AppAuthCore/OIDScopeUtilities.m: -------------------------------------------------------------------------------- 1 | /*! @file OIDScopeUtilities.m 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import "OIDScopeUtilities.h" 20 | 21 | @implementation OIDScopeUtilities 22 | 23 | /*! @brief A character set with the characters NOT allowed in a scope name. 24 | @see https://tools.ietf.org/html/rfc6749#section-3.3 25 | */ 26 | + (NSCharacterSet *)disallowedScopeCharacters { 27 | static NSCharacterSet *disallowedCharacters; 28 | static dispatch_once_t onceToken; 29 | dispatch_once(&onceToken, ^{ 30 | NSMutableCharacterSet *allowedCharacters; 31 | allowedCharacters = 32 | [NSMutableCharacterSet characterSetWithRange:NSMakeRange(0x23, 0x5B - 0x23 + 1)]; 33 | [allowedCharacters addCharactersInRange:NSMakeRange(0x5D, 0x7E - 0x5D + 1)]; 34 | [allowedCharacters addCharactersInString:@"\x21"]; 35 | disallowedCharacters = [allowedCharacters invertedSet]; 36 | }); 37 | return disallowedCharacters; 38 | } 39 | 40 | + (NSString *)scopesWithArray:(NSArray *)scopes { 41 | #if !defined(NS_BLOCK_ASSERTIONS) 42 | NSCharacterSet *disallowedCharacters = [self disallowedScopeCharacters]; 43 | for (NSString *scope in scopes) { 44 | NSAssert(scope.length, @"Found illegal empty scope string."); 45 | NSAssert([scope rangeOfCharacterFromSet:disallowedCharacters].location == NSNotFound, 46 | @"Found illegal character in scope string."); 47 | } 48 | #endif // !defined(NS_BLOCK_ASSERTIONS) 49 | 50 | NSString *scopeString = [scopes componentsJoinedByString:@" "]; 51 | return scopeString; 52 | } 53 | 54 | + (NSArray *)scopesArrayWithString:(NSString *)scopes { 55 | return [scopes componentsSeparatedByString:@" "]; 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /Sources/AppAuthCore/OIDScopes.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDScopes.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | /*! @brief Scope that indicates this request is an OpenID Connect request. 22 | @see http://openid.net/specs/openid-connect-core-1_0.html#AuthRequestValidation 23 | */ 24 | extern NSString *const OIDScopeOpenID; 25 | 26 | /*! @brief This scope value requests access to the End-User's default profile Claims, which are: 27 | name, family_name, given_name, middle_name, nickname, preferred_username, profile, picture, 28 | website, gender, birthdate, zoneinfo, locale, and updated_at. 29 | @see http://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims 30 | */ 31 | extern NSString *const OIDScopeProfile; 32 | 33 | /*! @brief This scope value requests access to the email and email_verified Claims. 34 | @see http://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims 35 | */ 36 | extern NSString *const OIDScopeEmail; 37 | 38 | /*! @brief This scope value requests access to the address Claim. 39 | @see http://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims 40 | */ 41 | extern NSString *const OIDScopeAddress; 42 | 43 | /*! @brief This scope value requests access to the phone_number and phone_number_verified Claims. 44 | @see http://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims 45 | */ 46 | extern NSString *const OIDScopePhone; 47 | -------------------------------------------------------------------------------- /Sources/AppAuthCore/OIDScopes.m: -------------------------------------------------------------------------------- 1 | /*! @file OIDScopes.m 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import "OIDScopes.h" 20 | 21 | NSString *const OIDScopeOpenID = @"openid"; 22 | 23 | NSString *const OIDScopeProfile = @"profile"; 24 | 25 | NSString *const OIDScopeEmail = @"email"; 26 | 27 | NSString *const OIDScopeAddress = @"address"; 28 | 29 | NSString *const OIDScopePhone = @"phone"; 30 | -------------------------------------------------------------------------------- /Sources/AppAuthCore/OIDTokenUtilities.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDTokenUtilities.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | /*! @brief Provides data encoding/decoding methods, random string generators, etc. 24 | */ 25 | @interface OIDTokenUtilities : NSObject 26 | 27 | /*! @internal 28 | @brief Unavailable. This class should not be initialized. 29 | */ 30 | - (instancetype)init NS_UNAVAILABLE; 31 | 32 | /*! @brief Base64url-nopadding encodes the given data. 33 | @param data The input data. 34 | @return The base64url encoded data as a NSString. 35 | @discussion Base64url-nopadding is used in several identity specs such as PKCE and 36 | OpenID Connect. 37 | */ 38 | + (NSString *)encodeBase64urlNoPadding:(NSData *)data; 39 | 40 | /*! @brief Generates a URL-safe string of random data. 41 | @param size The number of random bytes to encode. NB. the length of the output string will be 42 | greater than the number of random bytes, due to the URL-safe encoding. 43 | @return Random data encoded with base64url. 44 | */ 45 | + (nullable NSString *)randomURLSafeStringWithSize:(NSUInteger)size; 46 | 47 | /*! @brief SHA256 hashes the input string. 48 | @param inputString The input string. 49 | @return The SHA256 data. 50 | */ 51 | + (NSData *)sha256:(NSString *)inputString; 52 | 53 | /*! @brief Truncated intput string after first 6 characters followed by ellipses 54 | @param inputString The input string. 55 | @return Truncated string. 56 | */ 57 | + (nullable NSString *)redact:(nullable NSString *)inputString; 58 | 59 | /*! @brief Form url encode the input string by applying application/x-www-form-urlencoded algorithm 60 | @param inputString The input string. 61 | @return The encoded string. 62 | */ 63 | + (NSString*)formUrlEncode:(NSString*)inputString; 64 | 65 | @end 66 | 67 | NS_ASSUME_NONNULL_END 68 | -------------------------------------------------------------------------------- /Sources/AppAuthCore/OIDURLSessionProvider.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDURLSessionProvider.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | /*! @brief A NSURLSession provider that allows clients to provide custom implementation 24 | for NSURLSession 25 | */ 26 | @interface OIDURLSessionProvider : NSObject 27 | 28 | /*! @brief Obtains the current @c NSURLSession; using the +[NSURLSession sharedSession] if 29 | no custom implementation is provided. 30 | @return NSURLSession object to be used for making network requests. 31 | */ 32 | + (NSURLSession *)session; 33 | 34 | /*! @brief Allows library consumers to change the @c NSURLSession instance used to make 35 | network requests. 36 | @param session The @c NSURLSession instance that should be used for making network requests. 37 | */ 38 | + (void)setSession:(NSURLSession *)session; 39 | @end 40 | NS_ASSUME_NONNULL_END 41 | -------------------------------------------------------------------------------- /Sources/AppAuthCore/OIDURLSessionProvider.m: -------------------------------------------------------------------------------- 1 | /*! @file OIDURLSessionProvider.m 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import "OIDURLSessionProvider.h" 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | static NSURLSession *__nullable gURLSession; 24 | 25 | @implementation OIDURLSessionProvider 26 | 27 | + (NSURLSession *)session { 28 | if (!gURLSession) { 29 | gURLSession = [NSURLSession sharedSession]; 30 | } 31 | return gURLSession; 32 | } 33 | 34 | + (void)setSession:(NSURLSession *)session { 35 | NSAssert(session, @"Parameter: |session| must be non-nil."); 36 | gURLSession = session; 37 | } 38 | @end 39 | NS_ASSUME_NONNULL_END 40 | -------------------------------------------------------------------------------- /Sources/AppAuthCore/Resources/PrivacyInfo.xcprivacy: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSPrivacyAccessedAPITypes 6 | 7 | 8 | NSPrivacyCollectedDataTypes 9 | 10 | 11 | NSPrivacyTrackingDomains 12 | 13 | NSPrivacyTracking 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Sources/AppAuthTV.h: -------------------------------------------------------------------------------- 1 | /*! @file AppAuthTV.h 2 | @brief AppAuthTV SDK 3 | @copyright 4 | Copyright 2020 Google Inc. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import "OIDTVAuthorizationRequest.h" 20 | #import "OIDTVAuthorizationResponse.h" 21 | #import "OIDTVAuthorizationService.h" 22 | #import "OIDTVServiceConfiguration.h" 23 | -------------------------------------------------------------------------------- /Sources/AppAuthTV/OIDTVAuthorizationRequest.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDTVAuthorizationRequest.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2016 Google Inc. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | #import "OIDAuthorizationRequest.h" 22 | 23 | @class OIDTVServiceConfiguration; 24 | 25 | NS_ASSUME_NONNULL_BEGIN 26 | 27 | /*! @brief Represents a TV and limited input device authorization request. 28 | @see https://tools.ietf.org/html/rfc8628#section-3.1 29 | */ 30 | @interface OIDTVAuthorizationRequest : OIDAuthorizationRequest 31 | 32 | /*! @brief Creates a TV authorization request with opinionated defaults 33 | @param configuration The service's configuration. 34 | @param clientID The client identifier. 35 | @param clientSecret The client secret. 36 | @param scopes An array of scopes to combine into a single scope string per the OAuth2 spec. 37 | @param additionalParameters The client's additional authorization parameters. 38 | */ 39 | - (instancetype) 40 | initWithConfiguration:(OIDTVServiceConfiguration *)configuration 41 | clientId:(NSString *)clientID 42 | clientSecret:(NSString *)clientSecret 43 | scopes:(nullable NSArray *)scopes 44 | additionalParameters:(nullable NSDictionary *)additionalParameters; 45 | 46 | /*! @brief Constructs an @c NSURLRequest representing the TV authorization request. 47 | @return An @c NSURLRequest representing the TV authorization request. 48 | */ 49 | - (NSURLRequest *)URLRequest; 50 | 51 | @end 52 | 53 | NS_ASSUME_NONNULL_END 54 | -------------------------------------------------------------------------------- /Sources/AppAuthTV/OIDTVServiceConfiguration.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDTVServiceConfiguration.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2016 Google Inc. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import "OIDServiceConfiguration.h" 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | /*! @brief Configuration for authorizing the user with the @c OIDTVAuthorizationService. 24 | */ 25 | @interface OIDTVServiceConfiguration : OIDServiceConfiguration 26 | 27 | /*! @brief The device authorization endpoint URI. 28 | */ 29 | @property(nonatomic, readonly) NSURL *deviceAuthorizationEndpoint; 30 | 31 | /*! @internal 32 | @brief Unavailable. Please use 33 | @c initWithDeviceAuthorizationEndpoint:tokenEndpoint: 34 | */ 35 | - (instancetype)init NS_UNAVAILABLE; 36 | 37 | /*! @internal 38 | @brief Unavailable. Please use 39 | @c initWithDeviceAuthorizationEndpoint:tokenEndpoint: 40 | */ 41 | - (instancetype)initWithAuthorizationEndpoint:(NSURL *)authorizationEndpoint 42 | tokenEndpoint:(NSURL *)tokenEndpoint NS_UNAVAILABLE; 43 | 44 | /*! @brief Designated initializer. 45 | @param discoveryDocument The discovery document from which to extract the required OAuth 46 | configuration. 47 | */ 48 | - (instancetype)initWithDiscoveryDocument:(OIDServiceDiscovery *)discoveryDocument 49 | NS_DESIGNATED_INITIALIZER; 50 | 51 | /*! @brief Designated initializer. 52 | @param deviceAuthorizationEndpoint The device authorization endpoint URI. 53 | @param tokenEndpoint The token exchange and refresh endpoint URI. 54 | */ 55 | - (instancetype)initWithDeviceAuthorizationEndpoint:(NSURL *)deviceAuthorizationEndpoint 56 | tokenEndpoint:(NSURL *)tokenEndpoint 57 | NS_DESIGNATED_INITIALIZER; 58 | 59 | @end 60 | 61 | NS_ASSUME_NONNULL_END 62 | -------------------------------------------------------------------------------- /Sources/AppAuthTV/Resources/PrivacyInfo.xcprivacy: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSPrivacyAccessedAPITypes 6 | 7 | 8 | NSPrivacyCollectedDataTypes 9 | 10 | 11 | NSPrivacyTrackingDomains 12 | 13 | NSPrivacyTracking 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Sources/CoreFramework/AppAuthCore.h: -------------------------------------------------------------------------------- 1 | /*! @file AppAuthCore.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2018 The AppAuth Authors. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | //! Project version number for AppAuthFramework-iOS. 22 | FOUNDATION_EXPORT double AppAuthCoreVersionNumber; 23 | 24 | //! Project version string for AppAuthCoreFramework. 25 | FOUNDATION_EXPORT const unsigned char AppAuthCoreVersionString[]; 26 | 27 | #import 28 | #import 29 | #import 30 | #import 31 | #import 32 | #import 33 | #import 34 | #import 35 | #import 36 | #import 37 | #import 38 | #import 39 | #import 40 | #import 41 | #import 42 | #import 43 | #import 44 | #import 45 | #import 46 | #import 47 | #import 48 | #import 49 | #import 50 | #import 51 | #import 52 | #import 53 | 54 | -------------------------------------------------------------------------------- /Sources/CoreFramework/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSHumanReadableCopyright 22 | Copyright © 2017 The AppAuth Authors 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Sources/Framework/AppAuth.h: -------------------------------------------------------------------------------- 1 | /*! @file AppAuth.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | //! Project version number for AppAuthFramework-iOS. 22 | FOUNDATION_EXPORT double AppAuthVersionNumber; 23 | 24 | //! Project version string for AppAuthFramework-iOS. 25 | FOUNDATION_EXPORT const unsigned char AppAuthVersionString[]; 26 | 27 | #import 28 | #import 29 | #import 30 | #import 31 | #import 32 | #import 33 | #import 34 | #import 35 | #import 36 | #import 37 | #import 38 | #import 39 | #import 40 | #import 41 | #import 42 | #import 43 | #import 44 | #import 45 | #import 46 | #import 47 | #import 48 | #import 49 | #import 50 | #import 51 | #import 52 | #import 53 | 54 | #if TARGET_OS_TV 55 | #elif TARGET_OS_WATCH 56 | #elif TARGET_OS_IOS || TARGET_OS_MACCATALYST 57 | #import 58 | #import 59 | #import 60 | #import 61 | #import "AppAuth/OIDExternalUserAgentCatalyst.h" 62 | #elif TARGET_OS_OSX 63 | #import 64 | #import 65 | #import 66 | #import 67 | #else 68 | #error "Platform Undefined" 69 | #endif 70 | 71 | -------------------------------------------------------------------------------- /Sources/Framework/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSHumanReadableCopyright 22 | Copyright © 2017 The AppAuth Authors 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Sources/TVFramework/AppAuthTV.h: -------------------------------------------------------------------------------- 1 | /*! @file AppAuthTV.h 2 | @brief AppAuthTV SDK 3 | @copyright 4 | Copyright 2020 Google Inc. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | //! Project version number for AppAuthTV. 22 | FOUNDATION_EXPORT double AppAuthTVVersionNumber; 23 | 24 | //! Project version string for AppAuthTV. 25 | FOUNDATION_EXPORT const unsigned char AppAuthTVVersionString[]; 26 | 27 | #import 28 | #import 29 | #import 30 | #import 31 | #import 32 | #import 33 | #import 34 | #import 35 | #import 36 | #import 37 | #import 38 | #import 39 | #import 40 | #import 41 | #import 42 | #import 43 | #import 44 | #import 45 | #import 46 | #import 47 | #import 48 | #import 49 | #import 50 | #import 51 | #import 52 | #import 53 | 54 | #import 55 | #import 56 | #import 57 | #import 58 | -------------------------------------------------------------------------------- /Sources/TVFramework/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | 22 | 23 | -------------------------------------------------------------------------------- /UnitTests/AppAuthTV/OIDTVAuthorizationRequestTests.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDTVAuthorizationRequestTests.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2020 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | @class OIDTVServiceConfiguration; 22 | 23 | NS_ASSUME_NONNULL_BEGIN 24 | 25 | /*! @brief Unit tests for @c OIDTVAuthorizationRequest. 26 | */ 27 | @interface OIDTVAuthorizationRequestTests : XCTestCase 28 | - (OIDTVServiceConfiguration *)testServiceConfiguration; 29 | - (NSDictionary *)bodyParametersFromURLRequest:(NSURLRequest *)urlRequest; 30 | 31 | /*! @brief Tests the initializer 32 | */ 33 | - (void)testInitializer; 34 | 35 | /*! @brief Tests the @c NSCopying implementation by round-tripping an instance through the copying 36 | * process and checking to make sure the source and destination both contain the 37 | * @c deviceAuthorizationEndpoint 38 | */ 39 | - (void)testCopying; 40 | 41 | /*! @brief Tests the @c NSSecureCoding implementation by round-tripping an instance through the 42 | * coding process and checking to make sure the source and destination both contain the 43 | * @c deviceAuthorizationEndpoint 44 | */ 45 | - (void)testSecureCoding; 46 | 47 | /*! @brief Tests the @c URLRequest method on a request with no scopes or additional parameters 48 | */ 49 | - (void)testURLRequestBasicClientAuth; 50 | 51 | /*! @brief Tests the @c URLRequest method on a request with two scopes and no additional parameters 52 | */ 53 | - (void)testURLRequestScopes; 54 | 55 | /*! @brief Tests the @c URLRequest method on a request with two scopes and one additional parameter 56 | */ 57 | - (void)testURLRequestAdditionalParams; 58 | @end 59 | 60 | NS_ASSUME_NONNULL_END 61 | -------------------------------------------------------------------------------- /UnitTests/AppAuthTV/OIDTVAuthorizationResponseTests.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDTVAuthorizationResponseTests.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2020 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | @class OIDTVAuthorizationResponse; 22 | 23 | NS_ASSUME_NONNULL_BEGIN 24 | 25 | /*! @brief Unit tests for @c OIDTVAuthorizationResponse. 26 | */ 27 | @interface OIDTVAuthorizationResponseTests : XCTestCase 28 | 29 | /*! @brief Tests the initializer using the standard key for @c verificationURI. 30 | */ 31 | - (void)testInitializer; 32 | 33 | /*! @brief Tests the initializer using the alternative key for @c verificationURI. 34 | */ 35 | - (void)testInitializerAlternativeKey; 36 | 37 | /*! @brief Tests the @c NSCopying implementation by round-tripping an instance through the copying 38 | * process and checking to make sure the source and destination are equivalent. 39 | */ 40 | - (void)testCopying; 41 | 42 | /*! @brief Tests the @c NSSecureCoding implementation by round-tripping an instance through the 43 | * coding process and checking to make sure the source and destination are equivalent. 44 | */ 45 | - (void)testSecureCoding; 46 | 47 | /*! @brief Tests the @c tokenPollRequest method that takes no additional parameters. 48 | */ 49 | - (void)testTokenPollRequest; 50 | 51 | /*! @brief Tests the @c testTokenPollRequestWithAdditionalParametersAdditionalHeaders method with one additional 52 | parameter and one additional header. 53 | */ 54 | - (void)testTokenPollRequestWithAdditionalParametersAdditionalHeaders; 55 | 56 | @end 57 | 58 | NS_ASSUME_NONNULL_END 59 | 60 | -------------------------------------------------------------------------------- /UnitTests/AppAuthTV/OIDTVTokenRequestTests.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDTVTokenRequestTests.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2020 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | @class OIDTVTokenRequest; 22 | 23 | NS_ASSUME_NONNULL_BEGIN 24 | 25 | /*! @brief Unit tests for @c OIDTVTokenRequest. 26 | */ 27 | @interface OIDTVTokenRequestTests : XCTestCase 28 | 29 | /*! @brief Tests the initializer 30 | */ 31 | - (void)testInitializer; 32 | 33 | /*! @brief Tests the @c NSCopying implementation by round-tripping an instance through the copying 34 | * process and checking to make sure the source and destination both contain the @c deviceCode. 35 | */ 36 | - (void)testCopying; 37 | 38 | /*! @brief Tests the @c NSSecureCoding implementation by round-tripping an instance through the 39 | * coding process and checking to make sure the source and destination both contain the 40 | * @c deviceCode 41 | */ 42 | - (void)testSecureCoding; 43 | 44 | /*! @brief Tests the @c URLRequest method to verify that the body parameters include the correct 45 | * grant type, device code and additional parameters. 46 | */ 47 | - (void)testURLRequest; 48 | 49 | @end 50 | 51 | NS_ASSUME_NONNULL_END 52 | -------------------------------------------------------------------------------- /UnitTests/OIDAppAuthTests-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDAppAuthTests-Bridging-Header.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2017 The AppAuth for iOS Authors. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Public headers exposed to Swift. 20 | 21 | #import "AppAuth.h" 22 | -------------------------------------------------------------------------------- /UnitTests/OIDAuthStateTests.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDAuthStateTests.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | #if SWIFT_PACKAGE 22 | @import AppAuthCore; 23 | #else 24 | #import "Sources/AppAuthCore/OIDAuthStateChangeDelegate.h" 25 | #import "Sources/AppAuthCore/OIDAuthStateErrorDelegate.h" 26 | #endif 27 | 28 | @class OIDAuthState; 29 | 30 | NS_ASSUME_NONNULL_BEGIN 31 | 32 | /*! @brief Unit tests for @c OIDAuthState. 33 | */ 34 | @interface OIDAuthStateTests : XCTestCase 35 | 36 | /*! @brief Creates a new @c OIDAuthState for testing. 37 | */ 38 | + (OIDAuthState *)testInstance; 39 | 40 | @end 41 | 42 | NS_ASSUME_NONNULL_END 43 | -------------------------------------------------------------------------------- /UnitTests/OIDAuthorizationRequestTests.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDAuthorizationRequestTests.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | @class OIDAuthorizationRequest; 22 | 23 | NS_ASSUME_NONNULL_BEGIN 24 | 25 | /*! @brief Unit tests for @c OIDAuthorizationRequest. 26 | */ 27 | @interface OIDAuthorizationRequestTests : XCTestCase 28 | 29 | /*! @brief Creates a new @c OIDAuthorizationRequest for testing. 30 | */ 31 | + (OIDAuthorizationRequest *)testInstance; 32 | 33 | /*! @brief Creates a new @c OIDAuthorizationRequest testing a code flow request. 34 | */ 35 | + (OIDAuthorizationRequest *)testInstanceCodeFlow; 36 | 37 | /*! @brief Creates a new @c OIDAuthorizationRequest testing a code flow request 38 | with client authentication. 39 | */ 40 | + (OIDAuthorizationRequest *)testInstanceCodeFlowClientAuth; 41 | 42 | @end 43 | 44 | NS_ASSUME_NONNULL_END 45 | -------------------------------------------------------------------------------- /UnitTests/OIDAuthorizationResponseTests.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDAuthorizationResponseTests.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | @class OIDAuthorizationResponse; 22 | 23 | NS_ASSUME_NONNULL_BEGIN 24 | 25 | /*! @brief Unit tests for @c OIDAuthorizationResponse. 26 | */ 27 | @interface OIDAuthorizationResponseTests : XCTestCase 28 | 29 | /*! @brief Creates a new @c OIDAuthorizationResponse for testing. 30 | */ 31 | + (OIDAuthorizationResponse *)testInstance; 32 | 33 | /*! @brief Creates a new @c OIDAuthorizationResponse for testing the code flow. 34 | */ 35 | + (OIDAuthorizationResponse *)testInstanceCodeFlow; 36 | 37 | /*! @brief Creates a new @c OIDAuthorizationResponse with client authentication for testing the 38 | code flow. 39 | */ 40 | + (OIDAuthorizationResponse *)testInstanceCodeFlowClientAuth; 41 | 42 | @end 43 | 44 | NS_ASSUME_NONNULL_END 45 | -------------------------------------------------------------------------------- /UnitTests/OIDEndSessionRequestTests.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDServiceDiscoveryTests.m 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2017 The AppAuth Authors. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | @class OIDEndSessionRequest; 22 | 23 | NS_ASSUME_NONNULL_BEGIN 24 | 25 | @interface OIDEndSessionRequestTests : XCTestCase 26 | 27 | + (OIDEndSessionRequest *)testInstance; 28 | 29 | @end 30 | 31 | NS_ASSUME_NONNULL_END 32 | -------------------------------------------------------------------------------- /UnitTests/OIDGrantTypesTests.m: -------------------------------------------------------------------------------- 1 | /*! @file OIDGrantTypesTests.m 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | #if SWIFT_PACKAGE 22 | @import AppAuthCore; 23 | #else 24 | #import "Sources/AppAuthCore/OIDGrantTypes.h" 25 | #endif 26 | 27 | // Ignore warnings about "Use of GNU statement expression extension" which is raised by our use of 28 | // the XCTAssert___ macros. 29 | #pragma GCC diagnostic push 30 | #pragma GCC diagnostic ignored "-Wgnu" 31 | 32 | /*! @brief Unit tests for constants in @c OIDGrantTypes.m. 33 | @remarks Arguably not worth tests for this file, but adding them for consistency, and so that 34 | any future enhancements have a place to add tests if need be. 35 | */ 36 | @interface OIDGrantTypesTests : XCTestCase 37 | @end 38 | @implementation OIDGrantTypesTests 39 | 40 | - (void)testAuthorizationCode { 41 | XCTAssertEqualObjects(OIDGrantTypeAuthorizationCode, @"authorization_code"); 42 | } 43 | 44 | - (void)testRefreshToken { 45 | XCTAssertEqualObjects(OIDGrantTypeRefreshToken, @"refresh_token"); 46 | } 47 | 48 | - (void)testPassword { 49 | XCTAssertEqualObjects(OIDGrantTypePassword, @"password"); 50 | } 51 | 52 | - (void)testClientCredentials { 53 | XCTAssertEqualObjects(OIDGrantTypeClientCredentials, @"client_credentials"); 54 | } 55 | 56 | @end 57 | 58 | #pragma GCC diagnostic pop 59 | -------------------------------------------------------------------------------- /UnitTests/OIDRPProfileCode.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDRPProfileCode.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2017 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | #import "OIDExternalUserAgent.h" 22 | 23 | NS_ASSUME_NONNULL_BEGIN 24 | 25 | 26 | 27 | 28 | NS_ASSUME_NONNULL_END 29 | -------------------------------------------------------------------------------- /UnitTests/OIDRegistrationRequestTests.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDRegistrationRequestTests.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2016 The AppAuth for iOS Authors. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | @class OIDRegistrationRequest; 22 | 23 | NS_ASSUME_NONNULL_BEGIN 24 | 25 | /*! @brief Unit tests for @c OIDRegistrationRequest. 26 | */ 27 | @interface OIDRegistrationRequestTests : XCTestCase 28 | 29 | /*! @brief Creates a new @c OIDRegistrationRequest for testing. 30 | */ 31 | + (OIDRegistrationRequest *)testInstance; 32 | 33 | @end 34 | 35 | NS_ASSUME_NONNULL_END 36 | -------------------------------------------------------------------------------- /UnitTests/OIDRegistrationResponseTests.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDRegistrationResponseTests.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2016 The AppAuth for iOS Authors. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | @class OIDRegistrationResponse; 22 | 23 | NS_ASSUME_NONNULL_BEGIN 24 | 25 | @interface OIDRegistrationResponseTests : XCTestCase 26 | 27 | /*! @brief Creates a new @c OIDRegistrationResponseTests for testing. 28 | */ 29 | + (OIDRegistrationResponse *)testInstance; 30 | 31 | @end 32 | 33 | NS_ASSUME_NONNULL_END 34 | -------------------------------------------------------------------------------- /UnitTests/OIDResponseTypesTests.m: -------------------------------------------------------------------------------- 1 | /*! @file OIDResponseTypesTests.m 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | #if SWIFT_PACKAGE 22 | @import AppAuthCore; 23 | #else 24 | #import "Sources/AppAuthCore/OIDResponseTypes.h" 25 | #endif 26 | 27 | // Ignore warnings about "Use of GNU statement expression extension" which is raised by our use of 28 | // the XCTAssert___ macros. 29 | #pragma GCC diagnostic push 30 | #pragma GCC diagnostic ignored "-Wgnu" 31 | 32 | /*! @brief Unit tests for constants in @c OIDResponseTypes.m. 33 | @remarks Arguably not worth tests for this file, but adding them for consistency, and so that 34 | any future enhancements have a place to add tests if need be. 35 | */ 36 | @interface OIDResponseTypesTests : XCTestCase 37 | @end 38 | @implementation OIDResponseTypesTests 39 | 40 | - (void)testCode { 41 | XCTAssertEqualObjects(OIDResponseTypeCode, @"code", @""); 42 | } 43 | 44 | - (void)testToken { 45 | XCTAssertEqualObjects(OIDResponseTypeToken, @"token", @""); 46 | } 47 | 48 | - (void)testIDToken { 49 | XCTAssertEqualObjects(OIDResponseTypeIDToken, @"id_token", @""); 50 | } 51 | 52 | @end 53 | 54 | #pragma GCC diagnostic pop 55 | -------------------------------------------------------------------------------- /UnitTests/OIDScopesTests.m: -------------------------------------------------------------------------------- 1 | /*! @file OIDScopesTests.m 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | #if SWIFT_PACKAGE 22 | @import AppAuthCore; 23 | #else 24 | #import "Sources/AppAuthCore/OIDScopes.h" 25 | #endif 26 | 27 | // Ignore warnings about "Use of GNU statement expression extension" which is raised by our use of 28 | // the XCTAssert___ macros. 29 | #pragma GCC diagnostic push 30 | #pragma GCC diagnostic ignored "-Wgnu" 31 | 32 | /*! @brief Unit tests for constants in @c OIDScopes.m. 33 | @remarks Arguably not worth tests for this file, but adding them for consistency, and so that 34 | any future enhancements have a place to add tests if need be. 35 | */ 36 | @interface OIDScopesTests : XCTestCase 37 | @end 38 | @implementation OIDScopesTests 39 | 40 | - (void)testAddress { 41 | XCTAssertEqualObjects(OIDScopeAddress, @"address"); 42 | } 43 | 44 | - (void)testEmail { 45 | XCTAssertEqualObjects(OIDScopeEmail, @"email"); 46 | } 47 | 48 | - (void)testPhone { 49 | XCTAssertEqualObjects(OIDScopePhone, @"phone"); 50 | } 51 | 52 | - (void)testProfile { 53 | XCTAssertEqualObjects(OIDScopeProfile, @"profile"); 54 | } 55 | 56 | @end 57 | 58 | #pragma GCC diagnostic pop 59 | -------------------------------------------------------------------------------- /UnitTests/OIDServiceConfigurationTests.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDServiceConfigurationTests.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | @class OIDServiceConfiguration; 22 | 23 | NS_ASSUME_NONNULL_BEGIN 24 | 25 | /*! @brief Unit tests for @c OIDServiceConfiguration. 26 | */ 27 | @interface OIDServiceConfigurationTests : XCTestCase 28 | 29 | /*! @brief Creates a new @c OIDServiceConfiguration for testing. 30 | */ 31 | + (OIDServiceConfiguration *)testInstance; 32 | 33 | @end 34 | 35 | NS_ASSUME_NONNULL_END 36 | -------------------------------------------------------------------------------- /UnitTests/OIDServiceDiscoveryTests.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDServiceDiscoveryTests.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | /*! @brief Unit tests for @c OIDServiceDiscovery. 22 | */ 23 | @interface OIDServiceDiscoveryTests : XCTestCase 24 | 25 | /*! @brief Returns a dictionary containing the REQUIRED fields for an OpenID Connect 1.0 Service 26 | Discovery document. Used as a convenience for testing. 27 | */ 28 | + (NSDictionary *)minimumServiceDiscoveryDictionary; 29 | 30 | /*! @brief A fully populated dictionary containing ALL fields for an OpenID Connect 1.0 Service 31 | Discovery document. User as a convenience for testing. 32 | */ 33 | + (NSDictionary *)completeServiceDiscoveryDictionary; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /UnitTests/OIDSwiftTests.swift: -------------------------------------------------------------------------------- 1 | /*! @file SwiftTests.swift 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2017 The AppAuth for iOS Authors. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | import Foundation 20 | import XCTest 21 | 22 | #if SWIFT_PACKAGE 23 | import AppAuthCore 24 | #endif 25 | 26 | /*! @brief Unit tests to verify Swift compatability. 27 | */ 28 | class OIDSwiftTests: XCTestCase { 29 | 30 | /*! @brief Tests creation of a basic AppAuth object. 31 | */ 32 | func testSwift() { 33 | let authorizationEndpoint = URL(string: "https://example.com/authorization")! 34 | let tokenEndpoint = URL(string: "https://example.com/token")! 35 | let service = OIDServiceConfiguration(authorizationEndpoint: authorizationEndpoint, 36 | tokenEndpoint: tokenEndpoint) 37 | XCTAssertNotNil(service, "OIDServiceConfiguration not nil") 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /UnitTests/OIDTokenRequestTests.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDTokenRequestTests.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | @class OIDTokenRequest; 22 | 23 | NS_ASSUME_NONNULL_BEGIN 24 | 25 | /*! @brief Unit tests for @c OIDTokenRequest. 26 | */ 27 | @interface OIDTokenRequestTests : XCTestCase 28 | 29 | /*! @brief Creates a new @c OIDTokenRequest for testing. 30 | */ 31 | + (OIDTokenRequest *)testInstance; 32 | 33 | /*! @brief Creates a new @c OIDTokenRequest for testing the code exchange. 34 | */ 35 | + (OIDTokenRequest *)testInstanceCodeExchange; 36 | 37 | /*! @brief Creates a new @c OIDTokenRequest for testing the token refresh. 38 | */ 39 | + (OIDTokenRequest *)testInstanceRefresh; 40 | 41 | @end 42 | 43 | NS_ASSUME_NONNULL_END 44 | -------------------------------------------------------------------------------- /UnitTests/OIDTokenResponseTests.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDTokenResponseTests.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | @class OIDTokenResponse; 22 | 23 | NS_ASSUME_NONNULL_BEGIN 24 | 25 | /*! @brief Unit tests for @c OIDAuthorizationResponse. 26 | */ 27 | @interface OIDTokenResponseTests : XCTestCase 28 | 29 | /*! @brief Creates a new @c OIDTokenResponse for testing. 30 | */ 31 | + (OIDTokenResponse *)testInstance; 32 | 33 | /*! @brief Creates a new @c OIDTokenRequest for testing the code exchange. 34 | @see https://tools.ietf.org/html/rfc6749#section-4.1.4 35 | */ 36 | + (OIDTokenResponse *)testInstanceCodeExchange; 37 | 38 | /*! @brief Creates a new @c OIDTokenRequest for testing the token refresh. 39 | @see https://tools.ietf.org/html/rfc6749#section-5.1 40 | */ 41 | + (OIDTokenResponse *)testInstanceRefresh; 42 | 43 | @end 44 | 45 | NS_ASSUME_NONNULL_END 46 | -------------------------------------------------------------------------------- /UnitTests/OIDTokenUtilitiesTests.m: -------------------------------------------------------------------------------- 1 | /*! @file OIDTokenUtilities.m 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2018 The AppAuth for iOS Authors. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | #if SWIFT_PACKAGE 22 | @import AppAuthCore; 23 | #else 24 | #import "Sources/AppAuthCore/OIDTokenUtilities.h" 25 | #endif 26 | 27 | @interface OIDTokenUtilitiesTests : XCTestCase 28 | @end 29 | @implementation OIDTokenUtilitiesTests 30 | 31 | - (void)testRedact { 32 | XCTAssertEqualObjects([OIDTokenUtilities redact:@"0123456789"], @"012345...[redacted]", @""); 33 | } 34 | 35 | - (void)testRedactWithNilParamater { 36 | XCTAssertEqualObjects([OIDTokenUtilities redact:nil], nil, @""); 37 | } 38 | 39 | - (void)testRedactWithEmptyString { 40 | XCTAssertEqualObjects([OIDTokenUtilities redact:@""], @"", @""); 41 | } 42 | 43 | - (void)testRedactWithShortInput { 44 | XCTAssertEqualObjects([OIDTokenUtilities redact:@"01234"], @"[redacted]", @""); 45 | } 46 | 47 | - (void)testFormUrlEncode { 48 | XCTAssertEqualObjects([OIDTokenUtilities formUrlEncode:@"t _9V-F*I+Z1Lk.u7:2/8L+w="], 49 | @"t+_9V-F*I%2BZ1Lk.u7%3A2%2F8L%2Bw%3D", @""); 50 | } 51 | 52 | - (void)testFormUrlEncodeEmptyString { 53 | XCTAssertEqualObjects([OIDTokenUtilities formUrlEncode:@""], @"", @""); 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /UnitTests/OIDURLQueryComponentTests.h: -------------------------------------------------------------------------------- 1 | /*! @file OIDURLQueryComponentTests.h 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | 21 | @interface OIDURLQueryComponentTests : XCTestCase 22 | 23 | /*! @brief Test adding a single string parameter to a query. 24 | @remarks The query should have a single string value for the specified key. 25 | */ 26 | - (void)testAddingParameter; 27 | 28 | /*! @brief Test adding two string parameters with the same key to a query. 29 | @remarks The query should have an array with both values for the specified key. 30 | */ 31 | - (void)testAddingTwoParameters; 32 | 33 | /*! @brief Test adding three string parameters with the same key to a dictionary. 34 | @remarks The dictionary should have an array with all three values for the specified key. 35 | */ 36 | - (void)testAddingThreeParameters; 37 | 38 | /*! @brief Test building a simple query string with two parameters, both strings. 39 | */ 40 | - (void)testBuildingParameterStringWithSimpleParameters; 41 | 42 | /*! @brief Test parsing a simple query string with two string parameters. 43 | */ 44 | - (void)testParsingQueryString; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /UnitTests/OIDURLQueryComponentTestsIOS7.m: -------------------------------------------------------------------------------- 1 | /*! @file OIDURLQueryComponentTestsIOS7.m 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import "OIDURLQueryComponentTests.h" 20 | 21 | #if SWIFT_PACKAGE 22 | @import AppAuthCore; 23 | #else 24 | #import "Sources/AppAuthCore/OIDURLQueryComponent.h" 25 | #endif 26 | 27 | // Ignore warnings about "Use of GNU statement expression extension" which is raised by our use of 28 | // the XCTAssert___ macros. 29 | #pragma GCC diagnostic push 30 | #pragma GCC diagnostic ignored "-Wgnu" 31 | 32 | @interface OIDURLQueryComponentTestsIOS7 : OIDURLQueryComponentTests 33 | @end 34 | 35 | @implementation OIDURLQueryComponentTestsIOS7 36 | 37 | - (void)setUp { 38 | [super setUp]; 39 | gOIDURLQueryComponentForceIOS7Handling = YES; 40 | } 41 | 42 | - (void)tearDown { 43 | gOIDURLQueryComponentForceIOS7Handling = NO; 44 | [super tearDown]; 45 | } 46 | 47 | @end 48 | 49 | #pragma GCC diagnostic pop 50 | -------------------------------------------------------------------------------- /UnitTests/OIDURLSessionProviderTests.m: -------------------------------------------------------------------------------- 1 | /*! @file OIDURLSessionProviderTests.m 2 | @brief AppAuth iOS SDK 3 | @copyright 4 | Copyright 2015 Google Inc. All Rights Reserved. 5 | @copydetails 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #import 20 | #import "OIDURLSessionProvider.h" 21 | 22 | @interface OIDURLSessionProviderTests : XCTestCase 23 | 24 | @end 25 | 26 | /*! @brief Unit tests for @c OIDURLSessionProvider. 27 | */ 28 | @implementation OIDURLSessionProviderTests 29 | 30 | - (void)tearDown { 31 | // Setting the session back to default sharedSession for future test cases 32 | [OIDURLSessionProvider setSession:[NSURLSession sharedSession]]; 33 | } 34 | 35 | - (void)testCustomSession { 36 | NSURLSessionConfiguration *config = [NSURLSessionConfiguration ephemeralSessionConfiguration]; 37 | NSURLSession *customSession = [NSURLSession sessionWithConfiguration:config]; 38 | [OIDURLSessionProvider setSession:customSession]; 39 | NSURLSession *session = [OIDURLSessionProvider session]; 40 | XCTAssertEqualObjects(session, customSession); 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /UnitTests/UnitTestsInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | --------------------------------------------------------------------------------