Skip to content

Commit

Permalink
Merge c3822f9 into 122a7af
Browse files Browse the repository at this point in the history
  • Loading branch information
RaniAbboud committed Aug 22, 2019
2 parents 122a7af + c3822f9 commit 5902829
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
4 changes: 3 additions & 1 deletion IBMCloudAppIDTests/RegistrationManagerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ public class RegistrationManagerTests: XCTestCase {
let callback = {(error: Error?) in
XCTAssertNil(error)
XCTAssertNotNil(self.oauthManager.registrationManager?.preferenceManager.getJSONPreference(name: AppIDConstants.registrationDataPref).get())
XCTAssertEqual(self.oauthManager.registrationManager?.preferenceManager.getJSONPreference(name: AppIDConstants.registrationDataPref).get(), try? Utils.JSONStringify(["key1": "val1", "key2": "val2"] as AnyObject))

let prefrences = self.oauthManager.registrationManager?.preferenceManager.getJSONPreference(name: AppIDConstants.registrationDataPref).getAsJSON()
XCTAssertTrue(NSDictionary(dictionary: prefrences!).isEqual(to: ["key1": "val1", "key2": "val2"]))
XCTAssertEqual(self.oauthManager.registrationManager?.preferenceManager.getStringPreference(name: AppIDConstants.tenantPrefName).get(), "tenant1")

expectation1.fulfill()
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,12 @@ This API can be used only when the user is logged in using Cloud Directory ident
AppID.sharedInstance.loginWidget?.launchChangePassword(delegate: delegate())
```

### Logout

```swift
AppID.sharedInstance.logout()
```

### User Profile

Using the App ID UserProfileManager, you are able to create, read, and delate attributes in a user's profile as well as retrieve additional info about a user.
Expand Down Expand Up @@ -283,6 +289,9 @@ In a rare case your application requires refreshing App ID tokens while running
AppID.secAttrAccess = .accessibleAlways
```

## Got Questions?
Join us on [Slack](https://www.ibm.com/cloud/blog/announcements/get-help-with-ibm-cloud-app-id-related-questions-on-slack) and chat with our dev team.

## License
This package contains code licensed under the Apache License, Version 2.0 (the "License"). You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 and may also view the License in the LICENSE file within this package.

Expand Down
9 changes: 6 additions & 3 deletions Source/IBMCloudAppID/api/AppID.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,13 @@ public class AppID {
password: password, tokenResponseDelegate: tokenResponseDelegate)
}



public func application(_ application: UIApplication, open url: URL, options :[UIApplicationOpenURLOptionsKey: Any]) -> Bool {
public func application(_ application: UIApplication, open url: URL, options :[UIApplicationOpenURLOptionsKey: Any]) -> Bool {
return (self.oauthManager?.authorizationManager?.application(application, open: url, options: options))!
}

public func logout() {
let appIDAuthorizationManager = AppIDAuthorizationManager(appid: self)
appIDAuthorizationManager.logout()
}

}

0 comments on commit 5902829

Please sign in to comment.