├── .gitignore
├── OpenIDConnectSwift
├── Assets.xcassets
│ ├── Contents.json
│ ├── api.imageset
│ │ ├── api.png
│ │ └── Contents.json
│ ├── key_circle.imageset
│ │ ├── key.png
│ │ └── Contents.json
│ ├── revoke.imageset
│ │ ├── revoke.png
│ │ └── Contents.json
│ ├── refresh.imageset
│ │ ├── api_call.png
│ │ └── Contents.json
│ ├── Reporting.imageset
│ │ ├── Reporting.png
│ │ └── Contents.json
│ ├── okta_logo.imageset
│ │ ├── logo-new.png
│ │ └── Contents.json
│ ├── ic_key.imageset
│ │ ├── MFA_for_Your_Apps.png
│ │ └── Contents.json
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── AppAuth-Bridging-Header.h
├── Models.swift
├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
├── Info.plist
├── AppDelegate.swift
├── ImageViewController.swift
└── OktaAppAuth.swift
├── README.md
├── OpenIDConnectSwift.xcodeproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── jmelberg.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── OpenIDConnectSwift.xcscmblueprint
└── project.pbxproj
├── Podfile
├── LICENSE
└── THIRD_PARTY_NOTICES
/.gitignore:
--------------------------------------------------------------------------------
1 | OpenIDConnectSwift.xcworkspace/
2 | xcuserdata/
3 | /Pods
4 | Podfile.lock
5 | .DS_Store
6 | *.
--------------------------------------------------------------------------------
/OpenIDConnectSwift/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # This sample has moved!
2 | You can find the lastest version of this sample application over in our [Okta + AppAuth iOS SDK](https://github.com/okta/okta-sdk-appauth-ios).
--------------------------------------------------------------------------------
/OpenIDConnectSwift/Assets.xcassets/api.imageset/api.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oktadev/okta-openidconnect-appauth-ios/HEAD/OpenIDConnectSwift/Assets.xcassets/api.imageset/api.png
--------------------------------------------------------------------------------
/OpenIDConnectSwift/AppAuth-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #ifndef AppAuth_Bridging_Header_h
2 | #define AppAuth_Bridging_Header_h
3 |
4 | #import "AppAuth.h"
5 |
6 | #endif /* AppAuth_Bridging_Header_h */
7 |
--------------------------------------------------------------------------------
/OpenIDConnectSwift/Assets.xcassets/key_circle.imageset/key.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oktadev/okta-openidconnect-appauth-ios/HEAD/OpenIDConnectSwift/Assets.xcassets/key_circle.imageset/key.png
--------------------------------------------------------------------------------
/OpenIDConnectSwift/Assets.xcassets/revoke.imageset/revoke.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oktadev/okta-openidconnect-appauth-ios/HEAD/OpenIDConnectSwift/Assets.xcassets/revoke.imageset/revoke.png
--------------------------------------------------------------------------------
/OpenIDConnectSwift/Assets.xcassets/refresh.imageset/api_call.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oktadev/okta-openidconnect-appauth-ios/HEAD/OpenIDConnectSwift/Assets.xcassets/refresh.imageset/api_call.png
--------------------------------------------------------------------------------
/OpenIDConnectSwift/Assets.xcassets/Reporting.imageset/Reporting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oktadev/okta-openidconnect-appauth-ios/HEAD/OpenIDConnectSwift/Assets.xcassets/Reporting.imageset/Reporting.png
--------------------------------------------------------------------------------
/OpenIDConnectSwift/Assets.xcassets/okta_logo.imageset/logo-new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oktadev/okta-openidconnect-appauth-ios/HEAD/OpenIDConnectSwift/Assets.xcassets/okta_logo.imageset/logo-new.png
--------------------------------------------------------------------------------
/OpenIDConnectSwift/Assets.xcassets/ic_key.imageset/MFA_for_Your_Apps.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oktadev/okta-openidconnect-appauth-ios/HEAD/OpenIDConnectSwift/Assets.xcassets/ic_key.imageset/MFA_for_Your_Apps.png
--------------------------------------------------------------------------------
/OpenIDConnectSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OpenIDConnectSwift.xcodeproj/project.xcworkspace/xcuserdata/jmelberg.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oktadev/okta-openidconnect-appauth-ios/HEAD/OpenIDConnectSwift.xcodeproj/project.xcworkspace/xcuserdata/jmelberg.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '9.0'
3 |
4 | target 'OpenIDConnectSwift' do
5 | # Comment this line if you're not using Swift and don't want to use dynamic frameworks
6 | use_frameworks!
7 |
8 | # Pods for OpenIDConnectSwift
9 | pod 'AppAuth'
10 |
11 | end
12 |
--------------------------------------------------------------------------------
/OpenIDConnectSwift/Assets.xcassets/api.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "api.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenIDConnectSwift/Assets.xcassets/revoke.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "revoke.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenIDConnectSwift/Assets.xcassets/key_circle.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "key.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenIDConnectSwift/Assets.xcassets/okta_logo.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "logo-new.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenIDConnectSwift/Assets.xcassets/refresh.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "api_call.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenIDConnectSwift/Assets.xcassets/Reporting.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "Reporting.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenIDConnectSwift/Assets.xcassets/ic_key.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "MFA_for_Your_Apps.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenIDConnectSwift/Models.swift:
--------------------------------------------------------------------------------
1 | /** Author: Jordan Melberg **/
2 |
3 | /** Copyright © 2016, Okta, Inc.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | import Foundation
19 |
20 | class OktaConfiguration {
21 | let kIssuer: String!
22 | let kClientID: String!
23 | let kRedirectURI: String!
24 | let kAppAuthExampleAuthStateKey: String!
25 | let apiEndpoint: URL!
26 |
27 | init(){
28 | kIssuer = "https://example.oktapreview.com" // Base url of Okta Developer domain
29 | kClientID = "applicationClientId" // Client ID of Application
30 | apiEndpoint = URL(string: "https://example.com/protected") // Resource Server URL
31 | kRedirectURI = "com.oktapreview.{yourOrg}:/callback"
32 | kAppAuthExampleAuthStateKey = "com.okta.openid.authState"
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/OpenIDConnectSwift/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "ipad",
35 | "size" : "29x29",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "ipad",
40 | "size" : "29x29",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "40x40",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "40x40",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "76x76",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "76x76",
61 | "scale" : "2x"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "size" : "83.5x83.5",
66 | "scale" : "2x"
67 | }
68 | ],
69 | "info" : {
70 | "version" : 1,
71 | "author" : "xcode"
72 | }
73 | }
--------------------------------------------------------------------------------
/OpenIDConnectSwift/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 |
27 |
--------------------------------------------------------------------------------
/OpenIDConnectSwift.xcodeproj/project.xcworkspace/xcshareddata/OpenIDConnectSwift.xcscmblueprint:
--------------------------------------------------------------------------------
1 | {
2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "512EC7E7FDED77AECD3A591C668F2AA95D974C50",
3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : {
4 |
5 | },
6 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
7 | "512EC7E7FDED77AECD3A591C668F2AA95D974C50" : 9223372036854775807,
8 | "91371A19D78094A51344C695621BF3993163597B" : 9223372036854775807
9 | },
10 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "5C2C0B8A-5694-46B9-A69E-035F957E9F47",
11 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
12 | "512EC7E7FDED77AECD3A591C668F2AA95D974C50" : "okta-openidconnect-appauth-ios\/",
13 | "91371A19D78094A51344C695621BF3993163597B" : ".."
14 | },
15 | "DVTSourceControlWorkspaceBlueprintNameKey" : "OpenIDConnectSwift",
16 | "DVTSourceControlWorkspaceBlueprintVersion" : 204,
17 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "OpenIDConnectSwift.xcodeproj",
18 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [
19 | {
20 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:oktadeveloper\/okta-openidconnect-appauth-ios.git",
21 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "512EC7E7FDED77AECD3A591C668F2AA95D974C50"
23 | },
24 | {
25 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:jmelberg-okta\/acmeHealth-aws-lambda-dynamodb.git",
26 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
27 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "91371A19D78094A51344C695621BF3993163597B"
28 | }
29 | ]
30 | }
--------------------------------------------------------------------------------
/OpenIDConnectSwift/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.okta.example
29 |
30 |
31 |
32 | CFBundleVersion
33 | 1
34 | LSRequiresIPhoneOS
35 |
36 | UILaunchStoryboardName
37 | LaunchScreen
38 | UIMainStoryboardFile
39 | Main
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 |
58 |
59 |
--------------------------------------------------------------------------------
/OpenIDConnectSwift/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | /** Author: Jordan Melberg **/
2 |
3 | /** Copyright © 2016, Okta, Inc.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | import UIKit
19 | import AppAuth
20 |
21 | @UIApplicationMain
22 | class AppDelegate: UIResponder, UIApplicationDelegate {
23 |
24 | var window: UIWindow?
25 |
26 | var currentAuthorizationFlow: OIDAuthorizationFlowSession?
27 |
28 |
29 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
30 | // Override point for customization after application launch.
31 | return true
32 | }
33 |
34 | func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool {
35 | if currentAuthorizationFlow!.resumeAuthorizationFlow(with: url){
36 | currentAuthorizationFlow = nil
37 | return true
38 | }
39 | return false
40 | }
41 |
42 | func applicationWillResignActive(_ application: UIApplication) {
43 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
44 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
45 | }
46 |
47 | func applicationDidEnterBackground(_ application: UIApplication) {
48 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
49 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
50 | }
51 |
52 | func applicationWillEnterForeground(_ application: UIApplication) {
53 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
54 | }
55 |
56 | func applicationDidBecomeActive(_ application: UIApplication) {
57 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
58 | }
59 |
60 | func applicationWillTerminate(_ application: UIApplication) {
61 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
62 | }
63 |
64 |
65 | }
66 |
67 |
--------------------------------------------------------------------------------
/OpenIDConnectSwift/ImageViewController.swift:
--------------------------------------------------------------------------------
1 | /** Author: Jordan Melberg **/
2 |
3 | /** Copyright © 2016, Okta, Inc.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | import UIKit
19 | import AppAuth
20 |
21 | class ImageViewController: UIViewController {
22 |
23 | // MARK: Properties
24 | @IBOutlet weak var image: UIImageView!
25 | @IBOutlet weak var activityLoad: UIActivityIndicatorView!
26 | @IBOutlet weak var imageText: UILabel!
27 |
28 | // Retrieve from segue needed request values
29 | var authState:OIDAuthState?
30 | var appConfig = OktaConfiguration()
31 |
32 | override func viewDidLoad() {
33 | super.viewDidLoad()
34 | activityLoad.startAnimating()
35 | sendDemoApiRequest(appConfig.apiEndpoint! as URL, accessToken: (authState?.lastTokenResponse!.accessToken)!)
36 | }
37 |
38 | override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() }
39 |
40 | /**
41 | * Calls endpoint on given server to decode and validate access token
42 | *
43 | * - parameters:
44 | * - url: NSURL of server endpoint
45 | * - accessToken: Current token
46 | */
47 | func sendDemoApiRequest(_ url: URL, accessToken: String){
48 | print("Performing DEMO API request without auto-refresh")
49 |
50 | // Create Requst to Demo API endpoint, with access_token in Authorization Header
51 | var request = URLRequest(url: url)
52 | request.httpMethod = "GET"
53 |
54 | let authorizationHeaderValue = "Bearer \(accessToken)"
55 | request.addValue(authorizationHeaderValue, forHTTPHeaderField: "Authorization")
56 |
57 | let config = URLSessionConfiguration.default
58 | let session = URLSession(configuration: config)
59 |
60 | //Perform HTTP Request
61 | let postDataTask = session.dataTask(with: request, completionHandler: {
62 | data, response, error in
63 | DispatchQueue.main.async{
64 |
65 | if let httpResponse = response as? HTTPURLResponse {
66 | do{
67 | let jsonDictionaryOrArray = try JSONSerialization.jsonObject(with: data!, options: []) as! [String:Any]
68 | if ( httpResponse.statusCode != 200 ){
69 | let responseText = NSString(data: data!, encoding: String.Encoding.utf8.rawValue)
70 | if ( httpResponse.statusCode == 401 ){
71 | let oauthError = OIDErrorUtilities.resourceServerAuthorizationError(withCode: 0,
72 | errorResponse: jsonDictionaryOrArray,
73 | underlyingError: error)
74 | self.authState?.update(withAuthorizationError: oauthError!)
75 | print("Authorization Error (\(oauthError)). Response: \(responseText)")
76 | }
77 | else{ print("HTTP: \(httpResponse.statusCode). Response: \(responseText)") }
78 | return
79 | }
80 | if let imageURL = jsonDictionaryOrArray["image"] as? String{
81 | if let name = jsonDictionaryOrArray["name"] as? NSString{
82 | self.loadImageFromURL(imageURL, name: name as String)
83 | print("\(jsonDictionaryOrArray)")
84 | }
85 | }
86 | else if jsonDictionaryOrArray["Error"] != nil{
87 | self.imageText.text = jsonDictionaryOrArray["Error"] as? String
88 | self.activityLoad.stopAnimating()
89 | print(jsonDictionaryOrArray["Error"]!)
90 | print("\(jsonDictionaryOrArray)")
91 | }
92 | } catch {
93 | print("Error while serializing data to JSON")
94 | self.dismiss(animated: true, completion: nil)
95 | }
96 | } else {
97 | print("Non-HTTP response \(error)")
98 | return
99 | }
100 | }
101 | })
102 | postDataTask.resume()
103 | }
104 |
105 | /**
106 | * Loads ImageView and ImageText from response object
107 | *
108 | * - parameters:
109 | * - url: Url of image path
110 | * - name: Name of user
111 | */
112 | func loadImageFromURL(_ url: String, name: String){
113 | print("url: \(url)")
114 | if let userImageURL = URL(string: url){
115 | let data = try? Data(contentsOf: userImageURL)
116 | if (data != nil){
117 | self.image.image = UIImage(data: data!)
118 | self.imageText.text = name
119 | self.activityLoad.stopAnimating()
120 | } else { return }
121 |
122 | }
123 | }
124 |
125 | /** Dismisses ImageViewController */
126 | @IBAction func backButton(_ sender: AnyObject) {
127 | self.dismiss(animated: true, completion: nil)
128 | }
129 | }
130 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Okta iOS Native Application with AppAuth License
2 |
3 | The Okta software accompanied by this notice is provided pursuant to the
4 | following terms:
5 |
6 | Copyright © 2016, Okta, Inc.
7 |
8 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use
9 | this file except in compliance with the License. You may obtain a copy of the
10 | License at http://www.apache.org/licenses/LICENSE-2.0. Unless required by
11 | applicable law or agreed to in writing, software distributed under the License
12 | is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
13 | KIND, either express or implied. See the License for the specific language
14 | governing permissions and limitations under the License.
15 |
16 | The Okta software accompanied by this notice has build dependencies on certain
17 | third party software licensed under separate terms ("Third Party Components")
18 | located in THIRD_PARTY_NOTICES.
19 |
20 |
21 | Apache License
22 | Version 2.0, January 2004
23 | http://www.apache.org/licenses/
24 |
25 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
26 |
27 | 1. Definitions.
28 |
29 | "License" shall mean the terms and conditions for use, reproduction, and
30 | distribution as defined by Sections 1 through 9 of this document.
31 |
32 | "Licensor" shall mean the copyright owner or entity authorized by the copyright
33 | owner that is granting the License.
34 |
35 | "Legal Entity" shall mean the union of the acting entity and all other entities
36 | that control, are controlled by, or are under common control with that entity.
37 | For the purposes of this definition, "control" means (i) the power, direct or
38 | indirect, to cause the direction or management of such entity, whether by
39 | contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
40 | outstanding shares, or (iii) beneficial ownership of such entity.
41 |
42 | You" (or "Your") shall mean an individual or Legal Entity exercising
43 | permissions granted by this License.
44 |
45 | "Source" form shall mean the preferred form for making modifications, including
46 | but not limited to software source code, documentation source, and
47 | configuration files.
48 |
49 | "Object" form shall mean any form resulting from mechanical transformation or
50 | translation of a Source form, including but not limited to compiled object
51 | code, generated documentation, and conversions to other media types.
52 |
53 | "Work" shall mean the work of authorship, whether in Source or Object form,
54 | made available under the License, as indicated by a copyright notice that is
55 | included in or attached to the work (an example is provided in the Appendix
56 | below).
57 |
58 | "Derivative Works" shall mean any work, whether in Source or Object form, that
59 | is based on (or derived from) the Work and for which the editorial revisions,
60 | annotations, elaborations, or other modifications represent, as a whole, an
61 | original work of authorship. For the purposes of this License, Derivative Works
62 | shall not include works that remain separable from, or merely link (or bind by
63 | name) to the interfaces of, the Work and Derivative Works thereof.
64 |
65 | "Contribution" shall mean any work of authorship, including the original
66 | version of the Work and any modifications or additions to that Work or
67 | Derivative Works thereof, that is intentionally submitted to Licensor for
68 | inclusion in the Work by the copyright owner or by an individual or Legal
69 | Entity authorized to submit on behalf of the copyright owner. For the purposes
70 | of this definition, "submitted" means any form of electronic, verbal, or
71 | written communication sent to the Licensor or its representatives, including
72 | but not limited to communication on electronic mailing lists, source code
73 | control systems, and issue tracking systems that are managed by, or on behalf
74 | of, the Licensor for the purpose of discussing and improving the Work, but
75 | excluding communication that is conspicuously marked or otherwise designated in
76 | writing by the copyright owner as "Not a Contribution."
77 |
78 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
79 | of whom a Contribution has been received by Licensor and subsequently
80 | incorporated within the Work.
81 | 2. Grant of Copyright License. Subject to the terms and conditions of this
82 | License, each Contributor hereby grants to You a perpetual, worldwide,
83 | non-exclusive, no-charge, royalty-free, irrevocable copyright license to
84 | reproduce, prepare Derivative Works of, publicly display, publicly perform,
85 | sublicense, and distribute the Work and such Derivative Works in Source or
86 | Object form.
87 |
88 | 3. Grant of Patent License. Subject to the terms and conditions of this
89 | License, each Contributor hereby grants to You a perpetual, worldwide,
90 | non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
91 | section) patent license to make, have made, use, offer to sell, sell, import,
92 | and otherwise transfer the Work, where such license applies only to those
93 | patent claims licensable by such Contributor that are necessarily infringed by
94 | their Contribution(s) alone or by combination of their Contribution(s) with the
95 | Work to which such Contribution(s) was submitted. If You institute patent
96 | litigation against any entity (including a cross-claim or counterclaim in a
97 | lawsuit) alleging that the Work or a Contribution incorporated within the Work
98 | constitutes direct or contributory patent infringement, then any patent
99 | licenses granted to You under this License for that Work shall terminate as of
100 | the date such litigation is filed.
101 |
102 | 4. Redistribution. You may reproduce and distribute copies of the Work or
103 | Derivative Works thereof in any medium, with or without modifications, and in
104 | Source or Object form, provided that You meet the following conditions:
105 |
106 | (a) You must give any other recipients of the Work or Derivative Works a copy
107 | of this License; and
108 |
109 | (b) You must cause any modified files to carry prominent notices stating that
110 | You changed the files; and
111 |
112 | (c) You must retain, in the Source form of any Derivative Works that You
113 | distribute, all copyright, patent, trademark, and attribution notices from the
114 | Source form of the Work, excluding those notices that do not pertain to any
115 | part of the Derivative Works; and
116 |
117 | (d) If the Work includes a "NOTICE" text file as part of its distribution, then
118 | any Derivative Works that You distribute must include a readable copy of the
119 | attribution notices contained within such NOTICE file, excluding those notices
120 | that do not pertain to any part of the Derivative Works, in at least one of the
121 | following places: within a NOTICE text file distributed as part of the
122 | Derivative Works; within the Source form or documentation, if provided along
123 | with the Derivative Works; or, within a display generated by the Derivative
124 | Works, if and wherever such third-party notices normally appear. The contents
125 | of the NOTICE file are for informational purposes only and do not modify the
126 | License. You may add Your own attribution notices within Derivative Works that
127 | You distribute, alongside or as an addendum to the NOTICE text from the Work,
128 | provided that such additional attribution notices cannot be construed as
129 | modifying the License.
130 |
131 | You may add Your own copyright statement to Your modifications and may provide
132 | additional or different license terms and conditions for use, reproduction, or
133 | distribution of Your modifications, or for any such Derivative Works as a
134 | whole, provided Your use, reproduction, and distribution of the Work otherwise
135 | complies with the conditions stated in this License.
136 |
137 | 5. Submission of Contributions. Unless You explicitly state otherwise, any
138 | Contribution intentionally submitted for inclusion in the Work by You to the
139 | Licensor shall be under the terms and conditions of this License, without any
140 | additional terms or conditions. Notwithstanding the above, nothing herein shall
141 | supersede or modify the terms of any separate license agreement you may have
142 | executed with Licensor regarding such Contributions.
143 |
144 | 6. Trademarks. This License does not grant permission to use the trade names,
145 | trademarks, service marks, or product names of the Licensor, except as required
146 | for reasonable and customary use in describing the origin of the Work and
147 | reproducing the content of the NOTICE file.
148 |
149 | 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
150 | writing, Licensor provides the Work (and each Contributor provides its
151 | Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
152 | KIND, either express or implied, including, without limitation, any warranties
153 | or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
154 | PARTICULAR PURPOSE. You are solely responsible for determining the
155 | appropriateness of using or redistributing the Work and assume any risks
156 | associated with Your exercise of permissions under this License.
157 |
158 | 8. Limitation of Liability. In no event and under no legal theory, whether in
159 | tort (including negligence), contract, or otherwise, unless required by
160 | applicable law (such as deliberate and grossly negligent acts) or agreed to in
161 | writing, shall any Contributor be liable to You for damages, including any
162 | direct, indirect, special, incidental, or consequential damages of any
163 | character arising as a result of this License or out of the use or inability to
164 | use the Work (including but not limited to damages for loss of goodwill, work
165 | stoppage, computer failure or malfunction, or any and all other commercial
166 | damages or losses), even if such Contributor has been advised of the
167 | possibility of such damages.
168 |
169 | 9. Accepting Warranty or Additional Liability. While redistributing the Work or
170 | Derivative Works thereof, You may choose to offer, and charge a fee for,
171 | acceptance of support, warranty, indemnity, or other liability obligations
172 | and/or rights consistent with this License. However, in accepting such
173 | obligations, You may act only on Your own behalf and on Your sole
174 | responsibility, not on behalf of any other Contributor, and only if You agree
175 | to indemnify, defend, and hold each Contributor harmless for any liability
176 | incurred by, or claims asserted against, such Contributor by reason of your
177 | accepting any such warranty or additional liability.
178 |
179 | END OF TERMS AND CONDITIONS
180 |
181 | APPENDIX: How to apply the Apache License to your work.
182 |
183 | To apply the Apache License to your work, attach the following boilerplate
184 | notice, with the fields enclosed by brackets "[]" replaced with your own
185 | identifying information. (Don't include the brackets!) The text should be
186 | enclosed in the appropriate comment syntax for the file format. We also
187 | recommend that a file or class name and description of purpose be included on
188 | the same "printed page" as the copyright notice for easier identification
189 | within third-party archives.
190 |
--------------------------------------------------------------------------------
/THIRD_PARTY_NOTICES:
--------------------------------------------------------------------------------
1 | This document contains third party open source licenses and notices for the Okta OpenID Mobile iOS product. Certain licenses and notices may appear in other parts of the product in accordance with the applicable license requirements.
2 |
3 | The Okta product that this document references does not necessarily use all the open source software packages referred to below and may also only use portions of a given package.
4 |
5 | Third Party Notices
6 | -------------------
7 |
8 | Google AppAuth for iOS
9 | Version (if any):
10 | Brief Description: AppAuth for iOS is a client SDK for communicating with OAuth 2.0 and OpenID Connect providers. It strives to directly map the requests and responses of those specifications, while following the idiomatic style of the implementation language. In addition to mapping the raw protocol flows, convenience methods are available to assist with common tasks like performing an action with fresh tokens.
11 | License: Apache 2.0
12 |
13 | Copyright (c) 2015 Google, Inc. All rights reserved.
14 |
15 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
16 |
17 | You may obtain a copy of the License at
18 |
19 | http://www.apache.org/licenses/LICENSE-2.0
20 |
21 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
22 |
23 | See Open Source Licenses below for complete copy of the Apache 2.0 license.
24 |
25 | --------------------------------------------------------------------------
26 |
27 | Open Source Licenses
28 | -------------------
29 |
30 | APACHE LICENSE
31 |
32 | Version 2.0, January 2004
33 |
34 | http://www.apache.org/licenses/
35 |
36 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
37 |
38 | 1. Definitions.
39 |
40 | "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
41 |
42 | "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
43 |
44 | "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
45 |
46 | "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
47 |
48 | "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
49 |
50 | "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
51 |
52 | "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
53 |
54 | "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
55 |
56 | "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
57 |
58 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
59 |
60 | 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
61 |
62 | 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
63 |
64 | 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
65 |
66 | a. You must give any other recipients of the Work or Derivative Works a copy of this License; and
67 | b. You must cause any modified files to carry prominent notices stating that You changed the files; and
68 | c. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
69 | d. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
70 |
71 | You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
72 |
73 | 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
74 |
75 | 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
76 |
77 | 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
78 |
79 | 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
80 |
81 | 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
82 |
83 | END OF TERMS AND CONDITIONS
84 |
85 | APPENDIX: HOW TO APPLY THE APACHE LICENSE TO YOUR WORK
86 |
87 | To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
88 |
89 | Copyright [yyyy] [name of copyright owner]
90 |
91 | Licensed under the Apache License, Version 2.0 (the "License");
92 | you may not use this file except in compliance with the License.
93 | You may obtain a copy of the License at
94 |
95 | http://www.apache.org/licenses/LICENSE-2.0
96 |
97 | Unless required by applicable law or agreed to in writing, software
98 | distributed under the License is distributed on an "AS IS" BASIS,
99 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
100 | See the License for the specific language governing permissions and
101 | limitations under the License.
102 |
103 | --------------------------------------------------------------------------
104 |
105 | Disclaimer and Limitation of Liability
106 |
107 | Disclaimer. OKTA AND ITS SUPPLIERS HEREBY DISCLAIM ALL (AND HAVE NOT AUTHORIZED ANYONE TO MAKE ANY) WARRANTIES EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTIES OF NON-INFRINGEMENT OF THIRD PARTY RIGHTS WITH RESPECT TO OPEN SOURCE SOFTWARE, TITLE, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE PARTIES ARE NOT RELYING AND HAVE NOT RELIED ON ANY REPRESENTATIONS OR WARRANTIES WHATSOEVER REGARDING OKTA AND OKTA MAKES NO WARRANTY REGARDING ANY THIRD PARTY SOFTWARE.
108 |
109 | Limitation of Liability. OKTA AND ITS SUPPLIERS, SHALL NOT BE RESPONSIBLE OR LIABLE UNDER ANY CONTRACT, NEGLIGENCE, STRICT LIABILITY OR OTHER THEORY ARISING OUT OF OR RELATED TO OPEN SOURCE SOFWARE (A) FOR ERROR OR INTERRUPTION OF USE, LOSS OR INACCURACY OR CORRUPTION OF DATA, (B) FOR COST OF PROCUREMENT OF SUBSTITUTE GOODS, SERVICES, RIGHTS, OR TECHNOLOGY, (C) FOR ANY LOST PROFITS OR REVENUES, OR FOR ANY INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL OR PUNITIVE DAMAGES, WHETHER OR NOT A OKTA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
110 | IN NO EVENT WILL OKTA NOR ITS SUPPLIER’S AGGREGATE AND CUMULATIVE LIABILITY FOR ANY CLAIMS ARISING OUT OF OR RELATED TO OPEN SOURCE SOFTWARE EXCEED ONE HUNDRED DOLLARS ($100).
111 |
112 | Any provisions provided by Okta which differ from those in any third party license are provided by Okta alone.
113 |
114 | --------------------------------------------------------------------------
115 |
116 | GPL Licensed Software
117 |
118 | If applicable and to the extent any open source components are licensed under the GPL and/or LGPL, or other similar license that require the source code and/or modifications to source code to be made available (as noted above), a copy of the source code corresponding to the binaries for such open source components and modifications thereto, if any, may be obtained by downloading the source code or by sending a request, with your name and address to: Okta, Inc., 301 Brannan Street, Suite 100, San Francisco, CA 94107. All open source requests should clearly specify: OPEN SOURCE REQUEST, Attention General Counsel and the name of the requested component and Okta product. Okta will mail a copy of the source code to you on a CD or equivalent physical medium. This offer to obtain a copy of the source code is valid for three (3) years from the date you acquired this Okta product. Alternatively, the open source may accompany the Okta product.
119 |
--------------------------------------------------------------------------------
/OpenIDConnectSwift.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 28E3361AC4833E92B700318F /* Pods_OpenIDConnectSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D4F2115040DA5DDAA9217F3D /* Pods_OpenIDConnectSwift.framework */; };
11 | 710124B31D11BCD9009F420A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 710124B21D11BCD9009F420A /* AppDelegate.swift */; };
12 | 710124B51D11BCD9009F420A /* OktaAppAuth.swift in Sources */ = {isa = PBXBuildFile; fileRef = 710124B41D11BCD9009F420A /* OktaAppAuth.swift */; };
13 | 710124B81D11BCD9009F420A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 710124B61D11BCD9009F420A /* Main.storyboard */; };
14 | 710124BA1D11BCD9009F420A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 710124B91D11BCD9009F420A /* Assets.xcassets */; };
15 | 710124BD1D11BCD9009F420A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 710124BB1D11BCD9009F420A /* LaunchScreen.storyboard */; };
16 | 710124C61D11DBD8009F420A /* Models.swift in Sources */ = {isa = PBXBuildFile; fileRef = 710124C51D11DBD8009F420A /* Models.swift */; };
17 | 71724C261D189D2F00077380 /* ImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71724C251D189D2F00077380 /* ImageViewController.swift */; };
18 | /* End PBXBuildFile section */
19 |
20 | /* Begin PBXFileReference section */
21 | 08D36EB095FD9E1BF02D1FE7 /* Pods-OpenIDConnectSwift.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OpenIDConnectSwift.release.xcconfig"; path = "Pods/Target Support Files/Pods-OpenIDConnectSwift/Pods-OpenIDConnectSwift.release.xcconfig"; sourceTree = ""; };
22 | 710124AF1D11BCD9009F420A /* OpenIDConnectSwift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OpenIDConnectSwift.app; sourceTree = BUILT_PRODUCTS_DIR; };
23 | 710124B21D11BCD9009F420A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
24 | 710124B41D11BCD9009F420A /* OktaAppAuth.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OktaAppAuth.swift; sourceTree = ""; };
25 | 710124B71D11BCD9009F420A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
26 | 710124B91D11BCD9009F420A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
27 | 710124BC1D11BCD9009F420A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
28 | 710124BE1D11BCD9009F420A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
29 | 710124C41D11BDB9009F420A /* AppAuth-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AppAuth-Bridging-Header.h"; sourceTree = ""; };
30 | 710124C51D11DBD8009F420A /* Models.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Models.swift; sourceTree = ""; };
31 | 71724C251D189D2F00077380 /* ImageViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageViewController.swift; sourceTree = ""; };
32 | D4F2115040DA5DDAA9217F3D /* Pods_OpenIDConnectSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_OpenIDConnectSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };
33 | DAB41A5EFBA638662D974B56 /* Pods-OpenIDConnectSwift.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OpenIDConnectSwift.debug.xcconfig"; path = "Pods/Target Support Files/Pods-OpenIDConnectSwift/Pods-OpenIDConnectSwift.debug.xcconfig"; sourceTree = ""; };
34 | /* End PBXFileReference section */
35 |
36 | /* Begin PBXFrameworksBuildPhase section */
37 | 710124AC1D11BCD9009F420A /* Frameworks */ = {
38 | isa = PBXFrameworksBuildPhase;
39 | buildActionMask = 2147483647;
40 | files = (
41 | 28E3361AC4833E92B700318F /* Pods_OpenIDConnectSwift.framework in Frameworks */,
42 | );
43 | runOnlyForDeploymentPostprocessing = 0;
44 | };
45 | /* End PBXFrameworksBuildPhase section */
46 |
47 | /* Begin PBXGroup section */
48 | 32339B293EFBDE1B9CF3EB1E /* Pods */ = {
49 | isa = PBXGroup;
50 | children = (
51 | DAB41A5EFBA638662D974B56 /* Pods-OpenIDConnectSwift.debug.xcconfig */,
52 | 08D36EB095FD9E1BF02D1FE7 /* Pods-OpenIDConnectSwift.release.xcconfig */,
53 | );
54 | name = Pods;
55 | sourceTree = "";
56 | };
57 | 710124A61D11BCD9009F420A = {
58 | isa = PBXGroup;
59 | children = (
60 | 710124B11D11BCD9009F420A /* OpenIDConnectSwift */,
61 | 710124B01D11BCD9009F420A /* Products */,
62 | 32339B293EFBDE1B9CF3EB1E /* Pods */,
63 | CBDC35AF8987EAEE5B45C0F9 /* Frameworks */,
64 | );
65 | sourceTree = "";
66 | };
67 | 710124B01D11BCD9009F420A /* Products */ = {
68 | isa = PBXGroup;
69 | children = (
70 | 710124AF1D11BCD9009F420A /* OpenIDConnectSwift.app */,
71 | );
72 | name = Products;
73 | sourceTree = "";
74 | };
75 | 710124B11D11BCD9009F420A /* OpenIDConnectSwift */ = {
76 | isa = PBXGroup;
77 | children = (
78 | 710124B21D11BCD9009F420A /* AppDelegate.swift */,
79 | 710124B41D11BCD9009F420A /* OktaAppAuth.swift */,
80 | 710124B61D11BCD9009F420A /* Main.storyboard */,
81 | 710124B91D11BCD9009F420A /* Assets.xcassets */,
82 | 710124BB1D11BCD9009F420A /* LaunchScreen.storyboard */,
83 | 710124BE1D11BCD9009F420A /* Info.plist */,
84 | 710124C41D11BDB9009F420A /* AppAuth-Bridging-Header.h */,
85 | 710124C51D11DBD8009F420A /* Models.swift */,
86 | 71724C251D189D2F00077380 /* ImageViewController.swift */,
87 | );
88 | path = OpenIDConnectSwift;
89 | sourceTree = "";
90 | };
91 | CBDC35AF8987EAEE5B45C0F9 /* Frameworks */ = {
92 | isa = PBXGroup;
93 | children = (
94 | D4F2115040DA5DDAA9217F3D /* Pods_OpenIDConnectSwift.framework */,
95 | );
96 | name = Frameworks;
97 | sourceTree = "";
98 | };
99 | /* End PBXGroup section */
100 |
101 | /* Begin PBXNativeTarget section */
102 | 710124AE1D11BCD9009F420A /* OpenIDConnectSwift */ = {
103 | isa = PBXNativeTarget;
104 | buildConfigurationList = 710124C11D11BCD9009F420A /* Build configuration list for PBXNativeTarget "OpenIDConnectSwift" */;
105 | buildPhases = (
106 | A2EBECFD934D16C11CF8EB95 /* [CP] Check Pods Manifest.lock */,
107 | 710124AB1D11BCD9009F420A /* Sources */,
108 | 710124AC1D11BCD9009F420A /* Frameworks */,
109 | 710124AD1D11BCD9009F420A /* Resources */,
110 | 6A0C7B6E4671715FAE179913 /* [CP] Embed Pods Frameworks */,
111 | 5A6523A92FE01F9066BE9905 /* [CP] Copy Pods Resources */,
112 | );
113 | buildRules = (
114 | );
115 | dependencies = (
116 | );
117 | name = OpenIDConnectSwift;
118 | productName = OpenIDConnectSwift;
119 | productReference = 710124AF1D11BCD9009F420A /* OpenIDConnectSwift.app */;
120 | productType = "com.apple.product-type.application";
121 | };
122 | /* End PBXNativeTarget section */
123 |
124 | /* Begin PBXProject section */
125 | 710124A71D11BCD9009F420A /* Project object */ = {
126 | isa = PBXProject;
127 | attributes = {
128 | LastSwiftUpdateCheck = 0730;
129 | LastUpgradeCheck = 0730;
130 | ORGANIZATIONNAME = "Jordan Melberg";
131 | TargetAttributes = {
132 | 710124AE1D11BCD9009F420A = {
133 | CreatedOnToolsVersion = 7.3.1;
134 | LastSwiftMigration = 0820;
135 | };
136 | };
137 | };
138 | buildConfigurationList = 710124AA1D11BCD9009F420A /* Build configuration list for PBXProject "OpenIDConnectSwift" */;
139 | compatibilityVersion = "Xcode 3.2";
140 | developmentRegion = English;
141 | hasScannedForEncodings = 0;
142 | knownRegions = (
143 | en,
144 | Base,
145 | );
146 | mainGroup = 710124A61D11BCD9009F420A;
147 | productRefGroup = 710124B01D11BCD9009F420A /* Products */;
148 | projectDirPath = "";
149 | projectRoot = "";
150 | targets = (
151 | 710124AE1D11BCD9009F420A /* OpenIDConnectSwift */,
152 | );
153 | };
154 | /* End PBXProject section */
155 |
156 | /* Begin PBXResourcesBuildPhase section */
157 | 710124AD1D11BCD9009F420A /* Resources */ = {
158 | isa = PBXResourcesBuildPhase;
159 | buildActionMask = 2147483647;
160 | files = (
161 | 710124BD1D11BCD9009F420A /* LaunchScreen.storyboard in Resources */,
162 | 710124BA1D11BCD9009F420A /* Assets.xcassets in Resources */,
163 | 710124B81D11BCD9009F420A /* Main.storyboard in Resources */,
164 | );
165 | runOnlyForDeploymentPostprocessing = 0;
166 | };
167 | /* End PBXResourcesBuildPhase section */
168 |
169 | /* Begin PBXShellScriptBuildPhase section */
170 | 5A6523A92FE01F9066BE9905 /* [CP] Copy Pods Resources */ = {
171 | isa = PBXShellScriptBuildPhase;
172 | buildActionMask = 2147483647;
173 | files = (
174 | );
175 | inputPaths = (
176 | );
177 | name = "[CP] Copy Pods Resources";
178 | outputPaths = (
179 | );
180 | runOnlyForDeploymentPostprocessing = 0;
181 | shellPath = /bin/sh;
182 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-OpenIDConnectSwift/Pods-OpenIDConnectSwift-resources.sh\"\n";
183 | showEnvVarsInLog = 0;
184 | };
185 | 6A0C7B6E4671715FAE179913 /* [CP] Embed Pods Frameworks */ = {
186 | isa = PBXShellScriptBuildPhase;
187 | buildActionMask = 2147483647;
188 | files = (
189 | );
190 | inputPaths = (
191 | );
192 | name = "[CP] Embed Pods Frameworks";
193 | outputPaths = (
194 | );
195 | runOnlyForDeploymentPostprocessing = 0;
196 | shellPath = /bin/sh;
197 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-OpenIDConnectSwift/Pods-OpenIDConnectSwift-frameworks.sh\"\n";
198 | showEnvVarsInLog = 0;
199 | };
200 | A2EBECFD934D16C11CF8EB95 /* [CP] Check Pods Manifest.lock */ = {
201 | isa = PBXShellScriptBuildPhase;
202 | buildActionMask = 2147483647;
203 | files = (
204 | );
205 | inputPaths = (
206 | );
207 | name = "[CP] Check Pods Manifest.lock";
208 | outputPaths = (
209 | );
210 | runOnlyForDeploymentPostprocessing = 0;
211 | shellPath = /bin/sh;
212 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
213 | showEnvVarsInLog = 0;
214 | };
215 | /* End PBXShellScriptBuildPhase section */
216 |
217 | /* Begin PBXSourcesBuildPhase section */
218 | 710124AB1D11BCD9009F420A /* Sources */ = {
219 | isa = PBXSourcesBuildPhase;
220 | buildActionMask = 2147483647;
221 | files = (
222 | 710124C61D11DBD8009F420A /* Models.swift in Sources */,
223 | 710124B51D11BCD9009F420A /* OktaAppAuth.swift in Sources */,
224 | 71724C261D189D2F00077380 /* ImageViewController.swift in Sources */,
225 | 710124B31D11BCD9009F420A /* AppDelegate.swift in Sources */,
226 | );
227 | runOnlyForDeploymentPostprocessing = 0;
228 | };
229 | /* End PBXSourcesBuildPhase section */
230 |
231 | /* Begin PBXVariantGroup section */
232 | 710124B61D11BCD9009F420A /* Main.storyboard */ = {
233 | isa = PBXVariantGroup;
234 | children = (
235 | 710124B71D11BCD9009F420A /* Base */,
236 | );
237 | name = Main.storyboard;
238 | sourceTree = "";
239 | };
240 | 710124BB1D11BCD9009F420A /* LaunchScreen.storyboard */ = {
241 | isa = PBXVariantGroup;
242 | children = (
243 | 710124BC1D11BCD9009F420A /* Base */,
244 | );
245 | name = LaunchScreen.storyboard;
246 | sourceTree = "";
247 | };
248 | /* End PBXVariantGroup section */
249 |
250 | /* Begin XCBuildConfiguration section */
251 | 710124BF1D11BCD9009F420A /* Debug */ = {
252 | isa = XCBuildConfiguration;
253 | buildSettings = {
254 | ALWAYS_SEARCH_USER_PATHS = NO;
255 | CLANG_ANALYZER_NONNULL = YES;
256 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
257 | CLANG_CXX_LIBRARY = "libc++";
258 | CLANG_ENABLE_MODULES = YES;
259 | CLANG_ENABLE_OBJC_ARC = YES;
260 | CLANG_WARN_BOOL_CONVERSION = YES;
261 | CLANG_WARN_CONSTANT_CONVERSION = YES;
262 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
263 | CLANG_WARN_EMPTY_BODY = YES;
264 | CLANG_WARN_ENUM_CONVERSION = YES;
265 | CLANG_WARN_INT_CONVERSION = YES;
266 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
267 | CLANG_WARN_UNREACHABLE_CODE = YES;
268 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
269 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
270 | COPY_PHASE_STRIP = NO;
271 | DEBUG_INFORMATION_FORMAT = dwarf;
272 | ENABLE_STRICT_OBJC_MSGSEND = YES;
273 | ENABLE_TESTABILITY = YES;
274 | GCC_C_LANGUAGE_STANDARD = gnu99;
275 | GCC_DYNAMIC_NO_PIC = NO;
276 | GCC_NO_COMMON_BLOCKS = YES;
277 | GCC_OPTIMIZATION_LEVEL = 0;
278 | GCC_PREPROCESSOR_DEFINITIONS = (
279 | "DEBUG=1",
280 | "$(inherited)",
281 | );
282 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
283 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
284 | GCC_WARN_UNDECLARED_SELECTOR = YES;
285 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
286 | GCC_WARN_UNUSED_FUNCTION = YES;
287 | GCC_WARN_UNUSED_VARIABLE = YES;
288 | IPHONEOS_DEPLOYMENT_TARGET = 9.3;
289 | MTL_ENABLE_DEBUG_INFO = YES;
290 | ONLY_ACTIVE_ARCH = YES;
291 | SDKROOT = iphoneos;
292 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
293 | TARGETED_DEVICE_FAMILY = "1,2";
294 | };
295 | name = Debug;
296 | };
297 | 710124C01D11BCD9009F420A /* Release */ = {
298 | isa = XCBuildConfiguration;
299 | buildSettings = {
300 | ALWAYS_SEARCH_USER_PATHS = NO;
301 | CLANG_ANALYZER_NONNULL = YES;
302 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
303 | CLANG_CXX_LIBRARY = "libc++";
304 | CLANG_ENABLE_MODULES = YES;
305 | CLANG_ENABLE_OBJC_ARC = YES;
306 | CLANG_WARN_BOOL_CONVERSION = YES;
307 | CLANG_WARN_CONSTANT_CONVERSION = YES;
308 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
309 | CLANG_WARN_EMPTY_BODY = YES;
310 | CLANG_WARN_ENUM_CONVERSION = YES;
311 | CLANG_WARN_INT_CONVERSION = YES;
312 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
313 | CLANG_WARN_UNREACHABLE_CODE = YES;
314 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
315 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
316 | COPY_PHASE_STRIP = NO;
317 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
318 | ENABLE_NS_ASSERTIONS = NO;
319 | ENABLE_STRICT_OBJC_MSGSEND = YES;
320 | GCC_C_LANGUAGE_STANDARD = gnu99;
321 | GCC_NO_COMMON_BLOCKS = YES;
322 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
323 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
324 | GCC_WARN_UNDECLARED_SELECTOR = YES;
325 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
326 | GCC_WARN_UNUSED_FUNCTION = YES;
327 | GCC_WARN_UNUSED_VARIABLE = YES;
328 | IPHONEOS_DEPLOYMENT_TARGET = 9.3;
329 | MTL_ENABLE_DEBUG_INFO = NO;
330 | SDKROOT = iphoneos;
331 | TARGETED_DEVICE_FAMILY = "1,2";
332 | VALIDATE_PRODUCT = YES;
333 | };
334 | name = Release;
335 | };
336 | 710124C21D11BCD9009F420A /* Debug */ = {
337 | isa = XCBuildConfiguration;
338 | baseConfigurationReference = DAB41A5EFBA638662D974B56 /* Pods-OpenIDConnectSwift.debug.xcconfig */;
339 | buildSettings = {
340 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
341 | CODE_SIGN_IDENTITY = "iPhone Developer";
342 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
343 | DEVELOPMENT_TEAM = "";
344 | INFOPLIST_FILE = OpenIDConnectSwift/Info.plist;
345 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
346 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
347 | PRODUCT_BUNDLE_IDENTIFIER = com.okta.OpenIDConnectSwift;
348 | PRODUCT_NAME = "$(TARGET_NAME)";
349 | PROVISIONING_PROFILE = "";
350 | SDKROOT = iphoneos;
351 | SWIFT_VERSION = 3.0;
352 | };
353 | name = Debug;
354 | };
355 | 710124C31D11BCD9009F420A /* Release */ = {
356 | isa = XCBuildConfiguration;
357 | baseConfigurationReference = 08D36EB095FD9E1BF02D1FE7 /* Pods-OpenIDConnectSwift.release.xcconfig */;
358 | buildSettings = {
359 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
360 | CODE_SIGN_IDENTITY = "iPhone Developer";
361 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
362 | DEVELOPMENT_TEAM = "";
363 | INFOPLIST_FILE = OpenIDConnectSwift/Info.plist;
364 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
365 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
366 | PRODUCT_BUNDLE_IDENTIFIER = com.okta.OpenIDConnectSwift;
367 | PRODUCT_NAME = "$(TARGET_NAME)";
368 | PROVISIONING_PROFILE = "";
369 | SDKROOT = iphoneos;
370 | SWIFT_VERSION = 3.0;
371 | };
372 | name = Release;
373 | };
374 | /* End XCBuildConfiguration section */
375 |
376 | /* Begin XCConfigurationList section */
377 | 710124AA1D11BCD9009F420A /* Build configuration list for PBXProject "OpenIDConnectSwift" */ = {
378 | isa = XCConfigurationList;
379 | buildConfigurations = (
380 | 710124BF1D11BCD9009F420A /* Debug */,
381 | 710124C01D11BCD9009F420A /* Release */,
382 | );
383 | defaultConfigurationIsVisible = 0;
384 | defaultConfigurationName = Release;
385 | };
386 | 710124C11D11BCD9009F420A /* Build configuration list for PBXNativeTarget "OpenIDConnectSwift" */ = {
387 | isa = XCConfigurationList;
388 | buildConfigurations = (
389 | 710124C21D11BCD9009F420A /* Debug */,
390 | 710124C31D11BCD9009F420A /* Release */,
391 | );
392 | defaultConfigurationIsVisible = 0;
393 | defaultConfigurationName = Release;
394 | };
395 | /* End XCConfigurationList section */
396 | };
397 | rootObject = 710124A71D11BCD9009F420A /* Project object */;
398 | }
399 |
--------------------------------------------------------------------------------
/OpenIDConnectSwift/OktaAppAuth.swift:
--------------------------------------------------------------------------------
1 | /** Author: Jordan Melberg **/
2 |
3 | /** Copyright © 2016, Okta, Inc.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | import UIKit
19 | import AppAuth
20 |
21 |
22 | class OktaAppAuth: UIViewController, OIDAuthStateChangeDelegate {
23 |
24 | // MARK: Properties
25 | @IBOutlet weak var tokensIcon: UIImageView!
26 | @IBOutlet weak var apiCallIcon: UIImageView!
27 | @IBOutlet weak var userInfoIcon: UIImageView!
28 | @IBOutlet weak var refreshTokenIcon: UIImageView!
29 | @IBOutlet weak var revokeTokenIcon: UIImageView!
30 | @IBOutlet weak var clearIcon: UIImageView!
31 | @IBOutlet weak var userInfoButton: UIButton!
32 | @IBOutlet weak var refreshTokensButton: UIButton!
33 | @IBOutlet weak var callApiButton: UIButton!
34 | @IBOutlet weak var clearButton: UIButton!
35 | @IBOutlet weak var revokeTokensButton: UIButton!
36 |
37 | // Okta Configuration
38 | var appConfig = OktaConfiguration()
39 |
40 | // AppAuth authState
41 | var authState:OIDAuthState?
42 |
43 | // Revoked Toggle
44 | var revoked = false
45 |
46 | override func viewDidLoad() {
47 | super.viewDidLoad()
48 | connectIcons()
49 | self.loadState()
50 | }
51 |
52 | override func didReceiveMemoryWarning() {
53 | super.didReceiveMemoryWarning()
54 | }
55 |
56 | /** Connects UI image icons to functions */
57 | func connectIcons() {
58 | // Assign Access Icon to Retrieve Access Token
59 | let tokens_gesture = UITapGestureRecognizer(target:self, action: #selector(OktaAppAuth.getTokensButton(_:)))
60 | tokensIcon.isUserInteractionEnabled = true
61 | tokensIcon.addGestureRecognizer(tokens_gesture)
62 |
63 | //Assign Userinfo Icon to Retrieve User Info
64 | let user_gesture = UITapGestureRecognizer(target: self, action:#selector(OktaAppAuth.userinfo(_:)))
65 | userInfoIcon.isUserInteractionEnabled = true
66 | userInfoIcon.addGestureRecognizer(user_gesture)
67 |
68 | //Assign API Call Icon to Retrieve Info from Demo Endpoint
69 | let api_gesture = UITapGestureRecognizer(target: self, action:#selector(OktaAppAuth.apiCall))
70 | apiCallIcon.isUserInteractionEnabled = true
71 | apiCallIcon.addGestureRecognizer(api_gesture)
72 |
73 | //Assign Refresh Token Icon to Function
74 | let refresh_gesture = UITapGestureRecognizer(target: self, action:#selector(OktaAppAuth.refreshTokens))
75 | refreshTokenIcon.isUserInteractionEnabled = true
76 | refreshTokenIcon.addGestureRecognizer(refresh_gesture)
77 |
78 | // Assign Revoke Token Icon to Function
79 | let revoke_gesture = UITapGestureRecognizer(target: self, action:#selector(OktaAppAuth.revokeToken))
80 | revokeTokenIcon.isUserInteractionEnabled = true
81 | revokeTokenIcon.addGestureRecognizer(revoke_gesture)
82 |
83 | // Assign Sign out to Function
84 | let clear_gesture = UITapGestureRecognizer(target: self, action: #selector(OktaAppAuth.clearTokens))
85 | clearIcon.isUserInteractionEnabled = true
86 | clearIcon.addGestureRecognizer(clear_gesture)
87 |
88 | }
89 |
90 | /**
91 | * Creates pop-up alert given Title and Message
92 | * Dismisses on UI button click 'Cancel'
93 | *
94 | * - parameters:
95 | * - alertTitle: Title of alert
96 | * - alertMessage: Output message
97 | */
98 | func createAlert(_ alertTitle: String, alertMessage: String) {
99 | let alert = UIAlertController(title: alertTitle, message: alertMessage, preferredStyle: .alert)
100 | alert.view.tintColor = UIColor.black
101 | alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.cancel, handler: nil))
102 | let textIndicator: UIActivityIndicatorView = UIActivityIndicatorView(frame: CGRect(x: 10, y: 5, width: 50, height: 50)) as UIActivityIndicatorView
103 | alert.view.addSubview(textIndicator)
104 |
105 | present(alert, animated: true, completion: nil)
106 | }
107 |
108 | /** Saves the current authState into NSUserDefaults */
109 | func saveState() {
110 | if(authState != nil){
111 | let archivedAuthState = NSKeyedArchiver.archivedData(withRootObject: authState!)
112 | UserDefaults.standard.set(archivedAuthState, forKey: appConfig.kAppAuthExampleAuthStateKey)
113 | }
114 | else { UserDefaults.standard.set(nil, forKey: appConfig.kAppAuthExampleAuthStateKey) }
115 |
116 | UserDefaults.standard.synchronize()
117 | }
118 |
119 | /** Loads the current authState from NSUserDefaults */
120 | func loadState() {
121 | if let archivedAuthState = UserDefaults.standard.object(forKey: appConfig.kAppAuthExampleAuthStateKey) as? Data {
122 | if let authState = NSKeyedUnarchiver.unarchiveObject(with: archivedAuthState) as? OIDAuthState {
123 | setAuthState(authState)
124 | } else { return }
125 | } else { return }
126 | }
127 |
128 | /**
129 | * Setter method for authState update
130 | * :param: authState The input value representing the new authorization state
131 | */
132 | fileprivate func setAuthState(_ authState:OIDAuthState?){
133 | self.authState = authState
134 | self.authState?.stateChangeDelegate = self
135 | self.stateChanged()
136 | }
137 |
138 | /** Required method */
139 | func stateChanged(){ self.saveState() }
140 |
141 | /** Required method */
142 | func didChange(_ state: OIDAuthState) { self.stateChanged() }
143 |
144 | /** Verifies authState was performed */
145 | func checkAuthState() -> Bool {
146 | if (authState != nil){
147 | return true
148 | } else { return false }
149 | }
150 |
151 | /**
152 | * Starts Authorization Flow
153 | * :param: sender The UI button 'Get Tokens'
154 | */
155 | @IBAction func getTokensButton(_ sender: AnyObject) { authenticate() }
156 |
157 | /**
158 | * Authorization Flow Sequence
159 | *
160 | * This method retrieves the OpenID Connect discovery document based on the configuration specified in 'Models.swift' and creates an AppAuth authState
161 | * - Builds the authentication request with helper method OIDAuthorizationRequest
162 | * - Opens in-app iOS Safari browser to validate user credientials
163 | * - Logs: Access Token, Refresh Token, and Id Token
164 | * - Alerts: Success
165 | */
166 | func authenticate() {
167 | let issuer = URL(string: appConfig.kIssuer)
168 | let redirectURI = URL(string: appConfig.kRedirectURI)
169 |
170 | // Discovers Endpoints
171 | OIDAuthorizationService.discoverConfiguration(forIssuer: issuer!) {
172 | config, error in
173 |
174 |
175 | if config == nil {
176 | print("Error retrieving discovery document: \(String(describing: error?.localizedDescription))")
177 | return;
178 | } else {
179 | print("Retrieved configuration: \(config!)")
180 | }
181 |
182 |
183 | // Build Authentication Request
184 | let request = OIDAuthorizationRequest(configuration: config!,
185 | clientId: self.appConfig.kClientID,
186 | scopes: [
187 | OIDScopeOpenID,
188 | OIDScopeProfile,
189 | OIDScopeEmail,
190 | OIDScopePhone,
191 | OIDScopeAddress,
192 | "groups",
193 | "offline_access"
194 | ],
195 | redirectURL: redirectURI!,
196 | responseType: OIDResponseTypeCode,
197 | additionalParameters: nil)
198 | let appDelegate = UIApplication.shared.delegate as! AppDelegate
199 |
200 | print("Initiating Authorization Request: \(request)")
201 |
202 |
203 | appDelegate.currentAuthorizationFlow =
204 | OIDAuthState.authState(byPresenting: request, presenting: self){
205 | authorizationResponse, error in
206 | if(authorizationResponse != nil) {
207 | self.setAuthState(authorizationResponse)
208 | let authToken = authorizationResponse!.lastTokenResponse!.accessToken!
209 | let refreshToken = authorizationResponse!.lastTokenResponse!.refreshToken!
210 | let idToken = authorizationResponse!.lastTokenResponse!.idToken!
211 | print("Retrieved Tokens.\n\nAccess Token: \(authToken) \n\nRefresh Token: \(refreshToken) \n\nId Token: \(idToken)")
212 | self.createAlert("Tokens", alertMessage: "Check logs for token values")
213 |
214 | } else {
215 | print("Authorization Error: \(error!.localizedDescription)")
216 | self.setAuthState(nil)
217 | }
218 | }
219 | }
220 | }
221 |
222 | /**
223 | * Calls Userinfo Endpoint
224 | *
225 | * - parameters:
226 | * - sender: The UI button 'Get User Info'
227 | */
228 | @IBAction func userinfo(_ sender: AnyObject) {
229 | let userinfoEndpoint = authState?.lastAuthorizationResponse
230 | .request.configuration.discoveryDocument?.userinfoEndpoint
231 | if(userinfoEndpoint == nil ) {
232 | print("Userinfo endpoint not declared in discovery document")
233 | self.createAlert("Error", alertMessage: "User info endpoint not declared in discovery document")
234 | return
235 | }
236 | sendUserInfoRequest(userinfoEndpoint!)
237 | }
238 |
239 | /**
240 | * Creates HTTP request to the User Info API endpoint
241 | *
242 | * Verifies the accessToken wasn't revoked
243 | *
244 | * - parameters:
245 | * - url: The url in NSURL format for the request to be made
246 | */
247 | func sendUserInfoRequest(_ url: URL){
248 | if checkAuthState() {
249 | // Check if token is revoked
250 | var token = authState?.lastTokenResponse?.accessToken
251 |
252 | if revoked { print("Performing request with revoked accessToken") }
253 | else {
254 | print("Performing request with fresh accessToken")
255 | authState?.performAction(freshTokens: {
256 | accessToken, idToken, error in
257 | if(error != nil){
258 | print("Error fetching fresh tokens: \(error!.localizedDescription)")
259 | return
260 | }
261 | // Update accessToken
262 | if(token != accessToken){
263 | print("Access token refreshed automatially (\(String(describing: token)) to \(accessToken!))")
264 | token = accessToken
265 | } else { print("Access token was fresh and not updated [\(token!)]") }
266 | })
267 | }
268 | // Perform Request
269 | performRequest("User Info", currentAccessToken: (token)!, url: url)
270 | } else { print("Not authenticated") }
271 | }
272 |
273 | /**
274 | * Performs HTTP Request with access token
275 | *
276 | * - parameters:
277 | * - returnTitle: Title of response alert
278 | * - currentAccessToken: Current access token (may be refreshed)
279 | * - url: NSURL of API endpoint
280 | */
281 | func performRequest(_ returnTitle: String, currentAccessToken: String, url: URL) {
282 | // Create Request to endpoint, with access_token in Authorization Header
283 |
284 | var request = URLRequest(url:url)
285 | let authorizationHeaderValue = "Bearer \(currentAccessToken)"
286 | request.addValue(authorizationHeaderValue, forHTTPHeaderField: "Authorization")
287 |
288 | let config = URLSessionConfiguration.default
289 | let session = URLSession(configuration: config)
290 |
291 |
292 | //Perform HTTP Request
293 | let postDataTask = session.dataTask(with: request, completionHandler: {
294 | data, response, error in
295 | DispatchQueue.main.async{
296 | if let httpResponse = response as? HTTPURLResponse {
297 | do{
298 | let jsonDictionaryOrArray = try JSONSerialization.jsonObject(with: data!, options: .mutableContainers)
299 | if ( httpResponse.statusCode != 200 ){
300 | let responseText = NSString(data: data!, encoding: String.Encoding.utf8.rawValue)
301 | if ( httpResponse.statusCode == 401 ){
302 | let oauthError = OIDErrorUtilities.resourceServerAuthorizationError(withCode: 0,
303 | errorResponse: jsonDictionaryOrArray as? [AnyHashable: Any],
304 | underlyingError: error)
305 | self.authState?.update(withAuthorizationError: oauthError!)
306 | self.createAlert("OAuth Error", alertMessage: "\(String(describing: oauthError))")
307 | print("Authorization Error (\(oauthError!)). Response: \(responseText!)")
308 | }
309 | else { print("HTTP: \(httpResponse.statusCode). Response: \(String(describing: responseText))") }
310 | return
311 | }
312 | print("Success: \(jsonDictionaryOrArray)")
313 | self.createAlert(returnTitle, alertMessage: "\(jsonDictionaryOrArray)")
314 | } catch { print("Error while serializing data to JSON") }
315 | } else {
316 | print("Non-HTTP response \(String(describing: error))")
317 | return
318 | }
319 | }
320 | })
321 | postDataTask.resume()
322 | }
323 |
324 | /**
325 | * Outlet to call refreshTokens method
326 | *
327 | * - parameters:
328 | * - sender: UI button 'Refresh Token'
329 | */
330 | @IBAction func refreshTokenButton(_ sender: AnyObject) { refreshTokens() }
331 |
332 | /** Refreshes the current tokens with existing refresh token */
333 | func refreshTokens(){
334 | if checkAuthState() {
335 | print("Refreshed tokens")
336 | authState?.setNeedsTokenRefresh()
337 | authState?.performAction(freshTokens: {
338 | accessToken, idToken, error in
339 | if(error != nil){
340 | print("Error fetching fresh tokens: \(error!.localizedDescription)")
341 | self.createAlert("Error", alertMessage: "Error fetching fresh tokens")
342 | return
343 | }
344 | self.createAlert("Success", alertMessage: "Token was refreshed")
345 |
346 | })
347 | } else {
348 | print("Not authenticated")
349 | createAlert("Error", alertMessage: "Not authenticated")
350 | }
351 | }
352 |
353 | /**
354 | * Outlet to call revokeTokens method
355 | *
356 | * - parameters:
357 | * - sender: UI button 'Revoke Token'
358 | */
359 | @IBAction func revokeTokensButton(_ sender: AnyObject) { revokeToken() }
360 |
361 | /** Revokes current access token by calling OAuth revoke endpoint */
362 | func revokeToken(){
363 | if checkAuthState() {
364 | print("Revoking token..")
365 | authState?.performAction(freshTokens: {
366 | accessToken, idToken, error in
367 |
368 | let url = URL(string: "\(self.appConfig.kIssuer!)/oauth2/v1/revoke")
369 | var request = URLRequest(url: url!)
370 | request.httpMethod = "POST"
371 |
372 | let requestData = "token=\(accessToken!)&client_id=\(self.appConfig.kClientID!)"
373 | request.httpBody = requestData.data(using: String.Encoding.utf8)
374 |
375 | let config = URLSessionConfiguration.default
376 | let session = URLSession(configuration: config)
377 |
378 | //Perform HTTP Request
379 | let postDataTask = session.dataTask(with: request, completionHandler: {
380 | data, response, error in
381 | DispatchQueue.main.async{
382 | if let httpResponse = response as? HTTPURLResponse {
383 | do{
384 | if (httpResponse.statusCode == 200 || httpResponse.statusCode == 204){
385 | self.createAlert("Token Revoked", alertMessage: "Previous access token is considered invalid")
386 | print("Previous access token is considered invalid")
387 | self.revoked = true
388 | self.authState?.setNeedsTokenRefresh()
389 | return
390 | } else {
391 | // Error JSON
392 | let jsonDictionaryOrArray = try JSONSerialization.jsonObject(with: data!, options: .mutableContainers)
393 | if ( httpResponse.statusCode != 200 || httpResponse.statusCode != 204 ){
394 | let responseText = NSString(data: data!, encoding: String.Encoding.utf8.rawValue)
395 | if ( httpResponse.statusCode == 401 ){
396 | let oauthError = OIDErrorUtilities.resourceServerAuthorizationError(withCode: 0,
397 | errorResponse: jsonDictionaryOrArray as? [AnyHashable: Any],
398 | underlyingError: error)
399 | self.authState?.update(withAuthorizationError: oauthError!)
400 | print("Authorization Error (\(String(describing: oauthError))). Response: \(String(describing: responseText))")
401 | }
402 | else{ print("HTTP: \(httpResponse.statusCode). Response: \(String(describing: responseText))") }
403 | return
404 | } }
405 | } catch { print("Error while serializing data to JSON") }
406 | } else {
407 | print("Non-HTTP response \(String(describing: error))")
408 | return
409 | }
410 | }
411 | })
412 | postDataTask.resume()
413 | })
414 | } else {
415 | print("Not authenticated")
416 | createAlert("Error", alertMessage: "Not authenticated")
417 | }
418 | }
419 |
420 | /**
421 | * Outlet to call clearTokens method
422 | *
423 | * - parameters:
424 | * - sender: UI button 'Clear Tokens'
425 | */
426 | @IBAction func clearButton(_ sender: AnyObject) { clearTokens() }
427 |
428 | /** Removes all tokens from curent authState */
429 | func clearTokens(){
430 | if checkAuthState() {
431 | self.setAuthState(nil)
432 | let clearAll = Bundle.main.bundleIdentifier!
433 | UserDefaults.standard.removePersistentDomain(forName: clearAll)
434 | self.saveState()
435 | createAlert("Signed out", alertMessage: "Successfully forgot all tokens")
436 | } else {
437 | print("Not authenticated")
438 | createAlert("Error", alertMessage: "Not authenticated")
439 | }
440 |
441 | }
442 |
443 | /** Calls external server API to return image */
444 | func apiCall() {
445 | if checkAuthState(){
446 | self.performSegue(withIdentifier: "ImageViewSegue", sender: self)
447 | } else {
448 | print("Not authenticated")
449 | createAlert("Error", alertMessage: "Not authenticated")
450 | }
451 | }
452 |
453 | /* Segue to next ImageView for testing Demo API Call */
454 | override func prepare(for segue: UIStoryboardSegue, sender: Any?){
455 | if segue.identifier == "ImageViewSegue" {
456 | let destinationController = segue.destination as! ImageViewController
457 | destinationController.authState = authState
458 | destinationController.appConfig = appConfig
459 | }
460 | }
461 |
462 | }
463 |
--------------------------------------------------------------------------------
/OpenIDConnectSwift/Base.lproj/Main.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 |
27 |
28 |
29 |
35 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
--------------------------------------------------------------------------------