Splunk Dev

On a modular input built with JavaScript SDK, how do I set and retrieve a password that is entered on creation of the input?

mcrooks
New Member

Hi,

I have a customer modular input built with JavaScript SDK. I am trying to set and retrieve a password that is entered on creation of the input. I am looking for assistance on how this endpoint works and where it should reside within the code.

In "validateInput"

var obj = {
                    username: username, 
                    password: password
                  }
        // Create a new storage password
        sp.create(obj, function(err, storagePassword) {
                if (err) { /* handle error */ }
                else {
                    // Storage password was created successfully
                    Logger.log(sp.properties());

                }
            }
        );

In "streamEvents"

sp.fetch(function(err, storagePasswords) {
            if (err) 
                { /* handle error */ }
            else {
                Logger.log("Found " + storagePasswords.list().length + " storage passwords");
                //get the pwd value somehow?
                list = storagePasswords.list()
                for(var i = 0; i<list.length; i++){
                    if(username == list[i].username){
                        pwd == list[i].content.clear_password
                    }
                }
            }
        });

This doesn't seem to set or retrieve so I am clearly doing something wrong.

Thanks in advance.

Mike

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...