From 6521bc668f25471793314c804ce9f7cb8244845d Mon Sep 17 00:00:00 2001 From: Chiping Yeh Date: Tue, 18 Mar 2025 16:37:46 -0400 Subject: [PATCH] Add digital asset linking snippets --- .../main/digitalAssetLinking/assetlinks.json | 33 ++++++++++++++ .../main/digitalAssetLinking/othersnippets | 45 +++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 identity/credentialmanager/src/main/digitalAssetLinking/assetlinks.json create mode 100644 identity/credentialmanager/src/main/digitalAssetLinking/othersnippets diff --git a/identity/credentialmanager/src/main/digitalAssetLinking/assetlinks.json b/identity/credentialmanager/src/main/digitalAssetLinking/assetlinks.json new file mode 100644 index 000000000..34168d435 --- /dev/null +++ b/identity/credentialmanager/src/main/digitalAssetLinking/assetlinks.json @@ -0,0 +1,33 @@ +/* + * Copyright 2025 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// [START android_identity_assetlinks_json] +[ + { + "relation" : [ + "delegate_permission/common.handle_all_urls", + "delegate_permission/common.get_login_creds" + ], + "target" : { + "namespace" : "android_app", + "package_name" : "com.example.android", + "sha256_cert_fingerprints" : [ + SHA_HEX_VALUE + ] + } + } +] +// [END android_identity_assetlinks_json] \ No newline at end of file diff --git a/identity/credentialmanager/src/main/digitalAssetLinking/othersnippets b/identity/credentialmanager/src/main/digitalAssetLinking/othersnippets new file mode 100644 index 000000000..66ea809a8 --- /dev/null +++ b/identity/credentialmanager/src/main/digitalAssetLinking/othersnippets @@ -0,0 +1,45 @@ +/* + * Copyright 2025 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Enable host to permit Google to retrieve the DAL +// [START android_identity_assetlinks_allow_host] +User-agent: * +Allow: /.well-known/ +// [END android_identity_assetlinks_allow_host] + +// Manifest file addition +// [START android_identity_assetlinks_manifest] + +// [END android_identity_assetlinks_manifest] + +// Declare association in Android app +// [START android_identity_assetlinks_app_association] + +[{ + \"include\": \"https://signin.example.com/.well-known/assetlinks.json\" +}] + +// [END android_identity_assetlinks_app_association] + +// Example status code to test DAL +// [START android_identity_assetlinks_curl_check] +> GET /.well-known/assetlinks.json HTTP/1.1 +> User-Agent: curl/7.35.0 +> Host: signin.example.com + +< HTTP/1.1 200 OK +< Content-Type: application/json +// [END android_identity_assetlinks_curl_check] \ No newline at end of file