I am trying to achieve the following using Polymer Custom Element.
- Detect the domain name from where the request is coming for rendering custom element
- If domain name matches [ basically - if authorized ] then render the custom element template
- If domain name not matches / not authorized redirect to error page polymer template
I have created a custom HTML element - which i am providing to other sites; if the other site/domain authorize with my site - then only i should display the custom polymer element / otherwise i should display error template.
Is this possible to do ?
or the moment someone adds my-custom-element to their site they can use it without restriction i put in place ? Please let me know if I am missing something obvious here.
The following polymer elements also do not provide me any capabilities to achieve the desired results as well.
<app-route>
<app-route-converter>
For example :
Let's say someone is using my-custom-element.html in their site / HTML pages.
If my-custom-element.html is being used in valid/authorized domain ; then it should serve the custom Polymer element; if my-custom-element.html is being used in invalid / not authorized domain - in that case it should display the error portion of the element template.
Valid uses-cases:
- xyz.com/
- subdomain.xyz.com/
- xyz.com/*
Invalid use-cases :
- anyotherdomain.com
Please note : I am currently authenticating the domain owners using Oauth providers. But those Oauth tokens would not be passed along with all the requests originating from their respective sites. The way I am authorizing the validity is using the "domain" [If it's registered with my site or not]