client/splunk.js
function(callback) {
            callback = callback || function() {};
            
            var that = this;
            var req = this.get(Paths.currentUser, {}, function(err, response) {
                if (err) {
                    callback(err);
                } 
                else {
                    var username = response.data.entry[0].content.username;
                    var user = new root.User(that, username);
                    user.fetch(function() {
                        if (req.wasAborted) {
                            return; // aborted, so ignore
                        }
                        else {
                            callback.apply(null, arguments);
                        }
                    });
                }
            });
            
            return req;
        }
function(callback) {
            callback = callback || function() {};
            
            var that = this;
            var req = this.get(Paths.currentUser, {}, function(err, response) {
                if (err) {
                    callback(err);
                } 
                else {
                    var username = response.data.entry[0].content.username;
                    var user = new root.User(that, username);
                    user.fetch(function() {
                        if (req.wasAborted) {
                            return; // aborted, so ignore
                        }
                        else {
                            callback.apply(null, arguments);
                        }
                    });
                }
            });
            
            return req;
        }
function ( callback ) { callback = callback || function ( ) { } ; var that = this ; var req = this . get ( Paths . currentUser , { } , function ( err , response ) { if ( err ) { callback ( err ) ; } else { var username = response . data . entry [ 0 ] . content . username ; var user = new root . User ( that , username ) ; user . fetch ( function ( ) { if ( req . wasAborted ) { return ; // aborted, so ignore } else { callback . apply ( null , arguments ) ; } } ) ; } } ) ; return req ; }
Gets the user that is currently logged in.

@example

service.currentUser(function(err, user) {
console.log("Real name: ", user.properties().realname);
});

@param {Function} callback A function to call with the user instance: `(err, user)`.
@return {splunkjs.Service.currentUser} The `User`.

@endpoint authorization/current-context
@method splunkjs.Service
Gets the user that is currently logged in .