Вы уже пробовали наши Уроки ? По сути, вам нужен правильный набор настроек подключения:
struct Constants {
// The appID is the unique identifier of the application.
// It must be the the same ID as on the server, but it may be different
// from the bundle identifier of your application.
// static let appID = "com.sap.mit.native.intermediate.logon"
private static let sapcpmsURLString = "https://mobile-a326aab34.hana.ondemand.com/"
static let sapcpmsURL = URL(string: sapcpmsURLString)!
static let appURL = sapcpmsURL.appendingPathComponent(appID)
static let samlAuthURL = URL(string: "\(sapcpmsURL.absoluteString)SAMLAuthLauncher")!
static let samlFinishURL = URL(string: "\(sapcpmsURL.absoluteString)SAMLAuthLauncher?finishEndpointParam=someUnusedValue")!
}
Затем зарегистрируйтесь следующим образом (при условии аутентификации SAML):
public func authenticate(completionHandler: @escaping (_ error: Error?) -> Void) {
// this starts a SAML authentication against the SAP Cloud Platform if successfull it will be registered to the current urlSession
// let samlAuthenticationParameters = SAMLAuthenticationParameters(authorizationEndpointURL: Constants.samlAuthURL, finishEndpointURL: Constants.samlFinishURL)
let samlAuthenticator = SAMLAuthenticator(authenticationParameters: samlAuthenticationParameters)
let samlObserver = SAMLObserver(authenticator: samlAuthenticator)
urlSession.register(samlObserver)
samlAuthenticator.authenticate(completionHandler: completionHandler)
}