Giter Site home page Giter Site logo

secured's Introduction

SSL Component

This Secured component allows you to programmatically define which controller actions should be served under a secure HTTPS connection.

Most of the time, this functionality is achieved through judicious use of rewrite/redirect rules in your webserver (Apache, Lighhtpd, Nginx, etc.). Defining this logic in your webserver is advantageous - an incorrect request never hits your application code, and it could be handled by a proxy to ensure that your application servers are not bothered with requests they cannot serve.

However, there are cases where the programmatic definition of which controllers & actions is desirable - 1) during development, 2) situations where you do not have access to .htaccess or the webserver configuration, 3) when static definitions of secured URLs do not suffice.

This very simple component attempts to address the above issues, and allows for a very intuitive and straightforward configuration. Here is a sample config, where we desire that the login action within the users controller to be served via HTTPS, and all store actions to be served via HTTPS:

/* app_controller.php */

/**
 * Components for all controllers.
 *
 * @var array Components, with optional configuration directives.
 */
 public $components = array(
 	'Secured.Ssl' => array(
 		'secured' => array(
 			'users' => 'login',
 			'store' => '*'
 		),
 	    'autoRedirect' => true,  // Set to false to temporarily disable this component
 	    'prefixes' => 'admin'   // Allow securing areas by prefix routing. In this case, the whole admin area
 	)
 );

Requirements:

  • A valid and properly installed/configured SSL certificate.
  • This component.
  • CakePHP 1.2/1.3 (the latter has not been tested, but should work without issue).

Things that need to be done:

  • Test cases

secured's People

Contributors

chronon avatar jperras avatar meeech avatar

Stargazers

rnsk avatar Hiroki Shimizu avatar  avatar ionas avatar Takashi Nojima avatar Yasushi Ichikawa (ichikaway) avatar  avatar Kaz Watanabe avatar Christopher Vrooman avatar Ken’ichiro Oyama avatar Somchok Sakjiraphong avatar Jason Miyashiro avatar Kevin van Zonneveld avatar Juan Basso avatar Graham Weldon avatar

Watchers

Patrick McFern avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.