URLSessionConfiguration

An extention that allows the auto population of certain Predix request headers

  • Creates a new URLSessionConfiguration pre-populated with standard headers needed to do network operations with applications and services hosted on the Predix platform.

    If an application authenticates with Predix UAA using the PredixAuthenticationManager this configuration will have access to the UAA bearer token and will auto populate the Predix Authrorization header with the bearer token retrieved by the PredixAuthenticationManager.

    NOTE The bearer token is not persisted to storage and is only available for a given session, if the application is force closed by the user or by iOS the token will be lost and will not be available via the configuration until the user/application is re-authenticated.

    Declaration

    Swift

    public static var predix: URLSessionConfiguration
  • Sets the PredixUAAAccessToken you want to use to pre-populate the authentication headers that use this configuration

    Declaration

    Swift

    public func setUAAAccessToken(token: PredixUAAAccessToken)

    Parameters

    accessToken

    The PredixUAAAccessToken token you want to use to populate the authentication headers for the URLSessions that use this config

  • Allows URLSessions that use this configuration to return mock data

    See MockNetworkDataManager for more information

    Declaration

    Swift

    public func enableMockDataResponse()