![]() |
Couchbase Lite
Objective-C API for iOS and Mac OS
|
#import "CBLAuthenticator.h"Go to the source code of this file.
Classes | |
| category | CBLAuthenticator(OpenID) |
Typedefs | |
| typedef void(^ | CBLOIDCLoginCallback) (NSURL *loginURL, NSURL *redirectURL, CBLOIDCLoginContinuation) |
| Callback block given when creating an OpenID Connect authenticator. More... | |
Variables | |
| NS_ASSUME_NONNULL_BEGIN typedef void(^ | CBLOIDCLoginContinuation )(NSURL *__nullable redirectedURL, NSError *__nullable error) |
| Callback that will be passed to your CBLOIDCLoginCallback. More... | |
| typedef void(^ CBLOIDCLoginCallback) (NSURL *loginURL, NSURL *redirectURL, CBLOIDCLoginContinuation) |
Callback block given when creating an OpenID Connect authenticator.
The block will be called when the OpenID Connect login flow requires the user to authenticate with the Originating Party (OP), the site at which they have an account.
The easiest way to provide this callback is to add the classes in Extras/OpenIDConnectUI to your app target, and then simply call [OpenIDController loginCallback].
If you want to implement your own UI, then this block should open a modal web view starting at the given loginURL, then return. Just make sure you hold onto the CBLOIDCLoginContinuation block, because you MUST call it later, or the replicator will never finish logging in!
Wait for the web view to redirect to a URL whose host and path are the same as the given redirectURL (the query string after the path will be different, though.) Instead of following the redirect, close the web view and call the given continuation block with the redirected URL (and a nil error.)
Your modal web view UI should provide a way for the user to cancel, probably by adding a Cancel button outside the web view. If the user cancels, call the continuation block with a nil URL and a nil error.
If something else goes wrong, like an error loading the login page in the web view, call the continuation block with that error and a nil URL.
| NS_ASSUME_NONNULL_BEGIN typedef void(^ CBLOIDCLoginContinuation) (NSURL *__nullable redirectedURL, NSError *__nullable error) |
Callback that will be passed to your CBLOIDCLoginCallback.
You should call this callback when your login UI completes, so that Couchbase Lite's replicator can continue or stop.
| redirectedURL | The authentication URL to which the WebView was redirected. It will have the same host and path as the redirectURL passed to your login callback, plus extra query parameters appended. If login did not complete successfully, pass nil. |
| error | If the login UI failed, pass the error here (and a nil authURL.) As a special case, if both error and authURL are nil, it's interpreted as an authentication- canceled error. |