1. #1
    Sencha Premium Member
    Join Date
    Jan 2013
    Posts
    9
    Vote Rating
    3
    megaurav2002 is on a distinguished road

      0  

    Default Ext.Direct - login exception

    Ext.Direct - login exception


    Hi,

    I am using Ext.direct.Manager to connect to our Remoting backend (amf). If i disable backend authorization specified in remoting-config.xml(<default-security-constraint ref="user" />), i am able to retrieve data but as soon as i enable this - i get Ext.Direct.Manger exception. Now, i know i am getting this because i have not logged in to the remoting channel but i am not sure how to achieve this with Ext.Direct.Manager.

    Any ideas?

    Thanks

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,797
    Vote Rating
    834
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    So you need to be able to log into your server side code?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha Premium Member
    Join Date
    Jan 2013
    Posts
    9
    Vote Rating
    3
    megaurav2002 is on a distinguished road

      0  

    Default


    That's right! In flex, it was done by calling channelset.login(username,password). Not sure how to do the same in ExtJS

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,797
    Vote Rating
    834
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    That is all handled in your server side code. Direct is just a mechanism for transport, the client submits the login request, your server handles the login request.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha Premium Member
    Join Date
    Jan 2013
    Posts
    9
    Vote Rating
    3
    megaurav2002 is on a distinguished road

      0  

    Default


    Yup, understand that.


    The problem i am having is when i send login request it gets rejected by the server. So, i thought i will look into flex libraries as to what they send for login.
    They are basically sending "flex.messaging.messages.CommandMessage". See below (code from their library):


    Code:
       var msg:CommandMessage = new CommandMessage();
       msg.operation = CommandMessage.LOGIN_OPERATION;
       msg.body = credentials;
       if (charset != null)
           msg.headers[CommandMessage.CREDENTIALS_CHARSET_HEADER] = charset;
    
    
           // A non-null, non-empty destination is required to send using an agent.
           // This value is ignored on the server and the message must be handled by an AuthenticationService.
           msg.destination = "auth";
    
    
       var token:AsyncToken = new AsyncToken(msg);
            if (_authAgent == null)
                _authAgent = new AuthenticationAgent(this);
            _authAgent.registerToken(token);
            _authAgent.state = AuthenticationAgent.LOGGING_IN_STATE;
            send(_authAgent, msg);

    Now i have tried to do something similar using "Ext.data.amf.RemotingMessage" but no luck may be because its a different type of message

    Code:
      var remotingMessage = Ext.create('Ext.data.amf.RemotingMessage', {
    
    
                body: encodedCredentials,
                destination: 'auth',
                operation: 8,
                headers: {
                    'DSCredentialsCharset': ''
                }
            });
    
    
            var encoder = Ext.create('Ext.data.amf.Encoder', {
                format: 3
            });
            encoder.writeObject(remotingMessage);
    
    
            var bytes =  encoder.bytes;
    
    
            Ext.Ajax.request({
                method: 'POST'
                ,   url: 'http://XXXX/messagebroker/amfsecure'
           
                ,   params: bytes
                ,   success: function(response) {
                    console.log('response as string: ' + JSON.stringify(response));
                }
            });
    Any ideas?

    Thanks for your help

  6. #6
    Sencha Premium Member
    Join Date
    Jan 2013
    Posts
    9
    Vote Rating
    3
    megaurav2002 is on a distinguished road

      0  

    Default


    I thought i will post how we have done this, in case anyone else needs it:

    Code:
           var commandMessage =  {
                '$flexType': 'flex.messaging.messages.CommandMessage',
                body: encodedCredentials,
                destination:"auth",
                operation:8, // login
                headers:{
                    'DSEndpoint': 'my-secure-amf'
                }
            };
    
    
            var amfEncoder = Ext.create('Ext.data.amf.Encoder', {
                format: 0
            });
    
    
            var arCommandMessage=[];
            arCommandMessage.push(commandMessage);
    
    
            var obj = new Object();
            obj.targetUri = 'auth';
            obj.responseUri = '';
            obj.body = arCommandMessage;
    
    
            var arr = [];
            arr.push(obj);
            amfEncoder.writeAmfPacket([],arr);
    
    
            Ext.Ajax.request({
                url: '/messagebroker/amfsecure',
                binary: true,
                headers: {'Content-Type': 'application/x-amf'},
                binaryData : amfEncoder.bytes,
    
                success: function(response) {
                   alert("success");
                },
    
                fail: function(response) {
                    alert("Cannot login to remote channel");
                }
            });

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi