N
N
nurzhannogerbek2019-04-03 15:07:54
JavaScript
nurzhannogerbek, 2019-04-03 15:07:54

Is it possible to get the client's username by ip or hostname?

Hello comrades! Please help me figure it out.
In a Node.js application, I get a unique ip address of a client that makes a request to a specific URL. Further on this ip address I get a unique hostname of this client. Is it possible in theory to somehow get the client's username ? Perhaps somehow from the Active Directory it is possible to pull out this information?

router.get('/', function(request, response) {
    // Client IP.
    let ip = request.headers['x-forwarded-for'] || request.connection.remoteAddress;
    ip = ip.replace('::ffff:', '');
    console.log(ip);

    dns.lookupService(ip, 22).then((result) => {
        const hostname = result.hostname;
        console.log(hostname);
    });
});

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2019-04-03
@Tabletko

what you want is called single sign on (sso)

M
Mysterion, 2019-04-03
@Mysterion

Such information is not sent via HTTP requests.
Moreover, hostname is not a unique parameter at all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question