More Security Added For Your Backbonejs Apps


I've been exploring this simple login mechanism used by Clint where he simply depends on the PHP session to authorize the user on every request made to PHP REST server. Alhamdulillah it solves my problem on how to authenticate user on BackboneJs apps (star or fork it here). But I still feel something is not right because when you are building the Ajax apps, you cannot simply authorize the session or cookie just like you usually do your traditional PHP apps. I read more about how to validate, authorize, authenticate, etc the AJAX apps.

After spending time reading this, I thought Clint's apps lack of basic CSRF. So here is snippet to make your BackboneJs Apps more secure
Please refer to index.php file where you can see all the slim framework code, look for function name "login" and "authorize" 
Simply replace the code above. The snippet now will authenticate every request made to the server. Check this out in your debugger console.

Before user login

After login and request protected data






As for the front end, you will need to modify your login script by define the request header

The flow with this approach may go something like this:
The user navigates in their browser to the BackboneJs application The server returns a basic web page and a JavaScript application The JavaScript application can’t find an authentication token in the web site’s cookies The JavaScript application displays a login form The user enters correct login credentials and then submits the form The server validates the login information and creates an authentication token for the user The server sets the authentication token in a cookie/session and returns it to the JavaScript application The JavaScript application makes a request for some protected data, sending the authentication token in a custom header The server validates the token and then returns the data as you noticed, i used jQuery's function and Twitter Bootstrap's CSS class.

Artikel ini hanyalah simpanan cache dari url asal penulis yang berkebarangkalian sudah terlalu lama atau sudah dibuang :

http://web-scents.blogspot.com/2014/01/more-security-added-for-your-backbonejs.html

Kempen Promosi dan Iklan
Kami memerlukan jasa baik anda untuk menyokong kempen pengiklanan dalam website kami. Serba sedikit anda telah membantu kami untuk mengekalkan servis percuma aggregating ini kepada semua.

Anda juga boleh memberikan sumbangan anda kepada kami dengan menghubungi kami di sini
Start Your Bitcoin Journey Here Buy And Sell Crypto Now More Profit

Start Your Bitcoin Journey Here Buy And Sell Crypto Now More Profit

papar berkaitan - pada 8/11/2021 - jumlah : 595 hits
DigitalAsetMalaysia 2 10 2021 11 05 AM Lancarkan Impian Anda Untuk Miliki Digital Aset Bitcoin dan Lain lain Sekarang Juga PROMOSI Sekarang DAFTAR PERCUMA ZOOM Webinar Percuma untuk penerangan lanjut Maklumat Lanjut Hubungi Amir Maju ditali...
Malaysians Unite By Walking More Than A Million Miles For Heart Health

Malaysians Unite By Walking More Than A Million Miles For Heart Health

papar berkaitan - pada 12/11/2021 - jumlah : 233 hits
NESTL OMEGA PLUS Walk a Million Miles Virtual Event sets a new record in its 2nd year running with a total of 1 176 666 miles achieved Cheque presentation from NESTL OMEGA PLUS to Yayasan Jantung Malaysia and Institut Jantung Negara Foundat...
The All In One Kitchen Assistant For All Your Cooking Needs

The All In One Kitchen Assistant For All Your Cooking Needs

papar berkaitan - pada 13/11/2021 - jumlah : 235 hits
In this day and age convenience reigns supreme We want everything here and now easily and with as little hassle as possible With Malaysians once again urged to stay home and restaurants closing by 8PM to curb the spread of the pandemic cook...
Qualcomm Launches A Special Edition Smartphone For Snapdragon Insiders

Qualcomm Launches A Special Edition Smartphone For Snapdragon Insiders

papar berkaitan - pada 12/11/2021 - jumlah : 368 hits
Technology Portfolio Net Qualcomm has just announced the presence of a smartphone aimed at Snapdragon Insiders in collaboration with Asus The device called Smartphone for Snapdragon Insiders by Asus was announced at the Snapdragon Insiders ...
What To Expect For Your 2021 Lexus Maintenance Cost

What To Expect For Your 2021 Lexus Maintenance Cost

papar berkaitan - pada 18/11/2021 - jumlah : 245 hits
Lexus maintenance costs are affordable compared to the industry average Maintaining a Lexus is even more affordable when compared to other luxury vehicles Drivers can use extended car warranties and prepaid maintenance plans to lower Lexus ...
Allocate More Funds Widen Scope For Audit Dept Johor Baru Mp

Allocate More Funds Widen Scope For Audit Dept Johor Baru Mp

papar berkaitan - pada 9/11/2021 - jumlah : 255 hits
PARLIAMENT Akmal Nasir has urged the government to increase the allocation for the National Audit Department and widen its scope so that it can audit concessionaires that handle government funds as well This is after he explained how corrup...
Tips On How To Choose The Ideal Wooden Sconce For Your Home

Tips On How To Choose The Ideal Wooden Sconce For Your Home

papar berkaitan - pada 16/11/2021 - jumlah : 408 hits
Charming and timeless the wooden sconce is an invitation to comfortable and relaxing environments And believe us it goes far beyond the rustic style Keep following the post to find out more about the wooden The post appeared first on
Creating The Perfect Home For Your Family A Guide

Creating The Perfect Home For Your Family A Guide

papar berkaitan - pada 11/11/2021 - jumlah : 273 hits
When you are a housewife and a parent you will want to create the perfect home for your family while they are at school Then read on for some of the best tips and tricks that will allow you to create a homely and cozy space that is also com...
Iron Air 45 Bike Exif For Your Coffee Table

Iron Air 45 Bike Exif For Your Coffee Table

papar berkaitan - pada 21/11/2021 - jumlah : 384 hits
A quick break from our usual fare because we have an announcement to make of Iron Air magazine is back from the printers and shipping now It s focused on Bike EXIF and its influence on the 21st century custom scene and it s packed with prof...
Khutbah Dikuasai Dap Laporan Polis Dibuat Pada Pemimpin Pas

Urban Renewal Act The Good And The Not So Good

Many Malaysians At Risk Of Depression Says Dzulkefly

Arakurayama Sengen Park Fujiyoshida

Lirik Lagu Sesalku Edysport

Lelaki Oku Tetak Bapa Akhirnya Ditahan Setelah Dua Hari Menghilangkan Diri

The Latest Recall Alert For Kia Soul And Seltos Owners Engine Concerns

Zarina Anjoulie Dakwa Bekas Suami Culas Bayar Nafkah Zaman Sekarang Banyak Bapa Tak Guna Tengok Anak Pun Taknak


echo '';
Biodata Miki Ghazali Mikail Atlet Muay Thai Adik Beradik Kepada Johan Ghazali Jojo Mia Elias

Senarai Keputusan Pemenang Calon Top 5 Kategori Persembahan Penyampai Trofi Undian Tarikh Tiket Gempak Most Wanted Awards 2024 2025 Live Di Astro Ria Sooka

10 Drama Melayu Terbaru Astro Yang Best 2025 Mesti Tonton Juga Tersedia Online

10 Filem Melayu Malaysia Terbaru Best 2024 2025 Mesti Tonton

Info Dan Sinopsis Drama Berepisod Teratak Kasih Salina Rindu Kasih Musim 3 Slot Samarinda TV3


Makan Masakan Thai Di Arked Niaga Padang Besar Perlis

Drama Deejay Kampung

Anggrek Cinto Putiah Babungo Ungu Chord

Bufet Ramadan 2025 Sinar Ramadan Di I Dahlia Corner

Penerangan Jenis Jenis Hidung Manusia Dan Ciri Hidung Menarik

Dua Pilihan