Skip to content

Instantly share code, notes, and snippets.

@robertolos
Created May 19, 2018 09:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertolos/380ffb1c9f3d0f172a8148a036808f88 to your computer and use it in GitHub Desktop.
Save robertolos/380ffb1c9f3d0f172a8148a036808f88 to your computer and use it in GitHub Desktop.
Serve Google assetlinks.json using spring boot
package com.adaptyou.wama.server.web.rest;
import com.codahale.metrics.annotation.Timed;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.net.URISyntaxException;
@RestController
public class GoogleResource {
private final Logger log = LoggerFactory.getLogger(GoogleResource.class);
@RequestMapping(value = "/.well-known/assetlinks.json",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<String> createProduct() throws URISyntaxException {
log.debug("REST request to get assetlinks.json");
return ResponseEntity.ok().body("[{\n" +
" \"relation\": [\"delegate_permission/common.get_login_creds\"],\n" +
" \"target\": {\n" +
" \"namespace\": \"web\",\n" +
" \"site\": \"https://www.wama.cloud\"\n" +
" }\n" +
"},\n" +
"{\n" +
" \"relation\": [\"delegate_permission/common.get_login_creds\"],\n" +
" \"target\": {\n" +
" \"namespace\": \"android_app\",\n" +
" \"package_name\": \"com.fullstack3.wama\",\n" +
" \"sha256_cert_fingerprints\": [\n" +
" \"00:11:22:33:44:55:66:77:88:99:........................................\"\n" +
" ]\n" +
" }\n" +
"}\n" +
"]");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment