Monday, March 1, 2010

Re: SSL and https

I've only just got around to trying this - and it fits the bill really nicely thanks.

Jeremy Burns


On 18 Feb 2010, at 09:29, jperras wrote:

> http://github.com/plank/secured
>
> -jperras.
>
> On Feb 17, 12:54 am, Jeremy Burns <jeremybu...@me.com> wrote:
>> Any takers on this please?
>>
>> Jeremy Burns
>> jeremybu...@me.com
>>
>> On 12 Feb 2010, at 05:00, Jeremy Burns wrote:
>>
>>
>>
>>> I am using the security component from app_controller. In some
>>> controllers I have this in my beforeFilter:
>>
>>> if (in_array($this->params['action'], $action)):
>>> $this->Security->blackHoleCallback = 'forceSSL';
>>> $this->Security->requireSecure();
>>> else:
>>> $this->Security->blackHoleCallback = 'unforceSSL';
>>> endif;
>>
>>> I have these two functions in app_controller:
>>
>>> function forceSSL() {
>>
>>> $this->redirect('https://' . env('SERVER_NAME') . $this->here);
>>
>>> }
>>
>>> function unforceSSL() {
>>
>>> $this->redirect('http://' . env('SERVER_NAME') . $this->here);
>>
>>> }
>>
>>> This is working in the sense that the right actions in the right
>>> controllers are being redirected to https. But once I am in https, I
>>> stay there.
>>
>>> My question is: how do I get the site to go back to http for those
>>> controller actions that do not require https?
>>
>>> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions.
>>
>>> You received this message because you are subscribed to the Google Groups "CakePHP" group.
>>> To post to this group, send email to cake-php@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> cake-php+unsubscribe@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: