Monday, November 21, 2011

Symfony 2 - User Direct Login / Single Sign On

In applications integration, single sign on is mandatory. In this post, I won't cover how applications integration process. To be more specific, I assume you know how to integrate/share users between multiple applications.

This piece of code bellow will show how to do a login process in symfony 2 programatically for single sign on purpose. But before you can use the following code you have to implement your own custom user class implementing UserInterface for Symfony 2, custom role class implementing RoleInterface and have read Symfony 2 manual about how to setup a firewall in Symfony security configuration file.

The scenario :

We have exisiting web based application called Alice, and I write new application with Symfony 2 called Bob. Now, we want to integrate Bob as part of Alice application. The situation is Alice already have users because it was still used. And Bob will use users from Alice as its users.

The requirements :

Users want to login only one time from Alice login page in order to use both Alice and Bob applications.

The solution :


Flow chart

In above scheme, when a user try to access Bob, it will check for the user's credentials of Alice. If Bob found the user is not authenticated from Alice, it will send a redirect response to Alice login page. If the user is an authenticated user of Alice, then Bob will ask Alice the all the user information it needs and mark the user as an authenticated user in Bob application.

So in Bob authentication validator, we can use the following code to mark the authenticated user of Alice as an authenticated user of Bob.


$token = new UsernamePasswordToken($user, null, $firewall, $user->getRoles());
$this->get('security.context')->setToken($token);
$session = $this->get('session');
$session->set('_security_'.$firewall,serialize($token));

Happy coding (:


Read more!

Thursday, August 25, 2011

[Symfony 2] Assetic with jqueryui

I've been learning to use Symfony 2 for a couple of days and quite astonished by how Symfony 2 is able to simplify most of web application development process without losing flexibility and scalability which is needed by every web programmer.

Standard package of Symfony 2 framework comes with many features from 3rd party vendor. One of them is Assetic, asset management framework for web resources, such as css stylesheet files and javascript files.

One of the problems i've encountered when learning to use Assetic was there's only few documentations and was poorly written. Maybe it was due to Symfony 2 is still in an early stage. This post will show you how to integrate Jquery-UI with Assetic.

First, we need to create a subfolder under 'Resources' folder named 'public' in our Symfony 2 bundle folder. This folder will hold all of our CSS and javascript files.

Inside the folder, we add css file from jquery-ui installation file.

From our console in top directory of symfony installation, run bellow command :

$php app/console assetic:dump

to tell assetic to generate dynamic css and javascript file.

Then run :

$php app/console assets:install --symlink web


to install the generated files from previous step.

After installed, we can use asset_url in twig as usual.

The problem occur when jquery-ui css file trying to find images in the url.


The solution is to move the whole jquery-ui images directory :

./jqueryui-1.x.x/themes/images/

to Symfony 2 web css dir. So the directory will be like :

./web/css/images

And your jquery-ui css will run as it supposed to be. (:


Read more!

Monday, August 1, 2011

Rooting manual android

REQUIREMENTS : - Linux *of course! 8-) - Android SDK with  - busybox binary - Superuser.apk  - psneuter exploit binary - su-v2 binary You can find all the files listed above from SuperOneClick installed directory in M$ WINDOZ.
On Linux machine :
!! Make sure adb server is running as root. !!

$./adb push psneuter /data/local/tmp
$./adb push su-v2 /data/local/tmp
$./adb push busybox /data/local/tmp
$./adb shell
On android console :
$ busybox chmod +x /data/local/tmp/psneuter
$ /data/local/tmp/psneuter /* you will get logged out from android console and just run*/
$./adb shell /* again to get android shell back as root. */
# mount  /* find entry for '/system' mount */
/dev/stl12 /system rfs ro,relatime,vfat,log_off,check=no,gid/uid/rwx,iocharset=utf8 0 0
# mount -t rfs -r -w -o remount /dev/stl12 /system /* change the command according to your device. */
# busybox mv /data/local/tmp/su-v2 /system/xbin/su 
# busybox chmod 06755 /system/xbin/su 
# busybox chown 0.2000 /system/xbin/su 
# busybox ln -s /system/xbin/su /system/bin/su  
# busybox cp /data/local/tmp/busybox /system/xbin 
# busybox chmod 0755 /system/xbin/busybox 
# busybox chown 0.2000 /system/xbin/busybox 
# exit 
$ exit
Back to Linux machine :
./adb install Superuser.apk 
There, ur droid is rooted! :D


Read more!

Friday, June 3, 2011

AOSI need our help...

Maaf email ini agak panjang, mohon yang ingin gabung
sebagai penyedia jasa di bidang FOSS
(secara gratis maupun berbayar) bersedia membaca :-)

PENGANTAR

AOSI mengajak berbagai komunitas Linux dan FOSS di Indonesia
menyediakan dukungan teknis dan non teknis bagi pengguna FOSS, a.l.:
- pemerintah, dalam rangka mencapai target akhir 2011 pakai FOSS,
- swasta, yang akan/sudah menggunakan FOSS,
- lembaga pendidikan, yang sudah/akan menggunakan FOSS,
- dan siapa saja, yang akan/sudah menggunakan FOSS.

Sebagai langkah awal, sekretariat AOSI di Jakarta akan menjadi
pusat informasi FOSS dalam bentuk Helpdesk melalui web, email, sms, dll.
Helpdesk diharapkan didukung anggota atau mitra AOSI di Jakarta dan
di tiap provinsi sehingga akan ada minimal 33 kantor perwakilan AOSI.

