An iOS framework for integrating with Guardpost.
Requires iOS 13 or greater.
- Get GuardpostKit into your project.
- Import the module:
import GuardpostKit
- Create a guardpost object, supplying the endpoint, SSO secret and URL scheme for the current app:
let guardpost = Guardpost(baseUrl: "https://guardpost.rwdev.io",
urlScheme: "com.razeware.guardpost-demo://",
ssoSecret: "<SSO_SECRET>")
- Ensure that your app is registered for the specified URL scheme:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.razeware.guardpost-demo</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.razeware.guardpost-demo</string>
</array>
</dict>
</array>
- Use the
currentUser
property to determine whether a user is currently logged in. Their profile is stored in the keychain, so persists between restarts, and backups. - Use the
login()
method to initiate a login, providing a closure to handle the result of the login. - Use the
logout()
method to remove the user from the keychain.
The demo app shows GuardpostKit in action.
There are a few tests written. There should probably be some more.
This framework requires a minimum of iOS 13.