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. Related to #23.
  • Loading branch information
jeroenleenarts committed Mar 6, 2018
1 parent d46ad1e commit 39a72ec
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 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:*.eduvpn.org</string>
<string>applinks:eduvpn.org</string>
</array>
</dict>
</plist>
1 change: 1 addition & 0 deletions EduVPN/Networking/ApiService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class DynamicApiProvider: MoyaProvider<DynamicApiService> {

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)
//TODO: Switch to use https://eduvpn.org/auth/app/redirect/[development/]
return Promise(resolver: { seal in
currentAuthorizationFlow = OIDAuthState.authState(byPresenting: request, presenting: presentingViewController, callback: { (authState, error) in

Expand Down

0 comments on commit 39a72ec

Please sign in to comment.