Print Data and Opening URLs Restriction¶
The SAP BTP SDK for Android has introduced print data and opening URLs restrictions. The print data restriction blocks the printing of data. This secures sensitive data from being compromised.
The URL opening restriction prevents URLs from opening in external browsers or other applications. It also protects your data from potential malware and other threats.
Enable Policy¶
Admin can enable these two policies by enabling Restrict Print Data and Restrict Opening URLs in the Client Configuration tab under the Mobile Settings Exchange feature in mobile services cockpit.
Add AppManagementService¶
An app developer can leverage these two features by adding the AppManagementService instance to the SDKInitializer.start method.
val services = mutableListOf<MobileService>()
services.add(AppManagementService())
SDKInitializer.start(this, * services.toTypedArray())
AppManagementService will check the two policies configured in mobile services cockpit. If Restrict Print Data and Restrict Opening URLs are not enabled, adding AppManagementService will not have any effect in the client app.
Note
Client apps can open mobile services onboarding or logout URLs in external browsers when the OAuth authentication option is set to CCT in flows.
Bypass the Restriction¶
If you want to bypass the opening URLs restriction, you can set the ALLOW_OPEN_URL extra property to true in the request intent. The URL then opens in an external browser or another application.
import com.sap.cloud.mobile.foundation.common.ALLOW_OPEN_URL
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("http://www.sap.com")).apply {
putExtra(ALLOW_OPEN_URL, true)
}
startActivity(intent)
Opening URLs Allowlist¶
When Restrict Opening URLs` is enabled, the admin can optionally configure an allowlist in mobile services cockpit to permit specific URLs while blocking all others. If no allowlist is configured, all URLs are blocked unconditionally.
Each allowlist entry has a type and a value:
scheme: Allows any URI whose string starts with the given value (prefix match).url: Allows an exact URI match. Supports*as a wildcard for any character sequence.regex: Allows any URI that matches the regular expression.
Examples¶
Allow all phone calls and a specific website:
{ "type": "scheme", "value": "tel:" },
{ "type": "url", "value": "https://example.com/path" }
Allow all SAP domains using a regex:
{ "type": "regex", "value": "^https://.*\\.sap\\.com/.*$" }
Allow a section of a site using a wildcard URL:
{ "type": "url", "value": "https://help.sap.com/*" }
Note
The scheme type performs a prefix match on the full URI string, not only the URI scheme component. For example, "tel:+49" only allows phone numbers starting with +49, while "tel:" allows all phone calls. The admin is responsible for choosing values with the appropriate scope.