MSALWebviewParameters

Objective-C

@interface MSALWebviewParameters : NSObject <NSCopying>

Swift

class MSALWebviewParameters : NSObject, NSCopying

User Interface configuration that MSAL uses when getting a token interactively or authorizing an end user.

Configuration options

  • The view controller to present from. If nil, the current topmost view controller will be used.

    Declaration

    Objective-C

    @property (nonatomic, weak, nullable) MSALViewController *parentViewController;

    Swift

    weak var parentViewController: UIViewController? { get set }
  • Modal presentation style for displaying authentication web content. Note that presentationStyle has no effect when webviewType == MSALWebviewType.MSALWebviewTypeDefault or webviewType == MSALWebviewType.MSALWebviewTypeAuthenticationSession.

    Declaration

    Objective-C

    @property (nonatomic) UIModalPresentationStyle presentationStyle;

    Swift

    var presentationStyle: UIModalPresentationStyle { get set }
  • A Boolean value that indicates whether the ASWebAuthenticationSession should ask the browser for a private authentication session. The value of this property is false by default. For more info see here: https://developer.apple.com/documentation/authenticationservices/aswebauthenticationsession/3237231-prefersephemeralwebbrowsersessio?language=objc

    Declaration

    Objective-C

    @property (nonatomic) BOOL prefersEphemeralWebBrowserSession;

    Swift

    var prefersEphemeralWebBrowserSession: Bool { get set }
  • A specific webView type for the interactive authentication flow. By default, it will be set to MSALGlobalConfig.defaultWebviewType.

    Declaration

    Objective-C

    @property (nonatomic) MSALWebviewType webviewType;

    Swift

    var webviewType: Int32 { get set }
  • For a webviewType MSALWebviewTypeWKWebView, custom WKWebView can be passed on. Web content will be rendered onto this view. Observe strings declared in MSALPublicClientStatusNotifications to know when to dismiss.

    Declaration

    Objective-C

    @property (nonatomic, nullable) WKWebView *customWebview;

    Swift

    var customWebview: WKWebView? { get set }

Constructing MSALWebviewParameters

  • Deprecated

    Use -initWithAuthPresentationViewController: instead.

    Creates an instance of MSALWebviewParameters with a provided parentViewController.

    Note

    parentViewController is mandatory on iOS 13+. It is strongly recommended on macOS 10.15+ to allow correct presentation of ASWebAuthenticationSession. If parentViewController is not provided on macOS 10.15+, MSAL will use application’s keyWindow for presentation

    Declaration

    Objective-C

    - (nonnull instancetype)initWithParentViewController:
        (nonnull MSALViewController *)parentViewController;

    Swift

    init(parentViewController: UIViewController)

    Parameters

    parentViewController

    The view controller to present authorization UI from.

  • Creates an instance of MSALWebviewParameters with a provided parentViewController.

    Note

    parentViewController is mandatory on iOS 13+. It is strongly recommended on macOS 10.15+ to allow correct presentation of ASWebAuthenticationSession. If parentViewController is not provided on macOS 10.15+, MSAL will use application’s keyWindow for presentation

    Declaration

    Objective-C

    - (nonnull instancetype)initWithAuthPresentationViewController:
        (nonnull MSALViewController *)parentViewController;

    Swift

    init(authPresentationViewController parentViewController: UIViewController)

    Parameters

    parentViewController

    The view controller to present authorization UI from.

  • It is recommended to use the default webview configuration setting provided by a public MSAL API. ex: WKWebViewConfiguration *defaultWKWebConfig = [MSALWebviewParameters defaultWKWebviewConfiguration]; WKWebView *embeddedWebview = [[WKWebView alloc] initWithFrame:yourWebview.frame configuration:defaultWKWebConfig];

    Declaration

    Objective-C

    @property (class, nonatomic, readonly) WKWebViewConfiguration *_Nonnull defaultWKWebviewConfiguration;

    Swift

    class var defaultWKWebviewConfiguration: WKWebViewConfiguration { get }

Unavailable initializers

  • Deprecated

    Use -initWithAuthPresentationViewController: instead.

    Undocumented

    Declaration

    Objective-C

    - (nonnull instancetype)init DEPRECATED_MSG_ATTRIBUTE("Use -initWithAuthPresentationViewController: instead.");

    Swift

    init()
  • Deprecated

    Use -initWithAuthPresentationViewController: instead.

    Undocumented

    Declaration

    Objective-C

    + (nonnull instancetype)new DEPRECATED_MSG_ATTRIBUTE("Use -initWithAuthPresentationViewController: instead.");

    Swift

    class func new() -> Self