Skip to content

Commit

Permalink
Fix merge conflict with master
Browse files Browse the repository at this point in the history
  • Loading branch information
jorunfa committed Oct 18, 2017
1 parent 4914f11 commit f360b84
Show file tree
Hide file tree
Showing 25 changed files with 250 additions and 104 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Expand Up @@ -23,4 +23,7 @@ DerivedData
Pods/

#Docset/AppleDoc
*/Docset/*
*/Docset/*

# rbenv
.ruby-version
4 changes: 2 additions & 2 deletions Podfile
Expand Up @@ -6,11 +6,11 @@ use_frameworks!

target 'TDConnectIosSdk' do
pod 'AeroGearHttp', '1.0.0'
pod 'JSONWebToken', '2.0.2'
pod 'JSONWebToken', '2.2.0'

target 'TDConnectIosSdkTests' do
inherit! :search_paths

pod 'OHHTTPStubs', '5.2.3'
pod 'OHHTTPStubs', '6.0.0'
end
end
31 changes: 14 additions & 17 deletions Podfile.lock
@@ -1,33 +1,30 @@
PODS:
- AeroGearHttp (1.0.0)
- CryptoSwift (0.6.7)
- JSONWebToken (2.0.2):
- CryptoSwift (~> 0.6.1)
- OHHTTPStubs (5.2.3):
- OHHTTPStubs/Default (= 5.2.3)
- OHHTTPStubs/Core (5.2.3)
- OHHTTPStubs/Default (5.2.3):
- JSONWebToken (2.2.0)
- OHHTTPStubs (6.0.0):
- OHHTTPStubs/Default (= 6.0.0)
- OHHTTPStubs/Core (6.0.0)
- OHHTTPStubs/Default (6.0.0):
- OHHTTPStubs/Core
- OHHTTPStubs/JSON
- OHHTTPStubs/NSURLSession
- OHHTTPStubs/OHPathHelpers
- OHHTTPStubs/JSON (5.2.3):
- OHHTTPStubs/JSON (6.0.0):
- OHHTTPStubs/Core
- OHHTTPStubs/NSURLSession (5.2.3):
- OHHTTPStubs/NSURLSession (6.0.0):
- OHHTTPStubs/Core
- OHHTTPStubs/OHPathHelpers (5.2.3)
- OHHTTPStubs/OHPathHelpers (6.0.0)

DEPENDENCIES:
- AeroGearHttp (= 1.0.0)
- JSONWebToken (= 2.0.2)
- OHHTTPStubs (= 5.2.3)
- JSONWebToken (= 2.2.0)
- OHHTTPStubs (= 6.0.0)

SPEC CHECKSUMS:
AeroGearHttp: 8c825d4563439f565196f52efe80e15f0055109a
CryptoSwift: 685ae257941e5447474348a2b545583e1a16b573
JSONWebToken: ca86f02eeb3d1f58ba5197ec2cd53c7de915ecc1
OHHTTPStubs: e238cd5b66d8efa51c861db45895de8fe079f4a7
JSONWebToken: 6fae32489632658d563dd6952a5c34020ea813e4
OHHTTPStubs: 752f9b11fd810a15162d50f11c06ff94f8e012eb

PODFILE CHECKSUM: cf7938e2f5f5d6ccc0c56922b4bca928dcd4aa2b
PODFILE CHECKSUM: 6b6c974f09234967cfab0f59df3c6cffcaa9869a

COCOAPODS: 1.2.0
COCOAPODS: 1.3.1
2 changes: 1 addition & 1 deletion TDConnectIosSdk.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "TDConnectIosSdk"
s.version = "1.0.2"
s.version = "1.1.0"
s.summary = "OAuth2 client library based on aerogear-ios-http"
s.homepage = "https://github.com/telenordigital/connect-ios-sdk"
s.license = 'Apache License, Version 2.0'
Expand Down
47 changes: 38 additions & 9 deletions TDConnectIosSdk.xcodeproj/project.pbxproj
Expand Up @@ -310,17 +310,17 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0820;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = aerogear;
TargetAttributes = {
4833046119AF1635002F8DA9 = {
CreatedOnToolsVersion = 6.0;
LastSwiftMigration = 0830;
LastSwiftMigration = 0900;
};
4833046C19AF1635002F8DA9 = {
CreatedOnToolsVersion = 6.0;
DevelopmentTeam = M4Q75B4WS4;
LastSwiftMigration = 0820;
LastSwiftMigration = 0900;
};
};
};
Expand Down Expand Up @@ -366,9 +366,16 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-TDConnectIosSdkTests/Pods-TDConnectIosSdkTests-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/OHHTTPStubs/OHHTTPStubs.framework",
"${BUILT_PRODUCTS_DIR}/AeroGearHttp/AeroGearHttp.framework",
"${BUILT_PRODUCTS_DIR}/JSONWebToken/JWT.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OHHTTPStubs.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AeroGearHttp.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JWT.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -396,13 +403,16 @@
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-TDConnectIosSdkTests-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
78AAE80F48F1E3DE0D894510 /* [CP] Check Pods Manifest.lock */ = {
Expand All @@ -411,13 +421,16 @@
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-TDConnectIosSdk-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
C7B14E91846F3174319DBEDD /* [CP] Copy Pods Resources */ = {
Expand Down Expand Up @@ -498,14 +511,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -548,14 +567,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -605,7 +630,8 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -630,7 +656,8 @@
PRODUCT_BUNDLE_IDENTIFIER = "org.aerogear.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand All @@ -651,7 +678,8 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -667,7 +695,8 @@
PRODUCT_BUNDLE_IDENTIFIER = "org.aerogear.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<Testables>
Expand Down Expand Up @@ -56,6 +57,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -55,6 +56,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
32 changes: 19 additions & 13 deletions TDConnectIosSdk/AccountManager.swift
Expand Up @@ -18,7 +18,7 @@
import Foundation

/**
A Config object that setups facebook specific configuration parameters.
A Config object that setups Facebook specific configuration parameters.
*/
open class FacebookConfig: Config {
/**
Expand All @@ -27,7 +27,7 @@ open class FacebookConfig: Config {
:param: clientSecret OAuth2 credentials an unique string that is generated in the OAuth2 provider Developers Console.
:param: scopes an array of scopes the app is asking access to.
:param: accountId this unique id is used by AccountManager to identify the OAuth2 client.
:paream: isOpenIDConnect to identify if fetching id information is required.
:param: isOpenIDConnect to identify if fetching id information is required.
*/
public init(clientId: String, clientSecret: String, scopes: [String], accountId: String? = nil, isOpenIDConnect: Bool = false) {
super.init(base: "",
Expand Down Expand Up @@ -60,21 +60,24 @@ open class GoogleConfig: Config {
:param: clientId OAuth2 credentials an unique string that is generated in the OAuth2 provider Developers Console.
:param: scopes an array of scopes the app is asking access to.
:param: accountId this unique id is used by AccountManager to identify the OAuth2 client.
:paream: isOpenIDConnect to identify if fetching id information is required.
:param: isOpenIDConnect to identify if fetching id information is required.
*/
public init(clientId: String, scopes: [String], accountId: String? = nil, isOpenIDConnect: Bool = false) {
public init(clientId: String, scopes: [String], audienceId: String? = nil, accountId: String? = nil, isOpenIDConnect: Bool = false) {
let bundleString = Bundle.main.bundleIdentifier ?? "google"
super.init(base: "https://accounts.google.com",
authzEndpoint: "o/oauth2/v2/auth",
redirectURL: "\(bundleString):/oauth2Callback",
accessTokenEndpoint: "o/oauth2/token",
clientId: clientId,
audienceId: audienceId,
refreshTokenEndpoint: "o/oauth2/token",
revokeTokenEndpoint: "o/oauth2/revoke",
isOpenIDConnect: isOpenIDConnect,
userInfoEndpoint: isOpenIDConnect ? "https://www.googleapis.com/plus/v1/people/me/openIdConnect" : nil,
scopes: scopes,
accountId: accountId)
accountId: accountId
)

// Add openIdConnect scope
if self.isOpenIDConnect {
self.scopes += ["openid", "email", "profile"]
Expand All @@ -88,22 +91,24 @@ open class KeycloakConfig: Config {
/**
Init a Keycloak configuration.
:param: clientId OAuth2 credentials an unique string that is generated in the OAuth2 provider Developers Console.
:param: host to identify where is the keycloak server located.
:param: realm to identify which realm to use. A realm grup a set of application/oauth2 client together.
:paream: isOpenIDConnect to identify if fetching id information is required.
:param: host to identify where the Keycloak server located.
:param: realm to identify which realm to use. A realm group a set of application/OAuth2 client together.
:param: isOpenIDConnect to identify if fetching id information is required.
*/
public init(clientId: String, host: String, realm: String? = nil, isOpenIDConnect: Bool = false) {
let bundleString = Bundle.main.bundleIdentifier ?? "keycloak"
let defaulRealmName = String(format: "%@-realm", clientId)
let realm = realm ?? defaulRealmName
super.init(base: "\(host)/auth",
super.init(
base: "\(host)/auth",
authzEndpoint: "realms/\(realm)/protocol/openid-connect/auth",
redirectURL: "\(bundleString)://oauth2Callback",
accessTokenEndpoint: "realms/\(realm)/protocol/openid-connect/token",
clientId: clientId,
refreshTokenEndpoint: "realms/\(realm)/protocol/openid-connect/token",
revokeTokenEndpoint: "realms/\(realm)/protocol/openid-connect/logout",
isOpenIDConnect: isOpenIDConnect)
isOpenIDConnect: isOpenIDConnect
)
// Add openIdConnect scope
if self.isOpenIDConnect {
self.scopes += ["openid", "email", "profile"]
Expand Down Expand Up @@ -135,6 +140,7 @@ open class TelenorConnectConfig: Config {
wellKnownConfigurationEndpoint: "\(baseUrl)/.well-known/openid-configuration",
isOpenIDConnect: true,
userInfoEndpoint: "\(baseUrl)/userinfo",
logOutEndpoint: "\(baseUrl)/logout",
scopes: scopes,
clientSecret: nil,
accountId: accountId,
Expand Down Expand Up @@ -243,7 +249,7 @@ open class AccountManager {
}

/**
Convenient method to retrieve a Facebook oauth2 module.
Convenient method to retrieve a Facebook OAuth2 module.
:param: config a Facebook configuration object. See FacebookConfig.
Expand All @@ -254,7 +260,7 @@ open class AccountManager {
}

/**
Convenient method to retrieve a Google oauth2 module ready to be used.
Convenient method to retrieve a Google OAuth2 module ready to be used.
:param: config a google configuration object. See GoogleConfig.
Expand All @@ -265,7 +271,7 @@ open class AccountManager {
}

/**
Convenient method to retrieve a Keycloak oauth2 module ready to be used.
Convenient method to retrieve a Keycloak OAuth2 module ready to be used.
:param: config a Keycloak configuration object. See KeycloakConfig.
Expand Down

0 comments on commit f360b84

Please sign in to comment.