arcgis-maps-sdk-swift-toolkit
arcgis-maps-sdk-swift-toolkit copied to clipboard
Authenticator: Can the OAuth configs be a read/write property?
trafficstars
It would be great if the oauth configs could be a readwrite property. As it is now, I have to assign a brand new Authenticator if the oauth settings change:
...
.onChange(of: oAuthSettings.userConfiguration) { oldValue, newValue in
// When the oAuth settings change, must create new authenticator.
Logger.authentication.info("OAuthUserConfiguration has changed.")
setupAuthenticator()
}
.onChange(of: oAuthSettings.useOAuth) {
Logger.authentication.info("OAuthSettings `useOAuth` has changed.")
setupAuthenticator()
}
}
}
func setupAuthenticator() {
var configs = [OAuthUserConfiguration]()
if oAuthSettings.useOAuth, let config = oAuthSettings.userConfiguration {
configs.append(config)
}
authenticator = Authenticator(promptForUntrustedHosts: true, oAuthUserConfigurations: configs)
ArcGISEnvironment.authenticationManager.handleChallenges(using: authenticator)
}
cc @njarecha
Yes, making this a readwrite property will be helpful for our users.