Recently we’ve done lots of backends for IOS apps, Flash sites, Facebook apps and such. In most cases, it’s just a matter of responding with JSON to a HTTP request, saving or fetching something from a datasource. The problem is that it’s fairly easy to sniff the request, change a few parameters and submit a forged request. Up until now, we’ve done authentication on an ad hoc basis, but last week i whipped up a simple CodeIgniter library to standardize the way we do this authentication. Here it is.
This is how to work it:
1. Place this file in application/libraries/
2. Load or autoload it
3. In your controller, use this to validate a request:
1. Place this file in application/libraries/
2. Load or autoload it
3. In your controller, use this to validate a request:
if($this->checksum->validate()){ # keep calm and carry on }else{ # respond that the checksum was bad }
http://earthpeople.se/labs/2012/04/signed-requests-with-codeigniter/
0 komentar:
Posting Komentar