lfedcm-identity.provider-create.sub.html (1105B)
1 <!doctype html> 2 <head> 3 <title>Helper to create 'identity' credentials for discovery</title> 4 </head> 5 <script> 6 'use strict'; 7 8 async function createCredentials(params) { 9 let identityData = { 10 id: params.get("id"), 11 } 12 if (params.get("origin")) { 13 identityData.effectiveOrigins = [params.get("origin")] 14 } 15 if (params.get("type")) { 16 identityData.effectiveType = params.get("type") 17 } 18 if (params.get("url") == "cors") { 19 identityData.effectiveQueryURL = "https://{{hosts[alt][]}}:{{ports[https][0]}}/fedcm/support/acao-cors.py"; 20 } else if (params.get("url") == "no-cors") { 21 identityData.effectiveQueryURL = "https://{{hosts[alt][]}}:{{ports[https][0]}}/fedcm/support/no-cors.py"; 22 } 23 return navigator.credentials.store(await navigator.credentials.create({ 24 identity: identityData 25 })) 26 } 27 28 29 const queryString = window.location.search; 30 const params = new URLSearchParams(queryString); 31 createCredentials(params).then(() => { 32 if (params.has("close")) { 33 window.close(); 34 } 35 if (params.has("postMessage")) { 36 window.opener.postMessage("created", "*"); 37 } 38 }); 39 40 41 </script>