Zend AMF Authentication & Authorization

How do I secure my PHP services created with 'Connect To PHP' wizard?
The web is full of tutorials on connecting to PHP but I found nothing on securing the services.
The 'Connect to PHP' wizard generates a gateway.php which doesn't do authorization.
Do I have to replace this endpoint with my own? Why doesn't Adobe have tutorials on this?
maybe PHP apps are not meant to be safe?

I've been struggling with it, and figured it all out - so, perhaps it could help others.
The authentication is called on the server only if credentials supplied from the client (via the remote procedure call headers). This snippet illustrates the setup of custom auth (these are the last 6 lines of gateway.php script):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Handle request
$auth = new My_Amf_Auth(); // authentication
$server->setAuth($auth);
$acl = new Zend_Acl(); // authorization
$server->setAcl($acl);
echo $server->handle();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Now, your custom auth should extend Zend_Amf_Auth_Abstract. Since I want to authenticate users from a database, I bring the Zend_Auth_Adapter_DbTable to play. But since I cannot extend both Zend_Amf_Auth_Abstract and Zend_Auth_Adapter_DbTable, I use a composition:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<?php
require_once ('Zend/Amf/Auth/Abstract.php');
* AMF auth class by Danko Kozar, dankokozar.com
* @author dkozar
class My_Amf_Auth extends Zend_Amf_Auth_Abstract {
    function __construct() {
    public function authenticate() {
        $adapter = My_Db_Adapter::getInstance();            
        $adapter->setIdentity($this->_username);
        $adapter->setCredential($this->_password);
        // the adapter call
        // you can wrap it into try.. catch and process DB connection errors
        $result = Zend_Auth::getInstance()->authenticate($adapter);
        return $result;
?>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here's the adapter class:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<?php
* DB table adapter auth class for AMF by Danko Kozar, dankokozar.com
* @author dkozar
* Singleton
class My_Db_Adapter extends Zend_Auth_Adapter_DbTable {
    protected static $_instance = null;
     * private!
     * @param My_Db_Adapter $adapter
    public function __construct(Zend_Db_Adapter_Abstract $adapter = null) {
        if (!$adapter)
            $adapter = new Zend_Db_Adapter_Mysqli(
                array(
                    'dbname' => 'test',
                    'username' => 'root',
                    'password' => '')
        parent::__construct($adapter);
        $this
            ->setTableName('users')
            ->setIdentityColumn('username')
            ->setCredentialColumn('password')
        // just for testing
//        $this
//            ->setIdentity('username')
//            ->setCredential('password')
     * @return  My_Db_Adapter
    public static function getInstance()
        if (null === self::$_instance) {
            self::$_instance = new self();
        return self::$_instance;
    public function authenticate() {
        $_authResult = parent::authenticate();
        // NOTE: The point is that $result->_identity is an OBJECT (of type stdClass), NOT string
        // with Zend_Auth_Adapter_DbTable it is internally accomplished by calling its getResultRowObject() method
        // It constructs the stdClass with properties named after table attributes
//        $user = new stdClass();
//        $user->role = "administrator";
//        $user->username = $_authResult->getIdentity();
        $identity = $this->getResultRowObject();
        $result = new Zend_Auth_Result($_authResult->getCode(), $identity);
        return $result;
?>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
On the Flex side I have an auto-generated class (MyService) which extends another auto-generated class (_Super_MyService).
The point is that the outer one is auto-generated only once (initially), and you can modify it, without worrying to be overwritten on service regeneration.
There's a protected property _serviceControl (which is of type RemoteObject) which could be tweaked if needed.
I'm tweaking it by of setting the endpoint (with string read from a client side config in preInitializeService() method). Plus, I'm adding 2 more methods, which expose setCredentials and setRemoteCredentials methods of _serviceControl, so I can acces it from my code.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
package services.myservice
    public class MyService extends _Super_MyService
         * Override super.init() to provide any initialization customization if needed.
        protected override function preInitializeService():void
            super.preInitializeService();
            // Initialization customization goes here
            _serviceControl.endpoint = "http://localhost/myapp/gateway.php";
        public function setCredentials(username:String, password:String, charset:String=null):void
            _serviceControl.setCredentials(username, password, charset);
        public function setRemoteCredentials(username:String, password:String, charset:String=null):void
            _serviceControl.setRemoteCredentials(username, password, charset);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
So, before calling MyService methods, I'm setting the credentials with setCredentials() method and this runs the authentication on the PHP side:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
private var service:MyService;
service = new MyService(); // ServiceLocator.getInstance().getHTTPService("presetLoader");
service.setCredentials("user1", "pass1");
var token:AsyncToken = service.getData();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
The authentication via Zend_Amf_Server is, by the way, OPTIONAL! Meaning, with no credentials supplied, Zend_Amf_Server will NOT RUN IT. Thus you should rely on Zend_Acl (e.g. roles) to so your permissions and security! 
Finally, here's the MySQL DB table I've been using for authentication: 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
-- Table structure for table `users`
CREATE TABLE IF NOT EXISTS `users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(50) NOT NULL,
  `password` varchar(32) DEFAULT NULL,
  `role` varchar(45) DEFAULT NULL,
  `firstname` varchar(50) DEFAULT NULL,
  `lastname` varchar(50) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`),
  UNIQUE KEY `id_UNIQUE` (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; 
-- Dumping data for table `users`
INSERT INTO `users` (`id`, `username`, `password`, `role`, `firstname`, `lastname`, `email`) VALUES
(1, 'user1', 'pass1', 'administrator', 'Danko', 'Kozar', NULL); 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cheers!
Danko

Similar Messages

  • Zend AMF Data Service Return Problem

    Hi Folks,
    I am working with FB4 and Zend AMF/PHP and MySQL.  I began integrating the PHP stuff using the great article by Mihai Corlan called 'Working in Flash Builder 4 with Flex and PHP.  I followed all the steps exactly, aside from creating my own app-specific PHP classes and functions, etc...  I 'hooked up' the Zend stuff just like the article, created a text datagrid, just like the article, and viola!, it worked.  I then tweaked it a bit and interwove it into my 'real' component.  So far, so good.
    Then I created a second PHP class with a different 'get data' type of function.  It queries a different table in MySQL, but is essentially the 'same' as the query/function in the initial PHP class.
    In FB, in the Data Services window, I choose the 'Connect to Data/Services' function, just like the first time.  I then find/select my PHP class file and FB 'interrogates it' enough to show me the function that exists in the class.  I 'finish' the operation and it adds a new 'service' to the list of services in that window.  Again, so far, so good.
    The problem comes when I try to 'test' the service or 'configure return types' (which basically requires a 'test' operation anyway).  I can enter the 'input' params just fine, but when I try to execute the call, I get the following error:
    InvocationTargetException:There was an error while invoking the operation. Check your operation inputs or server code and try invoking the operation again.
    Reason: An error occured while reading response sent by server. Try encoding the response suitably before sending it. e.g. If a database column contains UTF-8 characters then use utf8_encode() to encode its value before returning it from the operation.
    I don't know where to go after this.  Again - the 2nd PHP class is essentially identical to the 1st.  The function in it is essentially identical, differing only by the input params, the name of the function and the actual SQL it sends to MySQL.  There is no special text, no special characters, no image stuff, nothing.  I do not 'encode' the results of the function in the first class - in fact the code in the second class is practically identical to the first.  I do not know what the error is talking about.  My guess is that it's more of a generic message.
    I can debug the PHP code just fine from within a seperate instance of Eclipse.  The function runs/returns just fine - an array of PHP-defined objects (simple strings).
    Any insights or advice would be welcomed.   Thank you,
    -David Baron

    Thank Jorge, but that was not the issue, though, it may be related.
    I checked the mySQL my.ini file, and there was already an entry for:
    [mysql]
    default-character-set=utf8
    I added the 'default-collation=utf8_unicode_ci', like you suggested, but that didn't do anything.
    I checked the Apache httpd.conf file, and added the following line 'under' the "DefaultType text/plain" line:
    AddDefaultCharset UTF-8    but that did not do anything.
    I checked my mySQL database, all the tables involved.  They were already at UTF-8 (default).  However, some of the 'varchar' columns were defined as 'latin 1-default collation'.   I changed them all to utf-8 (default table collation), but that did not help either.
    Finally, I found the problem, though I don't really know if it is "my" problem, or ZendAMF's problem, or Adobe's problem.
    It turned out that 'some' of my data had a 'bad' character in it.  Specifically, I had 'copied and pasted' some data from MS Word into mySQL Workbench.  Some of the data included the 'elipsis' character - you know, when you type "..." (dot dot dot) in MS Word, it replaces the three periods with a single elipsis character.  Although PHP could easily query and assemble this data into a nice object array, I noticed that that character showed up (in PHP's debugger) as a 'box' character, meaning "bad character".  Thus, I guess, Zend AMF and/or FlashBuilder could not 'bring over' and/or deal with this type of character.  As soon as I replace the few instances of that character with three periods, everything began to work perfectly.
    So... what to do about this?  I thought I was through with silly encoding/decoding of data when I left JavaScript and HTML behind in moving to FlashBuilder technology.  Am I really going to have to worry about this kind of thing?  Or might this be a bug/deficiency somewhere in the stack?
    Thanks for your help,
    -David

  • Flex and Zend amf deployment resolved with proper solution

    Hi All,
    Although, I personally do not like using Zend for these issues itself. However, I faced this issue first time with flex 4.0 version when everyone used to run into
    channel disconnected error. you can find the link for that post here:
    http://forums.adobe.com/message/3366991.
    Now, with flash builder 4.6, things have changed slightly and so the deployment process. So, here are the right set of steps to be followed :
    1. after developing your flash project, export the release build(I assume if you are a flex user, you should know these steps already)
    2. Now, check your release folder, you must have got some files with amfconfig.ini and gateway.php and just one folder named history.
    3. copy all these files into a new folder say "My Release Build".
    4. Now, step 1 is get Zend framework in place, to achieve that:
    there are different ways. some will say : "make sure zend must already installed on your production server." that is an alternative but most likely,  the easier way to do this is : search your www(root folder on localhost),you will find a folder with name ZendFramework. Copy this folder to "My Release Build"
    5. Now, the services that you have used in your flex project, go to debug folder of your project which should be in your www(root folder on localhost) with name "yourprojectname-debug". copy services folder from this debug folder to "My Release Build"
    6. Now, open your amfconfig.ini from "My Release Build" and edit and make it look like following:
    [zend]
    webroot = http://www.yourwebsite.com
    ;you can edit above webroot to match the root folder of your website or use . to make it point to root.
    zend_path = ./ZendFramework/library
    [zendamf]
    amf.production = true
    amf.directories[]= services
    thats it. your amf config is fine.
    7. edit gateway.php:
    Now, remove everything from gateway.php and copy this as it is there:
    <?php
    ini_set("display_errors", 1);
    $dir = '.';
    $webroot = $_SERVER['DOCUMENT_ROOT'];
    $configfile = "amf_config.ini";
    //default zend install directory
    $zenddir = $webroot. '/ZendFramework/library';
    //Load ini file and locate zend directory
    if(file_exists($configfile)) {
        $arr=parse_ini_file($configfile,true);
        if(isset($arr['zend']['webroot'])){
            $webroot = $arr['zend']['webroot'];
            $zenddir = $webroot. '/ZendFramework/library';
        if(isset($arr['zend']['zend_path'])){
            $zenddir = $arr['zend']['zend_path'];
    // Setup include path
        //add zend directory to include path
    set_include_path(get_include_path().PATH_SEPARATOR.$zenddir);
    // Initialize Zend Framework loader
    require_once 'Zend/Loader/Autoloader.php';
    Zend_Loader_Autoloader::getInstance();
    // Load configuration
    $default_config = new Zend_Config(array("production" => false), true);
    $default_config->merge(new Zend_Config_Ini($configfile, 'zendamf'));
    $default_config->setReadOnly();
    $amf = $default_config->amf;
    // Store configuration in the registry
    Zend_Registry::set("amf-config", $amf);
    // Initialize AMF Server
    $server = new Zend_Amf_Server();
    $server->setProduction($amf->production);
    if(isset($amf->directories)) {
        $dirs = $amf->directories->toArray();
        foreach($dirs as $dir) {
            // get the first character of the path.
            // If it does not start with slash then it implies that the path is relative to webroot. Else it will be treated as absolute path
            $length = strlen($dir);
            $firstChar = $dir;
            if($length >= 1)
                $firstChar = $dir[0];
            if($firstChar != "/"){
                // if the directory is ./ path then we add the webroot only.
                if($dir == "./"){               
                    $server->addDirectory($webroot);
                }else{
                    $tempPath = $webroot . "/" . $dir;
                    $server->addDirectory($tempPath);
            }else{
                   $server->addDirectory($dir);           
    // Initialize introspector for non-production
    if(!$amf->production) {
        $server->setClass('Zend_Amf_Adobe_Introspector', '', array("config" => $default_config, "server" => $server));
        $server->setClass('Zend_Amf_Adobe_DbInspector', '', array("config" => $default_config, "server" => $server));
    // Handle request
    echo $server->handle();
    Now, upload your "My Release Build folder to your production server webroot"
    case 1: if you get "channel disconnected error, you have made some mistake and your path for zend or services folder is not right."
    In above case, "ZendFramework folder and services folder with all of other release files". To find out what is wrong, open this url :
    http://www.yourwebsite.com/gateway.php. if you see this lovely string there : "Zend Amf Endpoint". consider your are through with zend settings on server
    otherwse you will see relative errors.
    2. After fixing this step, try run your website, you will land into this error :
    Class “yourcorrectclassname” does not exist: Plugin by name ‘Classname’ was not found in the registry; used paths:
    : /home1/messoftc/public_html/oc/services/
    #0 /home1/messoftc/public_html/ZendFramework/library/Zend/Amf/Server.php(553): Zend_Amf_Server->_dispatch(‘fxnname’, Array, ‘classname’)
    #1 /home1/messoftc/public_html/ZendFramework/library/Zend/Amf/Server.php(629): Zend_Amf_Server->_handle(Object(Zend_Amf_Request_Http))
    #2 /home1/messoftc/public_html/oc/gateway.php(69): Zend_Amf_Server->handle()
    #3 {main}
    Now, this is a zend framework bug, it does not automatically detect the php classes in your services folder,those who have run into this, must have googled hard to find the solution and this bug is also logged officially on zend server jira log.
    so, what is the solution? simple and effective. open your gateway.php file from "My Release Build"
    Add this little line :
    $server->addDirectory(dirname(__FILE__) . '/services/');
    after this line :
    $server->setProduction($amf->production);
    reupload this file to your production, you should see your Flex, Zend, php & Mysql in action.
    Here is a sample link I have created :
    http://www.eiws.co.in/testzend.html
    you may also visit the endpoint file:
    http://eiws.co.in/gateway.php
    If anyone still faces this issue, can contact me at [email protected].
    Credits: "To all developers who share their knowledge with everyone and google and thousands of blogs who provide a medium to share this knowledge"

    Richard Bates of flexandair.com figured it out. In my php.ini file, I had the memory limit set at 8M. After, changing it to 32M, it worked. Thank you, Richard!
    -Laxmidi

  • Zend AMF

    I've put my Zend folder into my web root.
    From Flex, I'm calling amf.php:
    <?
    include '_services/Test/Main.php';
    include 'Zend/Amf/Server.php';
    $server = new Zend_Amf_Server();
    $server->setProduction(false);
    $server->setClass('Test_Main', 'test');
    $response = $server->handle();
    echo $response;
    ?>
    My _services/Test/Main.php has a class called "Test_Main" and a public method "init()" which simply returns "this is a test".
    I've used the services-config.xml file provided by Zend and modified the URI only to point to my amf.php file.
    In Flex:
    <fx:Declarations>
        <s:RemoteObject id="myAmf"
            fault="faultHandler(event)"
            showBusyCursor="true"
            destination="zend" />
    </fx:Declarations>
    protected function creationCompleteHandler(event:FlexEvent):void
        var message:String    =    myAmf.Test_Main.init();
        Alert.show(message);
    When I run the application, the call is being made to the amf.php file according to Apache with a response code of 200. However in Flex it says:
    "ReferenceError: Error #1069: Property init not found on mx.rpc.remoting.mxml.Operation and there is no default value."
    Can anyone tell me why this is happening? There is a similar post on the Zend forums posted in Feb 2009 but it's had loads of views and no replies!
    Thanks in advance.

    Richard Bates of flexandair.com figured it out. In my php.ini file, I had the memory limit set at 8M. After, changing it to 32M, it worked. Thank you, Richard!
    -Laxmidi

  • Zend AMF extremely slow first request

    Hi all,
    I'm having a weird problem with Zend AMF and was wondering if anyone else has seen this before.
    I've got a very simple PHP/MySQL backend that returns multidimensional arrays to Flex via Zend AMF.
    Now this all worked fine up to the point that I started testing my app with a remote server instead of my local test server.
    With the remote server I noticed that sometimes, but always the first time, some PHP function is called it takes forever to call the callback function with a result. I'm talking about around 1 to 2 minutes!
    Now, when I call that same php function via a normal url every time it returns the right results in a couple of milliseconds.
    When the function has been called once it seems to be ok and next time it's called it returns results within milliseconds.
    I've had a look with a network sniffer to see if the transfer of data takes long, but that's all fine...
    So it looks to me as if it just takes forever before the RemoteObject calls it's callback function.
    I'll be testing with some stripped down code later tonight and will also set it up on a different server, but I was hoping someone else has seen this and knows a workaround...
    Thanks
    Skip

    Hmm, i just did some more tests, but the results do update so it doesn't look like it's a cached result.
    I'm not entirely sure but it looks like when multiple AMF methods are called too close to each other they are combined into one HTTP POST request to the AMF gateway. When this happens the response is extremely slow, whereas when I have make the second call after the first one has finished completely the response is ok (around 200 milliseconds).
    You wouldn't happen to know how RemoteObject handles multiple calls to an AMF backend, right?

  • Zend AMF and Flex 4

    Hello,
    I am currently working on a windowed app that uses the Zend AMF to connect to the database. I have been trying move the framework from my local testing server to my web server.
    First I ftped the framework files, my gateway.php, and amf_config.ini to the server. Inside the amf_config, changed the webroot to be the location of the ZendFramework and I also pointed the _super_class generated by the dataservice to my webserver. My php.ini is also configured to include that path to the ZendFramework.
    Did I miss a step at some point / was there something I was supposed to do when I created the data service? Is it even possible for an desktop AIR app to work with the ZendFramework when it is on a web server?
    My host is Bluehost

    Hello there.
    Here's the ServiceLocator and delegates I am using....
    // LoginDelegate.as
    package com.myproj.products.business {
         import com.myproj.products.vo.LoginVO;
         import mx.rpc.IResponder;
         import com.adobe.cairngorm.business.ServiceLocator;
         public class LoginDelegate {
              // anything that implements the IResponder interface can act as a responder
              private var responder:IResponder;
              private var service:Object;
              public function LoginDelegate(responder:IResponder) {
                   this.responder = responder;
                   this.service = ServiceLocator.getInstance().getRemoteObject("loginService");
              public function login(loginAttempt:LoginVO):void {
                   // Call the method of service that resides on server
                   var call:Object = service.login(loginAttempt);
                   // Send the response to responder
                   call.addResponder(responder);
    // com/myproj/products/business/Services.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <cairngorm:ServiceLocator
         xmlns:mx="http://www.adobe.com/2006/mxml"
            xmlns:cairngorm="com.adobe.cairngorm.business.*">
         <!-- Login Service -->
         <mx:RemoteObject
              id="loginService"
              destination="zend"
              source="LoginService"
              showBusyCursor="true">
              <mx:method name="doLogin" />
         </mx:RemoteObject>
    </cairngorm:ServiceLocator>
    With kind regards
    ShiVik

  • Connecting To Zend AMF Backend Via HTTPS

    Environment:
    - Flash Builder 4
    - Flex 4 Beta 2
    - Zend AMF (the one that gets automatically downloaded in Flash Builder 4)
    Issue:
    Using Flash Builder's "Connect To PHP" wizard, I can connect to my Zend AMF backend via HTTP but not HTTPS (and yes, my domain does have a valid SSL certificate from a trusted CA - it is not self signed).  Upon selecting the PHP class (using a SFTP mount to my web host) via the wizard, Flash Builder dies when "introspecting the service" and it throws this error:
    Make sure that Zend Framework is installed correctly and  the parameter "amf.production" is not set to true in the amf_config.ini file  located in the project output folder.
    Warning:  require_once(Zend/Loader/Autoloader.php) [function.require-once]: failed to open stream:  No such file or directory in /home <blah>
    If I change my PHP backend's URL from https://<domain> to http://<domain> then it works but I obviously need to use SSL for this application.

    I upgraded to Zend Framework 1.10, which didn't help.  I also just installed Flash Builder 4 Premium (which was just released today) and that didn't help my situation either although I believe the problem is how I'm attempting to get my Flex client to communicate to my hosted web server.
    All the examples I've seen demonstrate how to connect a flex client and PHP backend (via Zend AMF) to LOCALHOST.  I need to develop my Flex client on my laptop and hook into my PHP backend running on a hosted web server (not localhost).
    Here are my server properties:
    - Application server type = PHP
    - Server location:
         - web root = Y:  (this maps to my Y: drive on windows which is a SFTP mount to my web host)
         - root URL = https://cl21.<web_host>.com/~<username>
    - Output folder = Y:\<app>-debug
    I can get this to work if I use my dedicated domain name www.<my_domain>.com but I haven't yet purchased a dedicated IP and SSL certificate so I'm attempting to use my web host's shared SSL certificate (which is valid).  The problem seems to be related to the setting "root URL".  Can you not point the flex client to anything other than a root URL?  Most server-side development happens on a shared dev server (e.g. sandbox.company_name.com/developer1, sandbox.company_name.com/developer2, etc.)

  • Authentication & Authorization with SSO, JAAS and Database Tables mix

    Hi,
    I'm looking for how manage Authentication & Authorization in a J2EE ADF+Struts+JSP application.
    I'm interested in use SSO for authentication (I just did it programatically & dynamically already), and now I would like to could define authorization using database tables with users, groups, profiles, individual permissions, ..., (maitanined dynamically by web application admin) throught JAZN (JAAS or however is said) but not statically defining roles, groups, users, ... in jazn xml files.
    I saw that exists the possibility to create a custom DataSourceUserManager class to manage all this, and this gave me the idea that this could be possible to do (I was thinking in make a custom Authorization API over my application tables, without JAZN) but what is better that use and extended and consolidated aprox like JAZN.
    Anybody could tell me if my idea could be possible, and realizable, and maybe give me some orientation to build this approach.
    A lot of thanks in advanced.
    And sorry, excuse my so bad english.
    See you.

    Marcel,
    Originally the idea was to create a post to only explain how to do authentication using a Servlet filter. However,
    I have recently added code to the JHeadstart runtime and generators to enable both JAAS and 'Custom' authentication AND authorization in generated applications. Therefore, this post will be made after we have released the next patch release, as it will depend on these code changes.
    We currently plan to have the patch release available sometime in the second half of May.
    Kind regards,
    Peter Ebell
    JHeadstart Team

  • Authentication & Authorization Component

    hi!
    please introduce to me components for Authentication & Authorization that
    i use in the web application and i use it for Authentication & Authorization
    plesae help me .
    thanks.....

    Having a look at LDAP Protocol may give you some ideas. LDAP (Local Directory Access Protocol) is a cross platform protocol for authenticating and authorising users onto a network.

  • Flashbuilder 4 and ZEND AMF

    Hello,
    i have the following setup:
    This is my ValueObject:
    <?php
    class PurchasedSongVO
         public $txn_id;
         public $article_id;
         public $song_id;
         public $songName;
         public $artistName1;
         public $songIcon;
         public $songPreviewFileName;
         public $fullSongFileName;
    ?>
    This is my zend_amf index.php (striped it down to the non working service, the others are working fine!):
    <?php
    require_once('Zend/Amf/Server.php');
    $server = new Zend_Amf_Server();
    require_once('/orders/OrdersService.php');
    $server->setClass("OrdersService");
    $server->setClassMap( "PurchasedSongVO"                        , "PurchasedSongVO"   );
    echo($server -> handle());
    ?>
    In my OrdersService.php I have the following function:
    public function getAllPurchasedSongs_BY_userID( $user_id )
         $stmt = mysqli_prepare( $this->connection,
         "SELECT orderdetails.txn_id,`article_id`,`song_id`, `songName`, `artistName1`, `songIcon`, `songPreviewFileName`, `fullSongFileName`
                        FROM `orderdetails`,`songs`,`orders`
                        WHERE orders.user_id=?
                        AND orderdetails.txn_id=orders.txn_id
                        AND orderdetails.article_id = songs.song_id" );         
         $this->throwExceptionOnError();
         mysqli_stmt_bind_param ($stmt, 'i', $user_id );         
         $this->throwExceptionOnError();
         mysqli_stmt_execute($stmt);
         $this->throwExceptionOnError();
         $rows = array(); //result array
         $row = new PurchasedSongVO();
         while( mysqli_stmt_fetch($stmt) )
             $row = new PurchasedSongVO();//stdClass();
             mysqli_stmt_bind_result(     $stmt,
                             $row->txn_id,
                             $row->article_id,
                             $row->song_id,
                             $row->songName,
                             $row->artistName1,
                             $row->songIcon,
                             $row->songPreviewFileName,
                             $row->fullSongFileName);
                    $rows[] = $row;
         mysqli_stmt_free_result($stmt);
         mysqli_close($this->connection);
       return $rows;
    When I call this Service by 'hand' and print_r it I get for example the following:
    Array
        [0] => PurchasedSongVO Object
                [txn_id] => 44L66197L05199028
                [article_id] => 6
                [song_id] => 6
                [songName] => Let's Go A!
                [artistName1] => Ansolas & Lightrocker
                [songIcon] => defaultSongIcon_38x38.png
                [songPreviewFileName] =>
                [fullSongFileName] =>
        [1] and so on ...
    Here is how I access the service within Flex:
    os.destination ='zend';
    os.source='OrdersService';
    os.showBusyCursor=true;
    os.addEventListener( FaultEvent.FAULT, faultListener);
    os.getAllPurchasedSongs_BY_userID.addEventListener( ResultEvent.RESULT, getAllPurchasedSongs_BY_userID_result );
    public function _getAllPurchasedSongs_BY_userID( user_id:int ):void
         os.getAllPurchasedSongs_BY_userID( user_id );
         private function getAllPurchasedSongs_BY_userID_result( event:ResultEvent ):void
              var resultArray:Array = new Array();
              resultArray = event.result as Array;
              this._purchasedSongsCollection.source = resultArray;
              trace('orders:'+event.result);
    Here is my AS3 Value Object:
    package view.user.valueObjects
         [RemoteClass(alias="PurchasedSongVO")]
         [Bindable]
         public class PurchasedSongVO
              public var txn_id;//:String;
              public var article_id;
              public var song_id;
              public var songName;
              public var artistName1;
              public var songIcon;
              public var songPreviewFileName;
              public var fullSongFileName;
    Now when I call ther service the returned type of objects in the Array is just Object and not PurchasedSongVO, here the trace from above:
    orders:[object Object],[object Object],[object Object],[object Object]
    If done it this way for all other services but they all return the right type and not just object.
    Any idea what could be wrong ?

    Ok,
    the following simple fix is doing the job but the funny think is that its working on my other functions without casting:
    private function getAllPurchasedSongs_BY_userID_result( event:ResultEvent ):void
         var resultArray:Array = new Array();
             resultArray = event.result as Array;
         if(resultArray != null)
              var sourceArray:Array = new Array();
              for( var i:int=0; i<resultArray.length; i++ )
               sourceArray[i] = resultArray[i] as PurchasedSongVO;
              this._purchasedSongsCollection.source = sourceArray;
    probably that helps someone with a similar issue

  • Weblogic 103 Authentication & Authorization using extenal openldap

    Can somebody point to a documentation for implementing Authentication & Authorization for Weblogic 10.3 web app using openLdap ?
    Thanks

    This is what I did. My environment is openldap, weblogic 10.3 on a windows machine. Still having trouble
    dn: cn=fd_user1,ou=people,dc=example,dc=com
    objectClass: person
    cn: fd_user1
    dn: cn=FD,ou=groups,dc=example,dc=com
    objectClass: groupOfNames
    cn: FD
    member: cn=fd_user1,ou=people,dc=example,dc=com
    Here is my weblogic.xml entries
    <wls:security-role-assignment>
    <wls:role-name>FD</wls:role-name>
    <wls:externally-defined/>
    </wls:security-role-assignment>
    My web.xml
    <security-constraint>
    <display-name>Example Security Constraint</display-name>
    <web-resource-collection>
    <web-resource-name>SecuredArea</web-resource-name>
    <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
    <role-name>FD</role-name>
    </auth-constraint>
    </security-constraint>
    <login-config>
    <auth-method>FORM</auth-method>
    <realm-name>myrealm</realm-name>
    <form-login-config>
    <form-login-page>/login.jsp</form-login-page>
    <form-error-page>/login.jsp</form-error-page>
    </form-login-config>
    </login-config>
    <security-role>
    <role-name>FD</role-name>
    </security-role>
    Inside the login.jsp I do have the j_security_check as the action parameter value. I am able to view the ldap users in the admin console too. Still not able to access the resource. I am in the process of debugging the ldap messages on the openldap console.
    Thanks

  • Zend AMF Slow Response

    I am getting slow response times when using Zend AMF in Flash Builder 4.  It is taking between 1.5s to 2s to return the results, which is much slower than when I am returning XML.  However its about the same no matter if no records are returned or if 1000 records are returned. It seems like it is taking a while to make the connection to the gateway.php file. Anyone else noticing issues like this?  All the examples I have seen online use Apache instead of IIS, could that be part of my problem?
    Thanks,
    Justin

    I experienced the same with Zend and switched to coldfuion as a result. Its better matched
    to Flex, and you can go as far as Life Cycle Data services with it if you want. It is also a superior
    design to php but works pretty much the same way.
    The communications with Flashbuilder have several gotchas which are not explained but are covered here now.
    The old php 4 AmfPhp was really impressive performer on speed. But it just took a dive when it went
    to zend and 5.
    Dan Pride

  • Zend AMF and Flash Builder Tutorial

    As part of the good ole new years resolution, I decided to sit down and take a shot at learning Flash. As a PHP developer by profession, I was curious about Zend AMF, part of the Zend PHP Framework. After finding it difficult to get a barebones working example, I decided to write a tutorial from the beginner's perspective (except the PHP part). The result is on the blog post located here:
    http://flearn.wordpress.com/2011/03/01/zend-amf-basics/
    I put it on a wordpress blog as it has nice code highlighting features and saves drafts for me. My hope is that it provides a basic guide on getting Zend AMF up and running with a basic barebones app, and would like feedback on any of the content.

    Thaaaaaank you maaaaan!
    Seriously - I was about to put a brick through my screen.

  • 11g hybrid authentication / authorization: WLS plus external table

    I've implemented external table authentication / authorization in 11g. Now I'd like to add a twist.
    I have an external table containing users B, C, and D. That external table contains all of the columns I need for authentication (including a clear text password) and for authorization (roles, log level, a dynamic table name, and so forth). I have authentication in one initialization block, authorization in another. Everything works fine. I can log in as B, C, or D and see exactly what I'm supposed to see, based on the ROLES.
    The clear text passwords are generally not a problem, because this is a training instance and almost all of the passwords are the same. However, I want to add a user whose password should not be held in clear text. For that reason, I'd like to add that user into WLS. I've done that, and I'm able to log in to OBIEE. After confirming that I could log in to OBIEE with user A from the WLS, I added User A to the external table, left its password field blank, and filled in the other columns (roles, loglevel, etc...) that I need to assign into session variables.
    Here's the problem: the authorization init block properly assigns ALL session variables for users B, C, and D. It assigns all session varaibles EXCEPT the ROLES variable for user A. I've confirmed this by creating an Answers analysis that shows me the values of the session variables. The ROLES session variable for user A shows "authenticated-role;BIConsumer;AuthenticatedUser". For all other users (those who are authenticated using the clear text passwords in the external table) the ROLES variable is populated correctly, based on the values in the ROLES column in the external table. In short, the authorization init block is properly assigning the ROLES session variable only for those users that were authenticated using the authentication init block, but is assigning all other session variables correctly for all users, even the one in WLS.
    Here's my authentication init block code:
    select bi_user
    from bi_auth_ldap
    where bi_user = ':USER'
    and bi_user_pwd = ':PASSWORD'
    Here's the authorization init block code:
    select roles, bi_user_name, to_number(loglevel,0), channel_tbl
    from bi_auth_ldap
    where bi_user = ':USER'
    (returned results are assigned into ROLES, DISPLAYNAME, LOGLEVEL, and CHANNEL_TBL session variables, respectively)
    It feels like the ROLES session variable is populated in conjuction with the user logging on and being authenticated via WLS, and that the initialization block isn't able to overwrite that variable. Can an OBIEE developer confirm that for us, please? Once set in WLS, is it not possible to overwrite the ROLES session variable with SQL from an initialization block? If it IS possible, can you post some code that will accomplish it?
    Thanks!

    It occurs to me that Oracle's support model is a fantastic way to make money. Let's see, I wonder if I could become a billionaire doing this:
    Create some software. Sell that software. Then, charge customers several thousand MORE dollars, year after year, plus about $60 per bug, so that they have the right to report MY bugs to me. Yeah, that's the ticket - people PAYING for the right to report bugs to me. Oh, and if more than one person reports the same bug, I get to keep ALL of the money from ALL of them.
    Let's summarize, make sure I haven't missed something: You buy my software, you PAY ME additionally to report MY bugs to me, I don't necessarily have to fix the bugs (but I keep your money whether I fix it or not), and I can collect multiple times from different people who report the same bug.
    Sweeeeeeet.........
    Billionaire Acres, here I come!

  • Authentication & Authorization programming

    Hello all,
    I am in process to create a new application, My requirement here is that I want to create a reusable module that I want to use for authentication & authorization. Further I want that when ever a user logs-in, his/her privileges get stored in the session and based on the data stored in the database s/he should be able to view the page and event the fields/components on it.
    Can any one help me with the design of the above requirement.
    Thanks in advance for the same.

    Hi,
    if you want 2 applications share the same session you should give them the same login cookie name in the authentication scheme.
    >
    1. convey relevant values from the custom auth app (these cannot be one app)
    >
    Setup a database context to share values between the applications.
    Or use apex_util.fetch_app_item http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35127/apex_util.htm#BABIBAID
    >
    2. make certain that users don't just bookmark the target app and bypass my authentication/authorization outcomes -- something here with session ID?
    >
    Set the URL for the "session not valid" section of the authentication scheme to the login page of your custom auth app
    regards,
    Erik-jan

Maybe you are looking for

  • Using Airport extreme: configuring LG smart tv upgrader wirelessly

    I've been trying to configure an LG smart TV upgrader to work with my airport extreme.  In the LG setup screen it asks for IP Adress, Subnet mask and  gateway. DNS Server: Primart and Secondary.  I would appreciate any help.   Thanks C

  • DTP step taking longer time

    Hello Experts As Iam new to SDN I tried to find an answer to this issue. Please find below is the Issue There is a process chain. In this PC, After deleting the Index step, there is a DTP step, which updates the Cube with one DSO; the first DTP step

  • T420s and non-use battery dissipation

    The battery dissipation of my T420s, when not in use, is more than what I would have expected.  If the machine is fully charged (100% battery) when I put it in sleep mode, within a day (12-24 hours) the battery reports as low as 10% charge.  If the m

  • What is the function of the Service Manager, in Concurrent Managers?

    Greetings to All, When looking at the concurrent managers, our internal manager is down and we also have the Service Manager being down. I understand the process of the Internal Manager. But like to know what the Service Manager does and what it is u

  • ACE 4710 Issue

    Dears, I have Cisco 4710 configured, but my issue that I can't ping the Virtual IP. Attached the configuration of the ACE4710. Appreciate you support, Regards.