Skip to Content
0

Individual WebView for authentication

Apr 07, 2017 at 09:29 AM

92

avatar image
Former Member

Can someone elaborate a little bit more on the documentation as to how to implement an individual login WebView for authentication.

This is what the documentation says:

class MyViewController: UIWebViewPresenting {
    weak var delegate: WebViewPresenterDelegate?
    public func presentWebView(completionHandler: @escaping (UIWebView?, Error?) -> Void) {
        // implementation
    }

    func dismissWebView() {
        // implementation
    }
}

Maybe I'm missing something, but how would you implement this?

iOS
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Andreas Schlosser
Apr 10, 2017 at 08:46 AM
2

Daniel,

This is only required if you want to use your own web views during the OAuth2 and/or SAML authentication flows. If this is what you want to do, you can implement the `presentWebView` method to create your custom UIWebView and pass it into the `completionHandler` - and implement dismissal of your custom web view in the `dismissWebView` method. The SDK will then use this web view to render the OAuth2 or SAML login screen inside. This screen / webpage itself comes from the configured IdP, e.g. SAP ID service.

In case you simply want to implement a username/password authentication screen - none of this is required. You could simply use Xcode Interface Builder and design your screen as you wish, and then implement the basic authentication callback on your SAPURLSession.

Thanks
Andreas

Share
10 |10000 characters needed characters left characters exceeded
Robin van het Hof
Apr 07, 2017 at 10:35 AM
0

Hi Daniel,

I'm not too sure, but isn't this where you create an instance to the web view and pass it on vs. removing the instance?

Just out of curiosity, what is your use case to use a custom implementation of UIWebViewPresenting?

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Maybe I was unclear in my original question. Not trying to use a custom implementation of the protocol. Simply trying to find information as to how to display a custom login page using the protocol.

0