Canada offers refugee protection to people both inside and outside the country who fear persecution in their country of nationality or would face a risk to life or a risk of cruel and unusual treatment or punishment is they are to return to their home. Applications for refugee protection can be made either at the port of entry upon arrival in Canada, or after you have already entered the country with a temporary resident visa.
Refugees can also be sponsored to come to Canada if an application is made from overseas. This will often require that you be outside of your country of nationality and that you have been approved by the UNHCR in your current country of residence.