Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
16 views
asked in CompleteFTP by (200 points)

I plan to create a jss authentication extension to authenticate the current logged in user before the execution of a jss script. If the user has been successfully authenticated, I want to then take that users username and password to create an instance of ftp to send files from that user.

Example:

authenticateUser(user); //jss authentication extension  

//jss script
var ftp = new Ftp();
ftp.hostName="hostName";
ftp.protocol="sftp";
ftp.userName=authenticatedUsersUserName;
ftp.password=authenticatedUsersPassword;

1 Answer

+1 vote
answered by (43.9k points)

Yes, you can do this.  The only complication is that you'll need to store the password by returning a tag from the authenticator's authenticate function, as shown below:

function checkUserName(userName, userInfo) {
    return userName=="test";
}

function authenticate(userName, password, authInfo) {
    return {
        isCorrectPassword: password=="test",
        tags: {
            password: password
        }
    };
}
Note that I've hardcoded it to accept only the credentials test/test.
Once you've done that you can access the user-name and password from any JSS process trigger as follows:
var userName = system.user.userName;
var password = system.user.tags.get("password");

Does that answer your question?

Categories

...