cancel
Showing results for 
Search instead for 
Did you mean: 

Using request.getLine to get username and password providing

Brother_Fox
Occasional Contributor

Using request.getLine to get username and password providing

I'm trying to compose traffic script rule to get username and password which can be provided by user.

Tryed:

$user = request.getLine( "\n", $1);

$pass = request.getLine( "\n", $2);

But its not working, breaking after fisrt enter for user.

Any help appreciated.

5 REPLIES 5
pwallace
Community Manager

Re: Using request.getLine to get username and password providing

Hello, can you provide more information about the type of application that you are trying to authenticate here, and which type of virtual server you have configured? request.getLine() will not work with HTTP applications, it works at the level below HTTP.

 

If you are looking to authenticate an HTTP application, there are a few other useful articles on how to use a 401 response to authenticate:

https://community.pulsesecure.net/t5/Pulse-Secure-vADC/HTTP-Basic-Authentication/td-p/35765

https://community.pulsesecure.net/t5/Pulse-Secure-vADC/Converting-Digest-to-Basic-Authentication/ta-...

 

And also here, a much more complex example:

https://community.pulsesecure.net/t5/Pulse-Secure-vADC/Authentication-Overlay-Libraries-making-auth-...

 

Brother_Fox
Occasional Contributor

Re: Using request.getLine to get username and password providing

The service is SMTP on port 25, Virtual Server configured for SMTP. So I need to get username and password from user.

pwallace
Community Manager

Re: Using request.getLine to get username and password providing

ok - there is an article here on reading and processing SMTP - it does not cover the specifics of reading user/pwd, but may be of use. I noticed that the body of the SMTP message is ready with $line = request.getline("\r\n", $next); which uses "\r\n" as the line terminator.

 

Let me know if this is useful:

https://community.pulsesecure.net/t5/Pulse-Secure-vADC/HowTo-Inspect-and-synchronize-SMTP/ta-p/29185

 

Brother_Fox
Occasional Contributor

Re: Using request.getLine to get username and password providing

Replaced \n with \r\n but with no luck:

$user = request.getLine( "\r\n", $1);

$pass = request.getLine( "\r\n", $2);

But still not working, still breaking after fisrt line enter for $user.

Not sure if arguments $1 and $2 are correct. After entering username script must wait for entering password and assign username to $user and password to $pass.

Is it possible to use 2 operators request.getLine in one traffic script rule?

 

Any suggestions?

pwallace
Community Manager

Re: Using request.getLine to get username and password providing

Have you tried to use log.info() to trace individual steps? That can sometimes help.

 

if you think that getLine() is not performing correctly, then it may be best to log a support call and they can look into it.