Sekretariat AOSI sebagai kantor pusat Helpdesk FOSS Nasional
akan mengelola dan meneruskan informasi kebutuhan jasa terkait FOSS
ke para anggota atau mitra AOSI yang memiliki kemampuan menyediakan
jasa/produk yang sesuai kebtuhan untuk mendukung penggunaan FOSS
oleh pemerintah pusat, pemda prov/kab/kota, swasta, pendidikan, dll.

AJAKAN KERJA SAMA

AOSI menawarkan kerja sama ini dalam bentuk keanggotaan atau
kemitraan sebagai semacam perwakilan AOSI di berbagai wilayah
dalam menyediakan helpdesk secara terbatas di masing-masing provinsi.
Beda keanggotaan dan kemitraan:
- keanggotaan: Institusi Anggota AOSI yang terikat dengan AD/ART AOSI.
- kemitraan: Bukan Anggota AOSI yang bekerja sama dengan AOSI,
 yang diadakan karena belum/tidak ada anggota AOSI yang bersedia di
suatu provinsi.

Jika ada bisnis atau proses pengadaan terkait helpdesk ini
tidak akan dikerjakan oleh AOSI sebagai organisasi non profit,
tapi oleh institusi anggota atau mitra AOSI
sesuai dengan kompetensi dan jenis usaha masing-masing anggota/mitra.
Perjanjian, kontrak kerja, SLA (Service Level Agreement)
atau yang sejenis juga menjadi tanggung jawab pihak-pihak
terkait yang melakukan perjanjian/kontrak.

Sekretariat AOSI sebagai pusat informasi atau penyedia layanan
tidak terikat perjanjian atau kontrak kerja dengan siapapun,
kecuali ikatan sebagai organisasi asosiasi dengan anggota dan mitranya.

TINDAK LANJUT

Helpdesk FOSS Nasional ini ditargetkan beroperasi
mulai pertengahan Juni 2011, atau paling lambat 1 Juli 2011.
AOSI akan merekrut minimal 1 orang tenaga penuh waktu
untuk mengelola kantor pusat Helpdesk FOSS di sekretariat AOSI.

Institusi yang berminat menjadi anggota atau mitra AOSI
sebagai helpdesk di daerah dimohon mengirim email
ke helpdesk@aosi.or.id CC: rusmanto@aosi.or.id
dengan isi email:

- Nama organisasi:
- Alamat di darat (lengkap nama kota dan provinsi):
- Alamat di internet (kalau ada website atau blog atau sejenis):

- Nama ketua atau penganggung jawab:
- No HP ketua/penganggung jawab:
- Email ketua/penanggung jawab:

- Nama kontak untuk helpdesk ini:
- No HP kontak untuk helpdesk ini:
- Email kontak untuk helpdesk ini:

- Bidang keahlian dan pengalaman kerja atau kegiatan terkait Linux dan FOSS:

- Daftar SDM dan jenis keahliannya:


Terima kasih telah membaca, silakan diteruskan ke teman atau milis yang sesuai.

Rus

Sumber : Milis aktivis linux indonesia


Read more!

Thursday, May 19, 2011

Mysql Workbench Slackware64 13.37

Sudah beberapa lama saya mencoba untuk menginstall source distribution Mysql Workbench pada Slackware64 multilib-enabled 13.37 saya. Struggling untuk menginstall library gnome dan pendukungnya sebagai depedensi Mysql Workbench, akhirnya tibalah saya mengkompilasi Mysql Workbench. Untuk memudahkan proses kompilasi, saya menggunakan Slackbuild script yang saya download dari sini.

Pada proses kompilasi, saya menemukan error seperti ini :


/usr/lib64/../lib/libstdc++.so: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make[4]: *** [mysqlcppconn.la] Error 1
make[4]: Leaving directory `/tmp/SBo/mysql-workbench-gpl-5.2.29-src/ext/cppconn/driver'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/tmp/SBo/mysql-workbench-gpl-5.2.29-src/ext/cppconn'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/tmp/SBo/mysql-workbench-gpl-5.2.29-src/ext'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/SBo/mysql-workbench-gpl-5.2.29-src'
make: *** [all] Error 2


Saya googling mencari jawaban dari error ini yang saya prediksikan karena betrok path dari arsitektur multilib.
Alhasil, saya berhasil menemukan referensi yang saya cari di sini dan di sini. Ternyata error dari proses kompilasi di atas memang di sebabkan oleh pakage multilib gcc-g++ dari alien bob, dan berdasarkan referensi pada link di atas, saya mencoba untuk menginstall gcc-g++ asli dari CD Slackware64 13.37 saya dengan terlebih dahulu meng-uninstall gcc-g++ multilib dari alien bob. Alhasil, mysql-workbench terkompilasi dengan lancar tanpa masalah dan Slackbuild script menghasilkan package mysql-workbench yang siap di install.

Setelah package Mysql Workbench terbentuk, saya kembali menginstall gcc-g++ multilib dari alien bob untuk mengembalikan Slackware saya ke multilib-enabled. Saya install package mysql-workbench dan sekarang saya bisa menggunakan mysql-workbench di Slackware64 saya.

Hope this will help anyone... :)

Referensi : Linux Question forum


Read more!