cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

2053
Views
1
Helpful
8
Replies
Bticest_jt
Beginner

[node.csf] CUCM End User Auth

Hi all,

     I got some issues when I authenticated end user against CUCM.

  • "phoneconfig": {
  •           "CertificateAuthorization": {
  •                 "rejectUnauthorized": false
  •         }
  •       }
  • test:
    • run "http://localhost:1789/phoneconfig/devices?ccmcip=<my CUCM IP address>" in the browser is ok.
    • run "sample.js"
    • User Name: end user licenced on CUCM
    • Password: null
    • Password: empty
    • CUCM: <my cucm IP address>
    • Mode: SoftPhone
    • ServerAuth: true
    • Validate Cert: false
    • click "Login"
    • FireFox console showed: "[cwic] 29/09/2014 16:47:46.545 default device is null"
    • I checked "cwic-debug.js".  I've uploaded the code.

   

     Something wrong with my environment or I didn't get the points?

   

Thanks, Jeff

1 ACCEPTED SOLUTION

Accepted Solutions

Hi Jeff,


Unfortunately, you cannot accomplish that kind of login process. SSO is not supported right now. It is on the features list for the next major release, which is planned for the first half of 2015. In the current release, you must enter the password each time you want to login to your web app.

Regards, Milos.

View solution in original post

8 REPLIES 8
dzmilos
Beginner

Hi Jeff,

As I could see from information that you have provided, the problem is most probably your 'null' in 'Password' input field.

If you want to authenticate user and get the list of available devices for that user, you must enter password.

When password is not provided, CWIC tries to predict device name like 'ECP' + 'Username'. If your SoftPhone device name is not in that format, login will fail. You have option to add 'predictDevice' function and 'devicePrefix' property in 'init' settings which could be used to change prediction algorithm. Anyway if you want to use basic authentication based login, you must enter valid password.

Regards,

Milosh.

Hi Milosh,

     Deeply appreciate your replay.

     Honestly, I wanna realize the CUCM sso. (Not sure if named it be ok)

     For now, I add some code in the "cwic.js", it works.(See the attach)

     My "settings":         

                    var settings = {

                       ready: phoneReadyCallback, /* Callback when phone is ready for use */

                       error: phoneErrorCallback, /* Error callback */

                       encodeBase64: ciscobase.util.crypto.b64Encode,

                       verbose: true,

                       node: 'http://localhost:1789',

                       contactLookupJsonpHost: ""

                   };

     I'll try to add "predictDevice" and "devicePrefix" in my "init settings".

     I'v added the "predictDevice" and "devicePrefix" in my "init settings".

                              devicePrefix: 'CSF',

                              predictDevice: function(args) {

                                   return settings.devicePrefix+args.username;

                              },

     It doesn't work either.

     But what makes the call back value "devices" is "".

     I'll contiue working on it. (m off from October 1st to October 7th

Thanks Jeff.

Hi Jeff,

You should not change cwic.js unless you are doing some experimentation on your own. You can put all code in sample.html or your own separate file.

If I understand you right, you want to use node.js component to get the list of available devices for the user and to use it to login without password. Am I right?

As I see in attached print-screens, the success callback is executed but devices argument is empty. Is that the problem that you are facing?

I will setup node.js component on my machine and I will try to make some sample code to help you.

Regards, Milos.

Hi Milos,

    1. Of course I won't change cwic.js in the furture.

    2. You are right. I wanna use Node.js to auth the user against CUCM(without password).

        At first, I have to get the list of available devices.

        It seems this needs password.

        When I run the csf API in the browser "http://localhost:1789/phoneconfig/devices?ccmcip=<my CUCM IP>", it works after validating the UserName and Password.

        But in the cwic.js, GET "/phoneconfig/devices?ccmcip=my CUCM IP" via ajax, password is not provided.

    3. Yes, the success callback is empty. This is the point I am facing!

    4. I'll focus on how it works inside if possible.

Thanks Jeff.

Hi Jeff,

you definitely need to enter your credentials somewhere. I have tried to get devices through node.js and I did it successfully. Here is my code, maybe it could help you:

$.ajax({

    url:'http://localhost:1789/phoneconfig/devices?ccmcip=x.x.x.x',

    beforeSend: function(xhr){

          var encoded = window.btoa('username:password'); // note ":"

          xhr.setRequestHeader("Authorization", "Basic " + encoded);

    },

success:function(devices){

    console.log(devices); //the list of devices

},

error: function(err) {console.log(err);}

});

You also need to configure CORS to support Authorization header. You have attached sample config file where you can see how to do it. After that, you should run node component with new config file as a second argument, like:

node node_modules/csf/csf.js  node_modules/csf/config/your_config_file.cfg

Regards, Milos.

Hi Milos,

     Thanks for your reply.

  • CORS and my config file are both OK.
  • I've seen your code. It's also showed in CWIC.js.

$.ajax({

     url: settings.node + '/phoneconfig/devices' + '?ccmcip=' + cucmAddress,

     beforeSend: function(req) {

          var auth = 'Basic ' + _encodeBase64(registration.user + ':' + clearPassword);

          req.setRequestHeader('Authorization', auth);

     },

     error: function(jqXHR, textStatus, errorThrown) {

          _log(true, 'CCMCIP failure with CUCM "' + cucmAddress + '" : ' + textStatus, errorThrown);

          authenticateCcmcip(); // try next CUCM address

     },

     success: function(devices) {

          .....

     }

});

               I valued the 'clearPassword', it works.

  • But, this is not the result I wanted.

          Let's see a situation:

               User sign in the company domain with his PC.

               The program would get the 'username', his PC's MAC Address, etc. Just except password.

               When the user visit the Jabber Web app, SSO would be helped via the 'username'.

               Would this be possible?

               BTW, something wrong with CWIC.js? The 'selectedDevice' is  valued to 'undefined'. Console showed like:

                                   "ready for devicesAvailableCb:: selectedDevice:" null cwic-debug.js:2580

                                   "valued selectedDevice" undefined cwic-debug.js:2585

                                   "devicesAvailableCb end:: selectedDevice:" undefined cwic-debug.js:2600

                                   "if selectedDevice is null:: selectedDevice:" undefined cwic-debug.js:2602

                                   "selectedDevice::" undefined

               At last, 'selectedDevice' is undefined.

               I valued it to 'CSFxxxx' myself.


Many Thanks,

Jeff

Hi Jeff,


Unfortunately, you cannot accomplish that kind of login process. SSO is not supported right now. It is on the features list for the next major release, which is planned for the first half of 2015. In the current release, you must enter the password each time you want to login to your web app.

Regards, Milos.

Hi Milos,

     Deeply appreciate your help!

    

     I will focus on the new release.


Thanks

Jeff

Create
Recognize Your Peers
Content for Community-Ad