MSALAuthority

Objective-C

@interface MSALAuthority : NSObject <NSCopying>

Swift

class MSALAuthority : NSObject, NSCopying

MSALAuthority represents an identity provider instance that MSAL can use to obtain tokens. For AAD it is of the form https://aad_instance/aad_tenant, where aad_instance is the directory host (e.g. https://login.microsoftonline.com) and aad_tenant is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)

Note

The MSALAuthority class is the base abstract class for the MSAL authority classes. Don’t try to create instance of it using alloc or new. Instead, either create one of its subclasses directly (MSALAADAuthority, MSALB2CAuthority) or use the factory method authorityWithURL:error: to create subclasses using an authority URL.

Getting a normalized authority URL

  • url

    Normalized authority URL.

    Declaration

    Objective-C

    @property (readonly, nonnull) NSURL *url;

    Swift

    var url: URL { get }

Unavailable initializers

  • Unavailable

    Note

    Use [MSALAuthority authorityWithURL:error:] instead

    Declaration

    Objective-C

    - (nonnull instancetype)init;
  • Unavailable

    Note

    Use [MSALAuthority authorityWithURL:error:] instead

    Declaration

    Objective-C

    + (nonnull instancetype)new;

Constructing MSALAuthority

  • Factory method that parses input authority URL and tries to detect its type automatically.

    Note

    This initializer will work in most AAD and some B2C cases. However, some valid authorities might be misclassified. Initialize MSALAADAuthority or MSALB2CAuthority directly for better reliability.

    Declaration

    Objective-C

    + (nullable MSALAuthority *)authorityWithURL:(nonnull NSURL *)url
                                           error:
                                               (NSError *_Nullable *_Nullable)error;

    Swift

    /*not inherited*/ init(url: URL) throws

    Parameters

    url

    Authority URL that MSAL can use to obtain tokens.

    error

    The error that occurred creating the authority, if any, if you’re not interested in the specific error pass in nil.