When my application is invoked with a redirect url, I need to validate the redirect url against a predefined list of valid domains. For example the application can be invoked as follows:
An example of the comma separated list of valid domain names that I have
Now my application will validate the url in the goto request parameter against the predefined list(as mentioned above)
My question here is
what is the best way to validate the url against the comma separated list of domain names.
One option that I have is to token-ise the domain list and then see if the url contains the valid domain or not. This requires string parsing.
The other option of using URL or URI classes for this purpose doesn't work in case of wild cards.