D
D
dake12312017-08-15 10:51:07
Node.js
dake1231, 2017-08-15 10:51:07

How to get user attribute Server Radius?

Hello! The task is to make authorization through the Radius server, and if the user is not in the system, then you need to automatically create it. I work with the node-radius /. Radius created a user in the server

var account = username;
        var password = req.param('password');
        var packet = {
            code: 'Access-Request',
            secret: radius_secret,
            identifier: 0,
            attributes: [
                ['NAS-IP-Address', radius_server],
                ['User-Name', account],
                ['User-Password', password]
            ]
        };

        client.on('error', function(e) {
            console.log('error');
            throw e;
        });

        client.on('message', function(msg, rinfo) {
            var radius_response = radius.decode({packet: msg, secret: radius_secret});
            if(radius_response.code === 'Access-Accept') {
                if(user) {
                    return userLogin(user);
                } else {
                   return newRadiusUserLogin();
                }
            }
        });

        var encoded = radius.encode(packet);
        client.send(encoded, 0, encoded.length, radius_port, radius_server);

This is how you get authorized. But how to get attributes let's say group, vendor or other data. It is necessary to register the role on the Radius server so that it would be created in the system with this role. How to do it? Maybe someone did? Or maybe someone is well versed in js. I tried to push it into an array with attributes, but it doesn't work

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question