Skip to content

Commit

Permalink
Add entitlement and rewire most of the app to use an universal link. …
Browse files Browse the repository at this point in the history
…Needs compeion and testing. Fixes #23.
  • Loading branch information
jeroenleenarts committed Mar 8, 2018
1 parent d46ad1e commit 6114246
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 16 deletions.
9 changes: 9 additions & 0 deletions EduVPN.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
4A62C8B71FB03B47007D3FAA /* KeyboardWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardWrapper.swift; sourceTree = "<group>"; };
4A7D1E4E1F4B24E4009F1402 /* ProfileModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProfileModel.swift; sourceTree = "<group>"; };
4A81DF9B2003BFB7002827A8 /* CertificateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CertificateModel.swift; sourceTree = "<group>"; };
4A84E276204F3A5B00E51EFE /* EduVPN.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = EduVPN.entitlements; sourceTree = "<group>"; };
4A8D241E1F3976A2004A9343 /* ProfilesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProfilesViewController.swift; sourceTree = "<group>"; };
4A8D24201F3976FC004A9343 /* ProviderType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProviderType.swift; sourceTree = "<group>"; };
4A8D24341F3A40F2004A9343 /* InstanceInfoModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InstanceInfoModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -199,6 +200,7 @@
4AAC1F781F2D0E3400DD0252 /* EduVPN */ = {
isa = PBXGroup;
children = (
4A84E276204F3A5B00E51EFE /* EduVPN.entitlements */,
4A983B751F397223004F82D5 /* Coordinators */,
4AD0AD601F3508DD006E1337 /* Models */,
4AD0AD5B1F35045E006E1337 /* ViewControllers */,
Expand Down Expand Up @@ -364,6 +366,11 @@
DevelopmentTeam = T4CMEHXPLL;
LastSwiftMigration = 0900;
ProvisioningStyle = Manual;
SystemCapabilities = {
com.apple.SafariKeychain = {
enabled = 1;
};
};
};
4AAC1F891F2D0E3400DD0252 = {
CreatedOnToolsVersion = 8.3.3;
Expand Down Expand Up @@ -763,6 +770,7 @@
baseConfigurationReference = 8828097AD8E6A8FAE767E4D9 /* Pods-EduVPN.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = EduVPN/EduVPN.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = T4CMEHXPLL;
Expand All @@ -782,6 +790,7 @@
baseConfigurationReference = BF41F680EFA1657A481FC709 /* Pods-EduVPN.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = EduVPN/EduVPN.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = T4CMEHXPLL;
Expand Down
6 changes: 6 additions & 0 deletions EduVPN/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey: Any] = [:]) -> Bool {
return appCoordinator.resumeAuthorizationFlow(url: url) == true
}

func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {

guard let url = userActivity.webpageURL else { return false }
return appCoordinator.resumeAuthorizationFlow(url: url) == true
}
}

extension AppDelegate: UNUserNotificationCenterDelegate {
Expand Down
11 changes: 11 additions & 0 deletions EduVPN/EduVPN.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:vpn.tuxed.net</string>
<string>applinks:ios.app.eduvpn.org</string>
</array>
</dict>
</plist>
17 changes: 4 additions & 13 deletions EduVPN/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>org.eduvpn.app</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>auto-generated</string>
<key>Fabric</key>
Expand Down Expand Up @@ -62,10 +53,10 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>openvpn</string>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>openvpn</string>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
Expand Down
4 changes: 2 additions & 2 deletions EduVPN/Models/Api+CoreDataProperties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extension Api {
return authServer?.authorizationEndpoint
case .distributed:
//TODO distributed
return nil
return authServer?.authorizationEndpoint
}
}

Expand All @@ -48,7 +48,7 @@ extension Api {
return authServer?.tokenEndpoint
case .distributed:
//TODO distributed
return nil
return authServer?.tokenEndpoint
}
}

Expand Down
8 changes: 7 additions & 1 deletion EduVPN/Networking/ApiService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@ class DynamicApiProvider: MoyaProvider<DynamicApiService> {
var currentAuthorizationFlow: OIDAuthorizationFlowSession?

public func authorize(presentingViewController: UIViewController) -> Promise<OIDAuthState> {
let request = OIDAuthorizationRequest(configuration: authConfig, clientId: "org.eduvpn.app.ios", scopes: ["config"], redirectURL: URL(string: "org.eduvpn.app:/api/callback")!, responseType: OIDResponseTypeCode, additionalParameters: nil)
#if DEBUG
let redirectUrl = URL(string: "https://ios.app.eduvpn.org/auth/app/redirect/development/")!
#else
let redirectUrl = URL(string: "https://ios.app.eduvpn.org/auth/app/redirect/")!
#endif

let request = OIDAuthorizationRequest(configuration: authConfig, clientId: "org.eduvpn.app.ios", scopes: ["config"], redirectURL: redirectUrl, responseType: OIDResponseTypeCode, additionalParameters: nil)
return Promise(resolver: { seal in
currentAuthorizationFlow = OIDAuthState.authState(byPresenting: request, presenting: presentingViewController, callback: { (authState, error) in

Expand Down

0 comments on commit 6114246

Please sign in to comment.